diff options
Diffstat (limited to 'drivers/mmc/mmc.c')
-rw-r--r-- | drivers/mmc/mmc.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index eeb9f6668e69..3c5904834fe8 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c | |||
@@ -361,7 +361,7 @@ static void mmc_decode_cid(struct mmc_card *card) | |||
361 | 361 | ||
362 | default: | 362 | default: |
363 | printk("%s: card has unknown MMCA version %d\n", | 363 | printk("%s: card has unknown MMCA version %d\n", |
364 | card->host->host_name, card->csd.mmca_vsn); | 364 | mmc_hostname(card->host), card->csd.mmca_vsn); |
365 | mmc_card_set_bad(card); | 365 | mmc_card_set_bad(card); |
366 | break; | 366 | break; |
367 | } | 367 | } |
@@ -383,7 +383,7 @@ static void mmc_decode_csd(struct mmc_card *card) | |||
383 | csd_struct = UNSTUFF_BITS(resp, 126, 2); | 383 | csd_struct = UNSTUFF_BITS(resp, 126, 2); |
384 | if (csd_struct != 1 && csd_struct != 2) { | 384 | if (csd_struct != 1 && csd_struct != 2) { |
385 | printk("%s: unrecognised CSD structure version %d\n", | 385 | printk("%s: unrecognised CSD structure version %d\n", |
386 | card->host->host_name, csd_struct); | 386 | mmc_hostname(card->host), csd_struct); |
387 | mmc_card_set_bad(card); | 387 | mmc_card_set_bad(card); |
388 | return; | 388 | return; |
389 | } | 389 | } |
@@ -551,7 +551,7 @@ static void mmc_discover_cards(struct mmc_host *host) | |||
551 | } | 551 | } |
552 | if (err != MMC_ERR_NONE) { | 552 | if (err != MMC_ERR_NONE) { |
553 | printk(KERN_ERR "%s: error requesting CID: %d\n", | 553 | printk(KERN_ERR "%s: error requesting CID: %d\n", |
554 | host->host_name, err); | 554 | mmc_hostname(host), err); |
555 | break; | 555 | break; |
556 | } | 556 | } |
557 | 557 | ||
@@ -796,17 +796,13 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) | |||
796 | { | 796 | { |
797 | struct mmc_host *host; | 797 | struct mmc_host *host; |
798 | 798 | ||
799 | host = kmalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); | 799 | host = mmc_alloc_host_sysfs(extra, dev); |
800 | if (host) { | 800 | if (host) { |
801 | memset(host, 0, sizeof(struct mmc_host) + extra); | ||
802 | |||
803 | spin_lock_init(&host->lock); | 801 | spin_lock_init(&host->lock); |
804 | init_waitqueue_head(&host->wq); | 802 | init_waitqueue_head(&host->wq); |
805 | INIT_LIST_HEAD(&host->cards); | 803 | INIT_LIST_HEAD(&host->cards); |
806 | INIT_WORK(&host->detect, mmc_rescan, host); | 804 | INIT_WORK(&host->detect, mmc_rescan, host); |
807 | 805 | ||
808 | host->dev = dev; | ||
809 | |||
810 | /* | 806 | /* |
811 | * By default, hosts do not support SGIO or large requests. | 807 | * By default, hosts do not support SGIO or large requests. |
812 | * They have to set these according to their abilities. | 808 | * They have to set these according to their abilities. |
@@ -828,15 +824,15 @@ EXPORT_SYMBOL(mmc_alloc_host); | |||
828 | */ | 824 | */ |
829 | int mmc_add_host(struct mmc_host *host) | 825 | int mmc_add_host(struct mmc_host *host) |
830 | { | 826 | { |
831 | static unsigned int host_num; | 827 | int ret; |
832 | 828 | ||
833 | snprintf(host->host_name, sizeof(host->host_name), | 829 | ret = mmc_add_host_sysfs(host); |
834 | "mmc%d", host_num++); | 830 | if (ret == 0) { |
835 | 831 | mmc_power_off(host); | |
836 | mmc_power_off(host); | 832 | mmc_detect_change(host); |
837 | mmc_detect_change(host); | 833 | } |
838 | 834 | ||
839 | return 0; | 835 | return ret; |
840 | } | 836 | } |
841 | 837 | ||
842 | EXPORT_SYMBOL(mmc_add_host); | 838 | EXPORT_SYMBOL(mmc_add_host); |
@@ -859,6 +855,7 @@ void mmc_remove_host(struct mmc_host *host) | |||
859 | } | 855 | } |
860 | 856 | ||
861 | mmc_power_off(host); | 857 | mmc_power_off(host); |
858 | mmc_remove_host_sysfs(host); | ||
862 | } | 859 | } |
863 | 860 | ||
864 | EXPORT_SYMBOL(mmc_remove_host); | 861 | EXPORT_SYMBOL(mmc_remove_host); |
@@ -872,7 +869,7 @@ EXPORT_SYMBOL(mmc_remove_host); | |||
872 | void mmc_free_host(struct mmc_host *host) | 869 | void mmc_free_host(struct mmc_host *host) |
873 | { | 870 | { |
874 | flush_scheduled_work(); | 871 | flush_scheduled_work(); |
875 | kfree(host); | 872 | mmc_free_host_sysfs(host); |
876 | } | 873 | } |
877 | 874 | ||
878 | EXPORT_SYMBOL(mmc_free_host); | 875 | EXPORT_SYMBOL(mmc_free_host); |