public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc/sdio: remember new card RCA when redetecting card
@ 2011-03-01 13:41 Linus Walleij
  2011-03-02 16:04 ` Linus Walleij
  2011-03-02 16:32 ` Chris Ball
  0 siblings, 2 replies; 5+ messages in thread
From: Linus Walleij @ 2011-03-01 13:41 UTC (permalink / raw)
  To: linux-mmc, Chris Ball; +Cc: Lee Jones, Stefan Nilsson XK, Linus Walleij

From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>

During redetection of a SDIO card, a request for a new card RCA
was submitted to the card, but was then overwritten by the old RCA.
This caused the card to be deselected instead of selected when using
the incorrect RCA.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
Reviewed-by: Ulf Hansson <ulf.hansson@stericsson.com>
Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mmc/core/sdio.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index 617e9ad..30d065d 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -395,6 +395,13 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 		if (err)
 			goto remove;
 
+		/*
+		 * Update oldcard with the new RCA received from the
+		 * SDIO device.
+		 */
+		if (oldcard)
+			oldcard->rca = card->rca;
+
 		mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
 	}
 
-- 
1.7.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc/sdio: remember new card RCA when redetecting card
  2011-03-01 13:41 [PATCH] mmc/sdio: remember new card RCA when redetecting card Linus Walleij
@ 2011-03-02 16:04 ` Linus Walleij
  2011-03-02 16:32 ` Chris Ball
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2011-03-02 16:04 UTC (permalink / raw)
  To: linux-mmc, Chris Ball; +Cc: Lee Jones, Stefan Nilsson XK, Linus Walleij

2011/3/1 Linus Walleij <linus.walleij@stericsson.com>:

> From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
>
> During redetection of a SDIO card, a request for a new card RCA
> was submitted to the card, but was then overwritten by the old RCA.
> This caused the card to be deselected instead of selected when using
> the incorrect RCA.

Chris can you look at this, I think it's a bug as in "-rc bug" that
needs fixing.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc/sdio: remember new card RCA when redetecting card
  2011-03-01 13:41 [PATCH] mmc/sdio: remember new card RCA when redetecting card Linus Walleij
  2011-03-02 16:04 ` Linus Walleij
@ 2011-03-02 16:32 ` Chris Ball
  2011-03-03  2:56   ` Nicolas Pitre
  1 sibling, 1 reply; 5+ messages in thread
From: Chris Ball @ 2011-03-02 16:32 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-mmc, Lee Jones, Stefan Nilsson XK, Linus Walleij

Hi,

On Tue, Mar 01 2011, Linus Walleij wrote:
> From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
>
> During redetection of a SDIO card, a request for a new card RCA
> was submitted to the card, but was then overwritten by the old RCA.
> This caused the card to be deselected instead of selected when using
> the incorrect RCA.

Nico, would you mind taking a look at this, please?  Assigning to a
member of oldcard because we know it's later going to be copied into
card seems a little ugly to me (at least without a comment explaining
that); I'm wondering if you'd suggest something else here.

And, just to check we're all on the same page, this would be a
regression introduced back at 2.6.32 when the "oldcard" handling
was first merged, so it should be sent up with a stable tag.

(I'm not yet sure whether I want to send this to mainline during the
last week of a release and without any previous testing, given that
the bug is more than a year old already.  Let's see what Nico says.)

Thanks.

> Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
> Reviewed-by: Ulf Hansson <ulf.hansson@stericsson.com>
> Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/mmc/core/sdio.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
> index 617e9ad..30d065d 100644
> --- a/drivers/mmc/core/sdio.c
> +++ b/drivers/mmc/core/sdio.c
> @@ -395,6 +395,13 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
>  		if (err)
>  			goto remove;
>  
> +		/*
> +		 * Update oldcard with the new RCA received from the
> +		 * SDIO device.
> +		 */
> +		if (oldcard)
> +			oldcard->rca = card->rca;
> +
>  		mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
>  	}

-- 
Chris Ball   <cjb@laptop.org>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc/sdio: remember new card RCA when redetecting card
  2011-03-02 16:32 ` Chris Ball
@ 2011-03-03  2:56   ` Nicolas Pitre
  2011-03-03  3:15     ` Chris Ball
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Pitre @ 2011-03-03  2:56 UTC (permalink / raw)
  To: Chris Ball; +Cc: linux-mmc, Lee Jones, Stefan Nilsson XK, Linus Walleij

On Wed, 2 Mar 2011, Chris Ball wrote:

> Hi,
> 
> On Tue, Mar 01 2011, Linus Walleij wrote:
> > From: Stefan Nilsson XK <stefan.xk.nilsson@stericsson.com>
> >
> > During redetection of a SDIO card, a request for a new card RCA
> > was submitted to the card, but was then overwritten by the old RCA.
> > This caused the card to be deselected instead of selected when using
> > the incorrect RCA.
> 
> Nico, would you mind taking a look at this, please?  Assigning to a
> member of oldcard because we know it's later going to be copied into
> card seems a little ugly to me (at least without a comment explaining
> that); I'm wondering if you'd suggest something else here.

No, I have nothing better to suggest at the moment.

> And, just to check we're all on the same page, this would be a
> regression introduced back at 2.6.32 when the "oldcard" handling
> was first merged, so it should be sent up with a stable tag.

Depends how you define a regression.  If the "oldcard" handling always 
screwed up the rca, then it simply never was right, hence it is hard to 
claim it worked better before. Probably this just worked so far by luck, 
or those cards tested with this code don't change their rca.

> (I'm not yet sure whether I want to send this to mainline during the
> last week of a release and without any previous testing, given that
> the bug is more than a year old already.  Let's see what Nico says.)

I'd queue this for the next merge window only, and not risk introducing 
a real regression in v2.6.38 at the last moment by making things worse 
somehow.


Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc/sdio: remember new card RCA when redetecting card
  2011-03-03  2:56   ` Nicolas Pitre
@ 2011-03-03  3:15     ` Chris Ball
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2011-03-03  3:15 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: linux-mmc, Lee Jones, Stefan Nilsson XK, Linus Walleij

Hi Nico, thanks for the quick reply,

On Wed, Mar 02 2011, Nicolas Pitre wrote:
> No, I have nothing better to suggest at the moment.

Okay.  I'll add a comment explaining what's going on.

>> And, just to check we're all on the same page, this would be a
>> regression introduced back at 2.6.32 when the "oldcard" handling
>> was first merged, so it should be sent up with a stable tag.
>
> Depends how you define a regression.  If the "oldcard" handling always 
> screwed up the rca, then it simply never was right, hence it is hard to 
> claim it worked better before. Probably this just worked so far by luck, 
> or those cards tested with this code don't change their rca.

Yes, it's never been right under the "oldcard" handling which was merged
in 2.6.32.  I agree with your guesses on why it wasn't noticed before.

>> (I'm not yet sure whether I want to send this to mainline during the
>> last week of a release and without any previous testing, given that
>> the bug is more than a year old already.  Let's see what Nico says.)
>
> I'd queue this for the next merge window only, and not risk introducing 
> a real regression in v2.6.38 at the last moment by making things worse 
> somehow.

Thanks, that exactly matches my intuition on what to do.  I'll push it
to mmc-next now and add a stable@ tag.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-03  3:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-01 13:41 [PATCH] mmc/sdio: remember new card RCA when redetecting card Linus Walleij
2011-03-02 16:04 ` Linus Walleij
2011-03-02 16:32 ` Chris Ball
2011-03-03  2:56   ` Nicolas Pitre
2011-03-03  3:15     ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox