]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: core: Add a debug print when the card may have been replaced
authorhongjiefang <hongjiefang@asrmicro.com>
Thu, 28 Feb 2019 06:08:28 +0000 (14:08 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Thu, 28 Feb 2019 08:28:27 +0000 (09:28 +0100)
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>
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
drivers/mmc/core/sdio.c

index 09c688f5ff655d795790d398a13369585368d5ec..3e786ba204c3fd63a4f6b10b9f7acefb41276a88 100644 (file)
@@ -1594,6 +1594,8 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
 
        if (oldcard) {
                if (memcmp(cid, oldcard->raw_cid, sizeof(cid)) != 0) {
+                       pr_debug("%s: Perhaps the card was replaced\n",
+                               mmc_hostname(host));
                        err = -ENOENT;
                        goto err;
                }
index 2b4fc2205b535b84b6382e04d432a18bf98fb995..265e1aeeb9d889c0cdfb33c0524d8504c085c2ef 100644 (file)
@@ -951,8 +951,11 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr,
                return err;
 
        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;
+               }
 
                card = oldcard;
        } else {
index d8e17ea6126de8339beddd776702e5aa3c0691d5..6718fc8bb40fdccb197b057440c37f6981161dea 100644 (file)
@@ -617,6 +617,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
                if (oldcard && (oldcard->type != MMC_TYPE_SD_COMBO ||
                    memcmp(card->raw_cid, oldcard->raw_cid, sizeof(card->raw_cid)) != 0)) {
                        mmc_remove_card(card);
+                       pr_debug("%s: Perhaps the card was replaced\n",
+                               mmc_hostname(host));
                        return -ENOENT;
                }
        } else {
@@ -624,6 +626,8 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
 
                if (oldcard && oldcard->type != MMC_TYPE_SDIO) {
                        mmc_remove_card(card);
+                       pr_debug("%s: Perhaps the card was replaced\n",
+                               mmc_hostname(host));
                        return -ENOENT;
                }
        }
@@ -736,8 +740,11 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr,
                int same = (card->cis.vendor == oldcard->cis.vendor &&
                            card->cis.device == oldcard->cis.device);
                mmc_remove_card(card);
-               if (!same)
+               if (!same) {
+                       pr_debug("%s: Perhaps the card was replaced\n",
+                               mmc_hostname(host));
                        return -ENOENT;
+               }
 
                card = oldcard;
        }