aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-07-22 18:12:10 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-07-25 20:05:04 -0400
commit109b5bed18441599b5ab0e1f3623efa5715a4703 (patch)
tree67d71adcfad02633cb643b2bb3d51218dd2a3938 /drivers
parent2986d0bf23d97d68804ccfa80965073ccf1af242 (diff)
mmc: be more verbose about card insertions/removal
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/core/bus.c23
-rw-r--r--drivers/mmc/core/mmc.c7
-rw-r--r--drivers/mmc/core/sd.c7
3 files changed, 35 insertions, 2 deletions
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 348b566bf4fd..fe0e785ed7d2 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -209,10 +209,30 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host)
209int mmc_add_card(struct mmc_card *card) 209int mmc_add_card(struct mmc_card *card)
210{ 210{
211 int ret; 211 int ret;
212 const char *type;
212 213
213 snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), 214 snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
214 "%s:%04x", mmc_hostname(card->host), card->rca); 215 "%s:%04x", mmc_hostname(card->host), card->rca);
215 216
217 switch (card->type) {
218 case MMC_TYPE_MMC:
219 type = "MMC";
220 break;
221 case MMC_TYPE_SD:
222 type = "SD";
223 if (mmc_card_blockaddr(card))
224 type = "SDHC";
225 break;
226 default:
227 type = "?";
228 break;
229 }
230
231 printk(KERN_INFO "%s: new %s%s card at address %04x\n",
232 mmc_hostname(card->host),
233 mmc_card_highspeed(card) ? "high speed " : "",
234 type, card->rca);
235
216 card->dev.uevent_suppress = 1; 236 card->dev.uevent_suppress = 1;
217 237
218 ret = device_add(&card->dev); 238 ret = device_add(&card->dev);
@@ -243,6 +263,9 @@ int mmc_add_card(struct mmc_card *card)
243void mmc_remove_card(struct mmc_card *card) 263void mmc_remove_card(struct mmc_card *card)
244{ 264{
245 if (mmc_card_present(card)) { 265 if (mmc_card_present(card)) {
266 printk(KERN_INFO "%s: card %04x removed\n",
267 mmc_hostname(card->host), card->rca);
268
246 if (card->host->bus_ops->sysfs_remove) 269 if (card->host->bus_ops->sysfs_remove)
247 card->host->bus_ops->sysfs_remove(card->host, card); 270 card->host->bus_ops->sysfs_remove(card->host, card);
248 device_del(&card->dev); 271 device_del(&card->dev);
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index cd0c6b246fed..f606b6678b00 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -556,8 +556,10 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
556 /* 556 /*
557 * Can we support the voltage of the card? 557 * Can we support the voltage of the card?
558 */ 558 */
559 if (!host->ocr) 559 if (!host->ocr) {
560 err = -EINVAL;
560 goto err; 561 goto err;
562 }
561 563
562 /* 564 /*
563 * Detect and init the card. 565 * Detect and init the card.
@@ -582,6 +584,9 @@ err:
582 mmc_detach_bus(host); 584 mmc_detach_bus(host);
583 mmc_release_host(host); 585 mmc_release_host(host);
584 586
587 printk(KERN_ERR "%s: error %d whilst initialising MMC card\n",
588 mmc_hostname(host), err);
589
585 return 0; 590 return 0;
586} 591}
587 592
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index 0b478de48acc..b6a2e53c9213 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -637,8 +637,10 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
637 /* 637 /*
638 * Can we support the voltage(s) of the card(s)? 638 * Can we support the voltage(s) of the card(s)?
639 */ 639 */
640 if (!host->ocr) 640 if (!host->ocr) {
641 err = -EINVAL;
641 goto err; 642 goto err;
643 }
642 644
643 /* 645 /*
644 * Detect and init the card. 646 * Detect and init the card.
@@ -663,6 +665,9 @@ err:
663 mmc_detach_bus(host); 665 mmc_detach_bus(host);
664 mmc_release_host(host); 666 mmc_release_host(host);
665 667
668 printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
669 mmc_hostname(host), err);
670
666 return 0; 671 return 0;
667} 672}
668 673