Hi Nicolas,

> -----Original Message-----
> From: Nicolas Pitre [mailto:[email protected]]
> Sent: Thursday, September 02, 2010 4:30 PM
> To: Bing Zhao
> Cc: [email protected]; Michal Miroslaw; Chris Ball; Andrew Morton
> Subject: RE: [PATCH v2] sdio: skip initialization on powered resume
> 
> On Thu, 2 Sep 2010, Bing Zhao wrote:
> 
> > > Please look at the if() condition, and at the last argument to
> > > mmc_sdio_init_card(), then ponder.
> >
> > You are right. The last argument passed to mmc_sdio_init_card() is zero 
> > actually.
> >
> >             err = mmc_sdio_init_card(host, host->ocr, host->card, 0);
> >
> > >
> > > I think the proper fix goes _inside_ mmc_sdio_init_card() as there are
> > > certainly still validation checks which are appropriate to perform.
> >
> > When you have a thought for the fix, I can do the testing on my system.
> 
> I'm telling you that you should use the powered_resume argument of
> mmc_sdio_init_card() to skip problematic initializations inside
> mmc_sdio_init_card() when powered_resume is not zero.  Looking at the
> existing code should give you examples of how powered_resume is used and
> why.

Thanks for the hint.

The new patch skips reading CCCR, common CIS, and validation of vendor/device 
IDs inside mmc_sdio_init_card() when powered_resume is not zero.

If it looks okay for you I will resend it as V3.


drivers/mmc/core/sdio.c |   38 +++++++++++++++++++++-----------------
 1 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index f332c52..37f64d6 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -434,28 +434,32 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 
ocr,
                goto finish;
        }
 
-       /*
-        * Read the common registers.
-        */
-       err = sdio_read_cccr(card);
-       if (err)
-               goto remove;
+       if (!powered_resume) {
+               /*
+                * Read the common registers.
+                */
+               err = sdio_read_cccr(card);
+               if (err)
+                       goto remove;
 
-       /*
-        * Read the common CIS tuples.
-        */
-       err = sdio_read_common_cis(card);
-       if (err)
-               goto remove;
+               /*
+                * Read the common CIS tuples.
+                */
+               err = sdio_read_common_cis(card);
+               if (err)
+                       goto remove;
+       }
 
        if (oldcard) {
-               int same = (card->cis.vendor == oldcard->cis.vendor &&
-                           card->cis.device == oldcard->cis.device);
                mmc_remove_card(card);
-               if (!same)
-                       return -ENOENT;
 
-               card = oldcard;
+               if (!powered_resume) {
+                       int same = (card->cis.vendor == oldcard->cis.vendor &&
+                                   card->cis.device == oldcard->cis.device);
+                       if (!same)
+                               return -ENOENT;
+               }
+
                return 0;
        }


Regards,

Bing

> 
> 
> Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to