diff options
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r-- | drivers/mmc/core/mmc.c | 90 |
1 files changed, 39 insertions, 51 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 68c0e3b2f0e8..3da29eef8f7d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/mmc/mmc.h> | 17 | #include <linux/mmc/mmc.h> |
18 | 18 | ||
19 | #include "core.h" | 19 | #include "core.h" |
20 | #include "sysfs.h" | ||
21 | #include "bus.h" | 20 | #include "bus.h" |
22 | #include "mmc_ops.h" | 21 | #include "mmc_ops.h" |
23 | 22 | ||
@@ -248,6 +247,44 @@ out: | |||
248 | return err; | 247 | return err; |
249 | } | 248 | } |
250 | 249 | ||
250 | MMC_DEV_ATTR(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
251 | card->raw_cid[2], card->raw_cid[3]); | ||
252 | MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
253 | card->raw_csd[2], card->raw_csd[3]); | ||
254 | MMC_DEV_ATTR(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
255 | MMC_DEV_ATTR(fwrev, "0x%x\n", card->cid.fwrev); | ||
256 | MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev); | ||
257 | MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid); | ||
258 | MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name); | ||
259 | MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid); | ||
260 | MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial); | ||
261 | |||
262 | static struct attribute *mmc_std_attrs[] = { | ||
263 | &dev_attr_cid.attr, | ||
264 | &dev_attr_csd.attr, | ||
265 | &dev_attr_date.attr, | ||
266 | &dev_attr_fwrev.attr, | ||
267 | &dev_attr_hwrev.attr, | ||
268 | &dev_attr_manfid.attr, | ||
269 | &dev_attr_name.attr, | ||
270 | &dev_attr_oemid.attr, | ||
271 | &dev_attr_serial.attr, | ||
272 | NULL, | ||
273 | }; | ||
274 | |||
275 | static struct attribute_group mmc_std_attr_group = { | ||
276 | .attrs = mmc_std_attrs, | ||
277 | }; | ||
278 | |||
279 | static struct attribute_group *mmc_attr_groups[] = { | ||
280 | &mmc_std_attr_group, | ||
281 | NULL, | ||
282 | }; | ||
283 | |||
284 | static struct device_type mmc_type = { | ||
285 | .groups = mmc_attr_groups, | ||
286 | }; | ||
287 | |||
251 | /* | 288 | /* |
252 | * Handle the detection and initialisation of a card. | 289 | * Handle the detection and initialisation of a card. |
253 | * | 290 | * |
@@ -308,7 +345,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, | |||
308 | /* | 345 | /* |
309 | * Allocate card structure. | 346 | * Allocate card structure. |
310 | */ | 347 | */ |
311 | card = mmc_alloc_card(host); | 348 | card = mmc_alloc_card(host, &mmc_type); |
312 | if (IS_ERR(card)) { | 349 | if (IS_ERR(card)) { |
313 | err = PTR_ERR(card); | 350 | err = PTR_ERR(card); |
314 | goto err; | 351 | goto err; |
@@ -459,53 +496,6 @@ static void mmc_detect(struct mmc_host *host) | |||
459 | } | 496 | } |
460 | } | 497 | } |
461 | 498 | ||
462 | MMC_ATTR_FN(cid, "%08x%08x%08x%08x\n", card->raw_cid[0], card->raw_cid[1], | ||
463 | card->raw_cid[2], card->raw_cid[3]); | ||
464 | MMC_ATTR_FN(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1], | ||
465 | card->raw_csd[2], card->raw_csd[3]); | ||
466 | MMC_ATTR_FN(date, "%02d/%04d\n", card->cid.month, card->cid.year); | ||
467 | MMC_ATTR_FN(fwrev, "0x%x\n", card->cid.fwrev); | ||
468 | MMC_ATTR_FN(hwrev, "0x%x\n", card->cid.hwrev); | ||
469 | MMC_ATTR_FN(manfid, "0x%06x\n", card->cid.manfid); | ||
470 | MMC_ATTR_FN(name, "%s\n", card->cid.prod_name); | ||
471 | MMC_ATTR_FN(oemid, "0x%04x\n", card->cid.oemid); | ||
472 | MMC_ATTR_FN(serial, "0x%08x\n", card->cid.serial); | ||
473 | |||
474 | static struct device_attribute mmc_dev_attrs[] = { | ||
475 | MMC_ATTR_RO(cid), | ||
476 | MMC_ATTR_RO(csd), | ||
477 | MMC_ATTR_RO(date), | ||
478 | MMC_ATTR_RO(fwrev), | ||
479 | MMC_ATTR_RO(hwrev), | ||
480 | MMC_ATTR_RO(manfid), | ||
481 | MMC_ATTR_RO(name), | ||
482 | MMC_ATTR_RO(oemid), | ||
483 | MMC_ATTR_RO(serial), | ||
484 | __ATTR_NULL, | ||
485 | }; | ||
486 | |||
487 | /* | ||
488 | * Adds sysfs entries as relevant. | ||
489 | */ | ||
490 | static int mmc_sysfs_add(struct mmc_host *host, struct mmc_card *card) | ||
491 | { | ||
492 | int ret; | ||
493 | |||
494 | ret = mmc_add_attrs(card, mmc_dev_attrs); | ||
495 | if (ret < 0) | ||
496 | return ret; | ||
497 | |||
498 | return 0; | ||
499 | } | ||
500 | |||
501 | /* | ||
502 | * Removes the sysfs entries added by mmc_sysfs_add(). | ||
503 | */ | ||
504 | static void mmc_sysfs_remove(struct mmc_host *host, struct mmc_card *card) | ||
505 | { | ||
506 | mmc_remove_attrs(card, mmc_dev_attrs); | ||
507 | } | ||
508 | |||
509 | #ifdef CONFIG_MMC_UNSAFE_RESUME | 499 | #ifdef CONFIG_MMC_UNSAFE_RESUME |
510 | 500 | ||
511 | /* | 501 | /* |
@@ -560,8 +550,6 @@ static void mmc_resume(struct mmc_host *host) | |||
560 | static const struct mmc_bus_ops mmc_ops = { | 550 | static const struct mmc_bus_ops mmc_ops = { |
561 | .remove = mmc_remove, | 551 | .remove = mmc_remove, |
562 | .detect = mmc_detect, | 552 | .detect = mmc_detect, |
563 | .sysfs_add = mmc_sysfs_add, | ||
564 | .sysfs_remove = mmc_sysfs_remove, | ||
565 | .suspend = mmc_suspend, | 553 | .suspend = mmc_suspend, |
566 | .resume = mmc_resume, | 554 | .resume = mmc_resume, |
567 | }; | 555 | }; |