>From 1ede4b378f61e59b9b03c0994f12e582dfb219e5 Mon Sep 17 00:00:00 2001
From: Ohad Ben-Cohen <[email protected]>
Date: Thu, 30 Sep 2010 16:30:31 +0200
Subject: [PATCH 22/26] sdio: ensure mmc_sdio_detect is powered

To prevent an erroneous removal of the card, make sure
the device is powered when it is mmc_sdio_detect()ed.

This is required since mmc_sdio_detect may be invoked
while the device is runtime suspended (e.g., MMC core
is rescanning when system comes out of suspend).

Signed-off-by: Ohad Ben-Cohen <[email protected]>
Signed-off-by: Claude Brouat <[email protected]>
---
 drivers/mmc/core/sdio.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index c172901..e7c97ed 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -419,6 +419,11 @@ static void mmc_sdio_detect(struct mmc_host *host)
     BUG_ON(!host);
     BUG_ON(!host->card);

+    /* Make sure card is powered before detecting it */
+    err = pm_runtime_get_sync(&host->card->dev);
+    if (err < 0)
+          goto out;
+
     mmc_claim_host(host);

     /*
@@ -428,6 +433,7 @@ static void mmc_sdio_detect(struct mmc_host *host)

     mmc_release_host(host);

+out:
     if (err) {
           mmc_sdio_remove(host);

@@ -435,6 +441,9 @@ static void mmc_sdio_detect(struct mmc_host *host)
           mmc_detach_bus(host);
           mmc_release_host(host);
     }
+
+    /* Tell PM core that we're done */
+    pm_runtime_put(&host->card->dev);
 }

 /*
--
1.6.3.3




Claude BROUAT
UMG/MIPE/WSIV  System Integrator
Office:    +33 (0)1 72 21 04 54
mailto: mailto:[email protected]

Intel Corp. SAS
134, av du Général Eisenhower
BP 73586
31100 TOULOUSE
France



---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

Attachment: 0022-sdio-ensure-mmc_sdio_detect-is-powered.patch
Description: 0022-sdio-ensure-mmc_sdio_detect-is-powered.patch

_______________________________________________
Meego-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to