Remove card states that no longer make any sense.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
/*
* 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;
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;
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);
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;
}
/*
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;
}
/*
/*
* 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;
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;
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;
}
/*
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);
}
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.
/*
* 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
#define MMC_TYPE_SD 1 /* SD card */
unsigned int state; /* (our) card state */
#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
-#define MMC_STATE_DEAD (1<<1) /* device no longer in stack */
-#define MMC_STATE_BAD (1<<2) /* unrecognised device */
-#define MMC_STATE_READONLY (1<<3) /* card is read-only */
-#define MMC_STATE_HIGHSPEED (1<<4) /* card is in high speed mode */
-#define MMC_STATE_BLOCKADDR (1<<5) /* card uses block-addressing */
+#define MMC_STATE_READONLY (1<<1) /* card is read-only */
+#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
+#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
u32 raw_cid[4]; /* raw card CID */
u32 raw_csd[4]; /* raw card CSD */
u32 raw_scr[2]; /* raw card SCR */
#define mmc_card_sd(c) ((c)->type == MMC_TYPE_SD)
#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
-#define mmc_card_dead(c) ((c)->state & MMC_STATE_DEAD)
-#define mmc_card_bad(c) ((c)->state & MMC_STATE_BAD)
#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
-#define mmc_card_set_dead(c) ((c)->state |= MMC_STATE_DEAD)
-#define mmc_card_set_bad(c) ((c)->state |= MMC_STATE_BAD)
#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)