aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/mmc.c14
-rw-r--r--drivers/mmc/mmc.h2
-rw-r--r--drivers/mmc/mmc_sysfs.c10
-rw-r--r--drivers/mmc/tifm_sd.c28
4 files changed, 23 insertions, 31 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 766bc54406e5..21fd39e4a20f 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1165,18 +1165,16 @@ static void mmc_setup(struct mmc_host *host)
1165 */ 1165 */
1166void mmc_detect_change(struct mmc_host *host, unsigned long delay) 1166void mmc_detect_change(struct mmc_host *host, unsigned long delay)
1167{ 1167{
1168 if (delay) 1168 mmc_schedule_delayed_work(&host->detect, delay);
1169 mmc_schedule_delayed_work(&host->detect, delay);
1170 else
1171 mmc_schedule_work(&host->detect);
1172} 1169}
1173 1170
1174EXPORT_SYMBOL(mmc_detect_change); 1171EXPORT_SYMBOL(mmc_detect_change);
1175 1172
1176 1173
1177static void mmc_rescan(void *data) 1174static void mmc_rescan(struct work_struct *work)
1178{ 1175{
1179 struct mmc_host *host = data; 1176 struct mmc_host *host =
1177 container_of(work, struct mmc_host, detect.work);
1180 struct list_head *l, *n; 1178 struct list_head *l, *n;
1181 unsigned char power_mode; 1179 unsigned char power_mode;
1182 1180
@@ -1259,7 +1257,7 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
1259 spin_lock_init(&host->lock); 1257 spin_lock_init(&host->lock);
1260 init_waitqueue_head(&host->wq); 1258 init_waitqueue_head(&host->wq);
1261 INIT_LIST_HEAD(&host->cards); 1259 INIT_LIST_HEAD(&host->cards);
1262 INIT_WORK(&host->detect, mmc_rescan, host); 1260 INIT_DELAYED_WORK(&host->detect, mmc_rescan);
1263 1261
1264 /* 1262 /*
1265 * By default, hosts do not support SGIO or large requests. 1263 * By default, hosts do not support SGIO or large requests.
@@ -1357,7 +1355,7 @@ EXPORT_SYMBOL(mmc_suspend_host);
1357 */ 1355 */
1358int mmc_resume_host(struct mmc_host *host) 1356int mmc_resume_host(struct mmc_host *host)
1359{ 1357{
1360 mmc_rescan(host); 1358 mmc_rescan(&host->detect.work);
1361 1359
1362 return 0; 1360 return 0;
1363} 1361}
diff --git a/drivers/mmc/mmc.h b/drivers/mmc/mmc.h
index cd5e0ab3d84b..149affe0b686 100644
--- a/drivers/mmc/mmc.h
+++ b/drivers/mmc/mmc.h
@@ -20,6 +20,6 @@ void mmc_remove_host_sysfs(struct mmc_host *host);
20void mmc_free_host_sysfs(struct mmc_host *host); 20void mmc_free_host_sysfs(struct mmc_host *host);
21 21
22int mmc_schedule_work(struct work_struct *work); 22int mmc_schedule_work(struct work_struct *work);
23int mmc_schedule_delayed_work(struct work_struct *work, unsigned long delay); 23int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay);
24void mmc_flush_scheduled_work(void); 24void mmc_flush_scheduled_work(void);
25#endif 25#endif
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c
index 10cc9734eaa0..fd9a5fc6db7b 100644
--- a/drivers/mmc/mmc_sysfs.c
+++ b/drivers/mmc/mmc_sysfs.c
@@ -321,17 +321,9 @@ void mmc_free_host_sysfs(struct mmc_host *host)
321static struct workqueue_struct *workqueue; 321static struct workqueue_struct *workqueue;
322 322
323/* 323/*
324 * Internal function. Schedule work in the MMC work queue.
325 */
326int mmc_schedule_work(struct work_struct *work)
327{
328 return queue_work(workqueue, work);
329}
330
331/*
332 * Internal function. Schedule delayed work in the MMC work queue. 324 * Internal function. Schedule delayed work in the MMC work queue.
333 */ 325 */
334int mmc_schedule_delayed_work(struct work_struct *work, unsigned long delay) 326int mmc_schedule_delayed_work(struct delayed_work *work, unsigned long delay)
335{ 327{
336 return queue_delayed_work(workqueue, work, delay); 328 return queue_delayed_work(workqueue, work, delay);
337} 329}
diff --git a/drivers/mmc/tifm_sd.c b/drivers/mmc/tifm_sd.c
index 0fdc55b08a6d..e846499a004c 100644
--- a/drivers/mmc/tifm_sd.c
+++ b/drivers/mmc/tifm_sd.c
@@ -99,7 +99,7 @@ struct tifm_sd {
99 99
100 struct mmc_request *req; 100 struct mmc_request *req;
101 struct work_struct cmd_handler; 101 struct work_struct cmd_handler;
102 struct work_struct abort_handler; 102 struct delayed_work abort_handler;
103 wait_queue_head_t can_eject; 103 wait_queue_head_t can_eject;
104 104
105 size_t written_blocks; 105 size_t written_blocks;
@@ -496,9 +496,9 @@ err_out:
496 mmc_request_done(mmc, mrq); 496 mmc_request_done(mmc, mrq);
497} 497}
498 498
499static void tifm_sd_end_cmd(void *data) 499static void tifm_sd_end_cmd(struct work_struct *work)
500{ 500{
501 struct tifm_sd *host = data; 501 struct tifm_sd *host = container_of(work, struct tifm_sd, cmd_handler);
502 struct tifm_dev *sock = host->dev; 502 struct tifm_dev *sock = host->dev;
503 struct mmc_host *mmc = tifm_get_drvdata(sock); 503 struct mmc_host *mmc = tifm_get_drvdata(sock);
504 struct mmc_request *mrq; 504 struct mmc_request *mrq;
@@ -608,9 +608,9 @@ err_out:
608 mmc_request_done(mmc, mrq); 608 mmc_request_done(mmc, mrq);
609} 609}
610 610
611static void tifm_sd_end_cmd_nodma(void *data) 611static void tifm_sd_end_cmd_nodma(struct work_struct *work)
612{ 612{
613 struct tifm_sd *host = (struct tifm_sd*)data; 613 struct tifm_sd *host = container_of(work, struct tifm_sd, cmd_handler);
614 struct tifm_dev *sock = host->dev; 614 struct tifm_dev *sock = host->dev;
615 struct mmc_host *mmc = tifm_get_drvdata(sock); 615 struct mmc_host *mmc = tifm_get_drvdata(sock);
616 struct mmc_request *mrq; 616 struct mmc_request *mrq;
@@ -661,11 +661,14 @@ static void tifm_sd_end_cmd_nodma(void *data)
661 mmc_request_done(mmc, mrq); 661 mmc_request_done(mmc, mrq);
662} 662}
663 663
664static void tifm_sd_abort(void *data) 664static void tifm_sd_abort(struct work_struct *work)
665{ 665{
666 struct tifm_sd *host =
667 container_of(work, struct tifm_sd, abort_handler.work);
668
666 printk(KERN_ERR DRIVER_NAME 669 printk(KERN_ERR DRIVER_NAME
667 ": card failed to respond for a long period of time"); 670 ": card failed to respond for a long period of time");
668 tifm_eject(((struct tifm_sd*)data)->dev); 671 tifm_eject(host->dev);
669} 672}
670 673
671static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios) 674static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios)
@@ -762,9 +765,9 @@ static struct mmc_host_ops tifm_sd_ops = {
762 .get_ro = tifm_sd_ro 765 .get_ro = tifm_sd_ro
763}; 766};
764 767
765static void tifm_sd_register_host(void *data) 768static void tifm_sd_register_host(struct work_struct *work)
766{ 769{
767 struct tifm_sd *host = (struct tifm_sd*)data; 770 struct tifm_sd *host = container_of(work, struct tifm_sd, cmd_handler);
768 struct tifm_dev *sock = host->dev; 771 struct tifm_dev *sock = host->dev;
769 struct mmc_host *mmc = tifm_get_drvdata(sock); 772 struct mmc_host *mmc = tifm_get_drvdata(sock);
770 unsigned long flags; 773 unsigned long flags;
@@ -772,8 +775,7 @@ static void tifm_sd_register_host(void *data)
772 spin_lock_irqsave(&sock->lock, flags); 775 spin_lock_irqsave(&sock->lock, flags);
773 host->flags |= HOST_REG; 776 host->flags |= HOST_REG;
774 PREPARE_WORK(&host->cmd_handler, 777 PREPARE_WORK(&host->cmd_handler,
775 no_dma ? tifm_sd_end_cmd_nodma : tifm_sd_end_cmd, 778 no_dma ? tifm_sd_end_cmd_nodma : tifm_sd_end_cmd);
776 data);
777 spin_unlock_irqrestore(&sock->lock, flags); 779 spin_unlock_irqrestore(&sock->lock, flags);
778 dev_dbg(&sock->dev, "adding host\n"); 780 dev_dbg(&sock->dev, "adding host\n");
779 mmc_add_host(mmc); 781 mmc_add_host(mmc);
@@ -799,8 +801,8 @@ static int tifm_sd_probe(struct tifm_dev *sock)
799 host->dev = sock; 801 host->dev = sock;
800 host->clk_div = 61; 802 host->clk_div = 61;
801 init_waitqueue_head(&host->can_eject); 803 init_waitqueue_head(&host->can_eject);
802 INIT_WORK(&host->cmd_handler, tifm_sd_register_host, host); 804 INIT_WORK(&host->cmd_handler, tifm_sd_register_host);
803 INIT_WORK(&host->abort_handler, tifm_sd_abort, host); 805 INIT_DELAYED_WORK(&host->abort_handler, tifm_sd_abort);
804 806
805 tifm_set_drvdata(sock, mmc); 807 tifm_set_drvdata(sock, mmc);
806 sock->signal_irq = tifm_sd_signal_irq; 808 sock->signal_irq = tifm_sd_signal_irq;