aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sd.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2009-09-22 19:45:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 10:39:38 -0400
commit95cdfb72b9bc568803f395c266152c71b034b461 (patch)
treeba4d10ee9eb595398d14cf44b433b82ea7802996 /drivers/mmc/core/sd.c
parent17d33e14f7ffc05f8c81e4a3bdb9a8003a05dcce (diff)
mmc: propagate error codes back from bus drivers' suspend/resume methods
Especially for SDIO drivers which may have special conditions/errors to report, it is a good thing to relay the returned error code back to upper layers. This also allows for the rationalization of the resume path where code to "remove" a no-longer-existing or replaced card was duplicated into the MMC, SD and SDIO bus drivers. In the SDIO case, if a function suspend method returns an error, then all previously suspended functions are resumed and the error returned. An exception is made for -ENOSYS which the core interprets as "we don't support suspend so just kick the card out for suspend and return success". When resuming SDIO cards, the core code only validates the manufacturer and product IDs to make sure the same kind of card is still present before invoking functions resume methods. It's the function driver's responsibility to perform further tests to confirm that the actual same card is present (same MAC address, etc.) and return an error otherwise. Signed-off-by: Nicolas Pitre <nico@marvell.com> Cc: <linux-mmc@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/mmc/core/sd.c')
-rw-r--r--drivers/mmc/core/sd.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 13b3a6b8f5b..10b2a4d20f5 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -564,7 +564,7 @@ static void mmc_sd_detect(struct mmc_host *host)
564/* 564/*
565 * Suspend callback from host. 565 * Suspend callback from host.
566 */ 566 */
567static void mmc_sd_suspend(struct mmc_host *host) 567static int mmc_sd_suspend(struct mmc_host *host)
568{ 568{
569 BUG_ON(!host); 569 BUG_ON(!host);
570 BUG_ON(!host->card); 570 BUG_ON(!host->card);
@@ -574,6 +574,8 @@ static void mmc_sd_suspend(struct mmc_host *host)
574 mmc_deselect_cards(host); 574 mmc_deselect_cards(host);
575 host->card->state &= ~MMC_STATE_HIGHSPEED; 575 host->card->state &= ~MMC_STATE_HIGHSPEED;
576 mmc_release_host(host); 576 mmc_release_host(host);
577
578 return 0;
577} 579}
578 580
579/* 581/*
@@ -582,7 +584,7 @@ static void mmc_sd_suspend(struct mmc_host *host)
582 * This function tries to determine if the same card is still present 584 * This function tries to determine if the same card is still present
583 * and, if so, restore all state to it. 585 * and, if so, restore all state to it.
584 */ 586 */
585static void mmc_sd_resume(struct mmc_host *host) 587static int mmc_sd_resume(struct mmc_host *host)
586{ 588{
587 int err; 589 int err;
588 590
@@ -593,14 +595,7 @@ static void mmc_sd_resume(struct mmc_host *host)
593 err = mmc_sd_init_card(host, host->ocr, host->card); 595 err = mmc_sd_init_card(host, host->ocr, host->card);
594 mmc_release_host(host); 596 mmc_release_host(host);
595 597
596 if (err) { 598 return err;
597 mmc_sd_remove(host);
598
599 mmc_claim_host(host);
600 mmc_detach_bus(host);
601 mmc_release_host(host);
602 }
603
604} 599}
605 600
606static void mmc_sd_power_restore(struct mmc_host *host) 601static void mmc_sd_power_restore(struct mmc_host *host)