diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/mmc_sysfs.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c index 9e23ad3ae27b..3f4a66ca9555 100644 --- a/drivers/mmc/mmc_sysfs.c +++ b/drivers/mmc/mmc_sysfs.c | |||
@@ -48,7 +48,6 @@ MMC_ATTR(serial, "0x%08x\n", card->cid.serial); | |||
48 | static struct device_attribute mmc_dev_attrs[] = { | 48 | static struct device_attribute mmc_dev_attrs[] = { |
49 | MMC_ATTR_RO(cid), | 49 | MMC_ATTR_RO(cid), |
50 | MMC_ATTR_RO(csd), | 50 | MMC_ATTR_RO(csd), |
51 | MMC_ATTR_RO(scr), | ||
52 | MMC_ATTR_RO(date), | 51 | MMC_ATTR_RO(date), |
53 | MMC_ATTR_RO(fwrev), | 52 | MMC_ATTR_RO(fwrev), |
54 | MMC_ATTR_RO(hwrev), | 53 | MMC_ATTR_RO(hwrev), |
@@ -59,6 +58,8 @@ static struct device_attribute mmc_dev_attrs[] = { | |||
59 | __ATTR_NULL | 58 | __ATTR_NULL |
60 | }; | 59 | }; |
61 | 60 | ||
61 | static struct device_attribute mmc_dev_attr_scr = MMC_ATTR_RO(scr); | ||
62 | |||
62 | 63 | ||
63 | static void mmc_release_card(struct device *dev) | 64 | static void mmc_release_card(struct device *dev) |
64 | { | 65 | { |
@@ -209,10 +210,20 @@ void mmc_init_card(struct mmc_card *card, struct mmc_host *host) | |||
209 | */ | 210 | */ |
210 | int mmc_register_card(struct mmc_card *card) | 211 | int mmc_register_card(struct mmc_card *card) |
211 | { | 212 | { |
213 | int ret; | ||
214 | |||
212 | snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), | 215 | snprintf(card->dev.bus_id, sizeof(card->dev.bus_id), |
213 | "%s:%04x", mmc_hostname(card->host), card->rca); | 216 | "%s:%04x", mmc_hostname(card->host), card->rca); |
214 | 217 | ||
215 | return device_add(&card->dev); | 218 | ret = device_add(&card->dev); |
219 | if (ret == 0) { | ||
220 | if (mmc_card_sd(card)) { | ||
221 | ret = device_create_file(&card->dev, &mmc_dev_attr_scr); | ||
222 | if (ret) | ||
223 | device_del(&card->dev); | ||
224 | } | ||
225 | } | ||
226 | return ret; | ||
216 | } | 227 | } |
217 | 228 | ||
218 | /* | 229 | /* |
@@ -221,8 +232,12 @@ int mmc_register_card(struct mmc_card *card) | |||
221 | */ | 232 | */ |
222 | void mmc_remove_card(struct mmc_card *card) | 233 | void mmc_remove_card(struct mmc_card *card) |
223 | { | 234 | { |
224 | if (mmc_card_present(card)) | 235 | if (mmc_card_present(card)) { |
236 | if (mmc_card_sd(card)) | ||
237 | device_remove_file(&card->dev, &mmc_dev_attr_scr); | ||
238 | |||
225 | device_del(&card->dev); | 239 | device_del(&card->dev); |
240 | } | ||
226 | 241 | ||
227 | put_device(&card->dev); | 242 | put_device(&card->dev); |
228 | } | 243 | } |