[PATCH] [218/275] mmc: sdio: remember new card RCA when redetecting card

From: Andi Kleen
Date: Wed Mar 30 2011 - 17:23:45 EST


2.6.35-longterm review patch. If anyone has any objections, please let me know.

------------------
From: Stefan Nilsson XK <stefan.xk.nilsson@xxxxxxxxxxxxxx>

commit 0aab3995485b8a994bf29a995a008c9ea4a28054 upstream.

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. This bug's been present since the "oldcard"
handling was introduced in 2.6.32.

Signed-off-by: Stefan Nilsson XK <stefan.xk.nilsson@xxxxxxxxxxxxxx>
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Reviewed-by: Ulf Hansson <ulf.hansson@xxxxxxxxxxxxxx>
Reviewed-by: Pawel Wieczorkiewicz <pawel.wieczorkiewicz@xxxxxxxxxxxxxx>
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Signed-off-by: Chris Ball <cjb@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/mmc/core/sdio.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6.35.y/drivers/mmc/core/sdio.c
===================================================================
--- linux-2.6.35.y.orig/drivers/mmc/core/sdio.c 2011-03-29 22:50:30.116487813 -0700
+++ linux-2.6.35.y/drivers/mmc/core/sdio.c 2011-03-29 23:03:02.787228853 -0700
@@ -309,6 +309,14 @@
if (err)
goto remove;

+ /*
+ * Update oldcard with the new RCA received from the SDIO
+ * device -- we're doing this so that it's updated in the
+ * "card" struct when oldcard overwrites that later.
+ */
+ if (oldcard)
+ oldcard->rca = card->rca;
+
mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/