diff options
Diffstat (limited to 'drivers/mmc/core/sdio.c')
-rw-r--r-- | drivers/mmc/core/sdio.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 82f4b9008987..5c4a54d9b6a4 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -702,15 +702,19 @@ static const struct mmc_bus_ops mmc_sdio_ops = { | |||
702 | /* | 702 | /* |
703 | * Starting point for SDIO card init. | 703 | * Starting point for SDIO card init. |
704 | */ | 704 | */ |
705 | int mmc_attach_sdio(struct mmc_host *host, u32 ocr) | 705 | int mmc_attach_sdio(struct mmc_host *host) |
706 | { | 706 | { |
707 | int err; | 707 | int err, i, funcs; |
708 | int i, funcs; | 708 | u32 ocr; |
709 | struct mmc_card *card; | 709 | struct mmc_card *card; |
710 | 710 | ||
711 | BUG_ON(!host); | 711 | BUG_ON(!host); |
712 | WARN_ON(!host->claimed); | 712 | WARN_ON(!host->claimed); |
713 | 713 | ||
714 | err = mmc_send_io_op_cond(host, 0, &ocr); | ||
715 | if (err) | ||
716 | return err; | ||
717 | |||
714 | mmc_attach_bus(host, &mmc_sdio_ops); | 718 | mmc_attach_bus(host, &mmc_sdio_ops); |
715 | if (host->ocr_avail_sdio) | 719 | if (host->ocr_avail_sdio) |
716 | host->ocr_avail = host->ocr_avail_sdio; | 720 | host->ocr_avail = host->ocr_avail_sdio; |
@@ -783,12 +787,12 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) | |||
783 | pm_runtime_enable(&card->sdio_func[i]->dev); | 787 | pm_runtime_enable(&card->sdio_func[i]->dev); |
784 | } | 788 | } |
785 | 789 | ||
786 | mmc_release_host(host); | ||
787 | |||
788 | /* | 790 | /* |
789 | * First add the card to the driver model... | 791 | * First add the card to the driver model... |
790 | */ | 792 | */ |
793 | mmc_release_host(host); | ||
791 | err = mmc_add_card(host->card); | 794 | err = mmc_add_card(host->card); |
795 | mmc_claim_host(host); | ||
792 | if (err) | 796 | if (err) |
793 | goto remove_added; | 797 | goto remove_added; |
794 | 798 | ||
@@ -806,15 +810,17 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr) | |||
806 | 810 | ||
807 | remove_added: | 811 | remove_added: |
808 | /* Remove without lock if the device has been added. */ | 812 | /* Remove without lock if the device has been added. */ |
813 | mmc_release_host(host); | ||
809 | mmc_sdio_remove(host); | 814 | mmc_sdio_remove(host); |
810 | mmc_claim_host(host); | 815 | mmc_claim_host(host); |
811 | remove: | 816 | remove: |
812 | /* And with lock if it hasn't been added. */ | 817 | /* And with lock if it hasn't been added. */ |
818 | mmc_release_host(host); | ||
813 | if (host->card) | 819 | if (host->card) |
814 | mmc_sdio_remove(host); | 820 | mmc_sdio_remove(host); |
821 | mmc_claim_host(host); | ||
815 | err: | 822 | err: |
816 | mmc_detach_bus(host); | 823 | mmc_detach_bus(host); |
817 | mmc_release_host(host); | ||
818 | 824 | ||
819 | printk(KERN_ERR "%s: error %d whilst initialising SDIO card\n", | 825 | printk(KERN_ERR "%s: error %d whilst initialising SDIO card\n", |
820 | mmc_hostname(host), err); | 826 | mmc_hostname(host), err); |