diff options
Diffstat (limited to 'drivers/mmc/tifm_sd.c')
-rw-r--r-- | drivers/mmc/tifm_sd.c | 28 |
1 files changed, 15 insertions, 13 deletions
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 | ||
499 | static void tifm_sd_end_cmd(void *data) | 499 | static 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 | ||
611 | static void tifm_sd_end_cmd_nodma(void *data) | 611 | static 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 | ||
664 | static void tifm_sd_abort(void *data) | 664 | static 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 | ||
671 | static void tifm_sd_ios(struct mmc_host *mmc, struct mmc_ios *ios) | 674 | static 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 | ||
765 | static void tifm_sd_register_host(void *data) | 768 | static 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; |