mmc: core: Add a debug print when the card may have been replaced
If the card was removed in suspended state and a new one was inserted, print a debug log when the check detects that it's not the old card. Signed-off-by: hongjiefang <hongjiefang@asrmicro.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
@ -1594,6 +1594,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
|
|||||||
|
|
||||||
if (oldcard) {
|
if (oldcard) {
|
||||||
if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
|
if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
|
||||||
|
pr_debug("%s: Perhaps the card was replaced\n",
|
||||||
|
mmc_hostname(host));
|
||||||
err = -ENOENT;
|
err = -ENOENT;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
@ -951,8 +951,11 @@ retry:
|
|||||||
return err;
|
return err;
|
||||||
|
|
||||||
if (oldcard) {
|
if (oldcard) {
|
||||||
if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0)
|
if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
|
||||||
|
pr_debug("%s: Perhaps the card was replaced\n",
|
||||||
|
mmc_hostname(host));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
card = oldcard;
|
card = oldcard;
|
||||||
} else {
|
} else {
|
||||||
|
@ -617,6 +617,8 @@ try_again:
|
|||||||
if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
|
if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
|
||||||
memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
|
memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
|
||||||
mmc_remove_card(card);
|
mmc_remove_card(card);
|
||||||
|
pr_debug("%s: Perhaps the card was replaced\n",
|
||||||
|
mmc_hostname(host));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -624,6 +626,8 @@ try_again:
|
|||||||
|
|
||||||
if (oldcard && oldcard->type != MMC_TYPE_SDIO) {
|
if (oldcard && oldcard->type != MMC_TYPE_SDIO) {
|
||||||
mmc_remove_card(card);
|
mmc_remove_card(card);
|
||||||
|
pr_debug("%s: Perhaps the card was replaced\n",
|
||||||
|
mmc_hostname(host));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -736,8 +740,11 @@ try_again:
|
|||||||
int same = (card->cis.vendor == oldcard->cis.vendor &&
|
int same = (card->cis.vendor == oldcard->cis.vendor &&
|
||||||
card->cis.device == oldcard->cis.device);
|
card->cis.device == oldcard->cis.device);
|
||||||
mmc_remove_card(card);
|
mmc_remove_card(card);
|
||||||
if (!same)
|
if (!same) {
|
||||||
|
pr_debug("%s: Perhaps the card was replaced\n",
|
||||||
|
mmc_hostname(host));
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
|
||||||
card = oldcard;
|
card = oldcard;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user