summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-05-01 16:11:57 +0200
committerPierre Ossman <drzeus@drzeus.cx>2007-05-01 16:11:57 +0200
commitbd766312618d2ecc85bce663f95faec601447ecb (patch)
tree65b38b556f766d0e41c553989271db82c26e860d /drivers/mmc
parent6abaa0c9fec563538f2a28a682af8c89bb9b125c (diff)
downloadlinux-bd766312618d2ecc85bce663f95faec601447ecb.tar.gz
linux-bd766312618d2ecc85bce663f95faec601447ecb.tar.bz2
linux-bd766312618d2ecc85bce663f95faec601447ecb.zip
mmc: remove old card states
Remove card states that no longer make any sense. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/mmc.c22
-rw-r--r--drivers/mmc/core/sd.c23
-rw-r--r--drivers/mmc/core/sysfs.c5
3 files changed, 31 insertions, 19 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 619581e49163..42cc2867ed7d 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -56,7 +56,7 @@ static const unsigned int tacc_mant[] = {
/*
* Given the decoded CSD structure, decode the raw CID to our CID structure.
*/
-static void mmc_decode_cid(struct mmc_card *card)
+static int mmc_decode_cid(struct mmc_card *card)
{
u32 *resp = card->raw_cid;
@@ -101,15 +101,16 @@ static void mmc_decode_cid(struct mmc_card *card)
default:
printk("%s: card has unknown MMCA version %d\n",
mmc_hostname(card->host), card->csd.mmca_vsn);
- mmc_card_set_bad(card);
- break;
+ return -EINVAL;
}
+
+ return 0;
}
/*
* Given a 128-bit response, decode to our card CSD structure.
*/
-static void mmc_decode_csd(struct mmc_card *card)
+static int mmc_decode_csd(struct mmc_card *card)
{
struct mmc_csd *csd = &card->csd;
unsigned int e, m, csd_struct;
@@ -123,8 +124,7 @@ static void mmc_decode_csd(struct mmc_card *card)
if (csd_struct != 1 && csd_struct != 2) {
printk("%s: unrecognised CSD structure version %d\n",
mmc_hostname(card->host), csd_struct);
- mmc_card_set_bad(card);
- return;
+ return -EINVAL;
}
csd->mmca_vsn = UNSTUFF_BITS(resp, 122, 4);
@@ -149,6 +149,8 @@ static void mmc_decode_csd(struct mmc_card *card)
csd->r2w_factor = UNSTUFF_BITS(resp, 26, 3);
csd->write_blkbits = UNSTUFF_BITS(resp, 22, 4);
csd->write_partial = UNSTUFF_BITS(resp, 21, 1);
+
+ return 0;
}
/*
@@ -300,8 +302,12 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (err != MMC_ERR_NONE)
goto free_card;
- mmc_decode_csd(card);
- mmc_decode_cid(card);
+ err = mmc_decode_csd(card);
+ if (err < 0)
+ goto free_card;
+ err = mmc_decode_cid(card);
+ if (err < 0)
+ goto free_card;
}
/*
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 6597e778f70e..c1dfd03d559a 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -88,7 +88,7 @@ static void mmc_decode_cid(struct mmc_card *card)
/*
* Given a 128-bit response, decode to our card CSD structure.
*/
-static void mmc_decode_csd(struct mmc_card *card)
+static int mmc_decode_csd(struct mmc_card *card)
{
struct mmc_csd *csd = &card->csd;
unsigned int e, m, csd_struct;
@@ -151,15 +151,16 @@ static void mmc_decode_csd(struct mmc_card *card)
default:
printk("%s: unrecognised CSD structure version %d\n",
mmc_hostname(card->host), csd_struct);
- mmc_card_set_bad(card);
- return;
+ return -EINVAL;
}
+
+ return 0;
}
/*
* Given a 64-bit response, decode to our card SCR structure.
*/
-static void mmc_decode_scr(struct mmc_card *card)
+static int mmc_decode_scr(struct mmc_card *card)
{
struct sd_scr *scr = &card->scr;
unsigned int scr_struct;
@@ -174,12 +175,13 @@ static void mmc_decode_scr(struct mmc_card *card)
if (scr_struct != 0) {
printk("%s: unrecognised SCR structure version %d\n",
mmc_hostname(card->host), scr_struct);
- mmc_card_set_bad(card);
- return;
+ return -EINVAL;
}
scr->sda_vsn = UNSTUFF_BITS(resp, 56, 4);
scr->bus_widths = UNSTUFF_BITS(resp, 48, 4);
+
+ return 0;
}
/*
@@ -342,7 +344,10 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (err != MMC_ERR_NONE)
goto free_card;
- mmc_decode_csd(card);
+ err = mmc_decode_csd(card);
+ if (err < 0)
+ goto free_card;
+
mmc_decode_cid(card);
}
@@ -361,7 +366,9 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
if (err != MMC_ERR_NONE)
goto free_card;
- mmc_decode_scr(card);
+ err = mmc_decode_scr(card);
+ if (err < 0)
+ goto free_card;
/*
* Fetch switch information from card.
diff --git a/drivers/mmc/core/sysfs.c b/drivers/mmc/core/sysfs.c
index 5c9ce02e7e55..843b1fbba557 100644
--- a/drivers/mmc/core/sysfs.c
+++ b/drivers/mmc/core/sysfs.c
@@ -72,12 +72,11 @@ static void mmc_release_card(struct device *dev)
/*
* This currently matches any MMC driver to any MMC card - drivers
* themselves make the decision whether to drive this card in their
- * probe method. However, we force "bad" cards to fail.
+ * probe method.
*/
static int mmc_bus_match(struct device *dev, struct device_driver *drv)
{
- struct mmc_card *card = dev_to_mmc_card(dev);
- return !mmc_card_bad(card);
+ return 1;
}
static int