X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fmmc%2Fcore%2Fbus.c;h=0d9b2d6f9ebfba638b2bba41a0a0f6d28c922cc6;hb=3a4b7886ee59e122d359e1714ed89585a06645ad;hp=8d6f6014870f2cebfa8030fca45549b1cfc7fe30;hpb=f26e51f67ae6a75ffc57b96cf5fe096f75e778cb;p=linux-2.6 diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index 8d6f601487..0d9b2d6f9e 100644 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -17,7 +17,6 @@ #include #include -#include "sysfs.h" #include "core.h" #include "sdio_cis.h" #include "bus.h" @@ -43,7 +42,7 @@ static ssize_t mmc_type_show(struct device *dev, } static struct device_attribute mmc_dev_attrs[] = { - MMC_ATTR_RO(type), + __ATTR(type, S_IRUGO, mmc_type_show, NULL), __ATTR_NULL, }; @@ -58,12 +57,11 @@ static int mmc_bus_match(struct device *dev, struct device_driver *drv) } static int -mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf, - int buf_size) +mmc_bus_uevent(struct device *dev, struct kobj_uevent_env *env) { struct mmc_card *card = dev_to_mmc_card(dev); const char *type; - int i = 0, length = 0; + int retval = 0; switch (card->type) { case MMC_TYPE_MMC: @@ -80,20 +78,14 @@ mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf, } if (type) { - if (add_uevent_var(envp, num_envp, &i, - buf, buf_size, &length, - "MMC_TYPE=%s", type)) - return -ENOMEM; + retval = add_uevent_var(env, "MMC_TYPE=%s", type); + if (retval) + return retval; } - if (add_uevent_var(envp, num_envp, &i, - buf, buf_size, &length, - "MMC_NAME=%s", mmc_card_name(card))) - return -ENOMEM; + retval = add_uevent_var(env, "MMC_NAME=%s", mmc_card_name(card)); - envp[i] = NULL; - - return 0; + return retval; } static int mmc_bus_probe(struct device *dev) @@ -196,7 +188,7 @@ static void mmc_release_card(struct device *dev) /* * Allocate and initialise a new MMC card structure. */ -struct mmc_card *mmc_alloc_card(struct mmc_host *host) +struct mmc_card *mmc_alloc_card(struct mmc_host *host, struct device_type *type) { struct mmc_card *card; @@ -211,6 +203,7 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host) card->dev.parent = mmc_classdev(host); card->dev.bus = &mmc_bus_type; card->dev.release = mmc_release_card; + card->dev.type = type; return card; } @@ -255,23 +248,13 @@ int mmc_add_card(struct mmc_card *card) type, card->rca); } - card->dev.uevent_suppress = 1; - ret = device_add(&card->dev); if (ret) return ret; - if (card->host->bus_ops->sysfs_add) { - ret = card->host->bus_ops->sysfs_add(card->host, card); - if (ret) { - device_del(&card->dev); - return ret; - } - } - - card->dev.uevent_suppress = 0; - - kobject_uevent(&card->dev.kobj, KOBJ_ADD); +#ifdef CONFIG_DEBUG_FS + mmc_add_card_debugfs(card); +#endif mmc_card_set_present(card); @@ -284,6 +267,10 @@ int mmc_add_card(struct mmc_card *card) */ void mmc_remove_card(struct mmc_card *card) { +#ifdef CONFIG_DEBUG_FS + mmc_remove_card_debugfs(card); +#endif + if (mmc_card_present(card)) { if (mmc_host_is_spi(card->host)) { printk(KERN_INFO "%s: SPI card removed\n", @@ -292,9 +279,6 @@ void mmc_remove_card(struct mmc_card *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); }