]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mmc: be more verbose about card insertions/removal
authorPierre Ossman <drzeus@drzeus.cx>
Sun, 22 Jul 2007 22:12:10 +0000 (00:12 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Thu, 26 Jul 2007 00:05:04 +0000 (02:05 +0200)
Let the user know that the kernel actually detected the card
by printing some basic information in dmesg.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/bus.c
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c

index 348b566bf4fd6b3c359d58f08f863afda8f159c7..fe0e785ed7d2f57634fac42f5d6613417646affa 100644 (file)
@@ -209,10 +209,30 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host)
 int mmc_add_card(struct mmc_card *card)
 {
        int ret;
+       const char *type;
 
        snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
                 "%s:%04x", mmc_hostname(card->host), card->rca);
 
+       switch (card->type) {
+       case MMC_TYPE_MMC:
+               type = "MMC";
+               break;
+       case MMC_TYPE_SD:
+               type = "SD";
+               if (mmc_card_blockaddr(card))
+                       type = "SDHC";
+               break;
+       default:
+               type = "?";
+               break;
+       }
+
+       printk(KERN_INFO "%s: new %s%s card at address %04x\n",
+               mmc_hostname(card->host),
+               mmc_card_highspeed(card) ? "high speed " : "",
+               type, card->rca);
+
        card->dev.uevent_suppress = 1;
 
        ret = device_add(&card->dev);
@@ -243,6 +263,9 @@ int mmc_add_card(struct mmc_card *card)
 void mmc_remove_card(struct mmc_card *card)
 {
        if (mmc_card_present(card)) {
+               printk(KERN_INFO "%s: card %04x removed\n",
+                       mmc_hostname(card->host), card->rca);
+
                if (card->host->bus_ops->sysfs_remove)
                        card->host->bus_ops->sysfs_remove(card->host, card);
                device_del(&card->dev);
index cd0c6b246feda2777c4ffc931bbbfa7091847955..f606b6678b004ff1ae9e6f0d6e9f9823220bd4b5 100644 (file)
@@ -556,8 +556,10 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
        /*
         * Can we support the voltage of the card?
         */
-       if (!host->ocr)
+       if (!host->ocr) {
+               err = -EINVAL;
                goto err;
+       }
 
        /*
         * Detect and init the card.
@@ -582,6 +584,9 @@ err:
        mmc_detach_bus(host);
        mmc_release_host(host);
 
+       printk(KERN_ERR "%s: error %d whilst initialising MMC card\n",
+               mmc_hostname(host), err);
+
        return 0;
 }
 
index 0b478de48accd8cf12e7d81483c9e8396761ca48..b6a2e53c9213a53c3a032aa3daaf1fdcb9beed64 100644 (file)
@@ -637,8 +637,10 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
        /*
         * Can we support the voltage(s) of the card(s)?
         */
-       if (!host->ocr)
+       if (!host->ocr) {
+               err = -EINVAL;
                goto err;
+       }
 
        /*
         * Detect and init the card.
@@ -663,6 +665,9 @@ err:
        mmc_detach_bus(host);
        mmc_release_host(host);
 
+       printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
+               mmc_hostname(host), err);
+
        return 0;
 }