diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2014-10-06 08:34:09 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-11-10 06:40:34 -0500 |
commit | fc95e30ba33b9f4faa8630d0762af2548031dc00 (patch) | |
tree | 3d4c977a50b22c7604a65615d7ca89bf5a43345e | |
parent | eaaceb6cbf7ef6f480b3f80468beb21eafe82ac0 (diff) |
mmc: block: Use dev_set|get_drvdata()
In most of the cases mmc_get|set_drvdata() didn't simplify code, which
should be the primary reason for such macros.
Let's remove them and convert to the common device_driver macros,
dev_set|get_drvdata() instead.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r-- | drivers/mmc/card/block.c | 21 | ||||
-rw-r--r-- | include/linux/mmc/card.h | 2 |
2 files changed, 10 insertions, 13 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 70569d9b5c74..f45f7e3870be 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -112,7 +112,7 @@ struct mmc_blk_data { | |||
112 | 112 | ||
113 | /* | 113 | /* |
114 | * Only set in main mmc_blk_data associated | 114 | * Only set in main mmc_blk_data associated |
115 | * with mmc_card with mmc_set_drvdata, and keeps | 115 | * with mmc_card with dev_set_drvdata, and keeps |
116 | * track of the current selected device partition. | 116 | * track of the current selected device partition. |
117 | */ | 117 | */ |
118 | unsigned int part_curr; | 118 | unsigned int part_curr; |
@@ -642,7 +642,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *card, | |||
642 | struct mmc_blk_data *md) | 642 | struct mmc_blk_data *md) |
643 | { | 643 | { |
644 | int ret; | 644 | int ret; |
645 | struct mmc_blk_data *main_md = mmc_get_drvdata(card); | 645 | struct mmc_blk_data *main_md = dev_get_drvdata(&card->dev); |
646 | 646 | ||
647 | if (main_md->part_curr == md->part_type) | 647 | if (main_md->part_curr == md->part_type) |
648 | return 0; | 648 | return 0; |
@@ -1004,7 +1004,8 @@ static int mmc_blk_reset(struct mmc_blk_data *md, struct mmc_host *host, | |||
1004 | err = mmc_hw_reset(host); | 1004 | err = mmc_hw_reset(host); |
1005 | /* Ensure we switch back to the correct partition */ | 1005 | /* Ensure we switch back to the correct partition */ |
1006 | if (err != -EOPNOTSUPP) { | 1006 | if (err != -EOPNOTSUPP) { |
1007 | struct mmc_blk_data *main_md = mmc_get_drvdata(host->card); | 1007 | struct mmc_blk_data *main_md = |
1008 | dev_get_drvdata(&host->card->dev); | ||
1008 | int part_err; | 1009 | int part_err; |
1009 | 1010 | ||
1010 | main_md->part_curr = main_md->part_type; | 1011 | main_md->part_curr = main_md->part_type; |
@@ -2093,7 +2094,7 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, | |||
2093 | 2094 | ||
2094 | /* | 2095 | /* |
2095 | * !subname implies we are creating main mmc_blk_data that will be | 2096 | * !subname implies we are creating main mmc_blk_data that will be |
2096 | * associated with mmc_card with mmc_set_drvdata. Due to device | 2097 | * associated with mmc_card with dev_set_drvdata. Due to device |
2097 | * partitions, devidx will not coincide with a per-physical card | 2098 | * partitions, devidx will not coincide with a per-physical card |
2098 | * index anymore so we keep track of a name index. | 2099 | * index anymore so we keep track of a name index. |
2099 | */ | 2100 | */ |
@@ -2452,7 +2453,7 @@ static int mmc_blk_probe(struct device *dev) | |||
2452 | if (mmc_blk_alloc_parts(card, md)) | 2453 | if (mmc_blk_alloc_parts(card, md)) |
2453 | goto out; | 2454 | goto out; |
2454 | 2455 | ||
2455 | mmc_set_drvdata(card, md); | 2456 | dev_set_drvdata(dev, md); |
2456 | 2457 | ||
2457 | if (mmc_add_disk(md)) | 2458 | if (mmc_add_disk(md)) |
2458 | goto out; | 2459 | goto out; |
@@ -2485,7 +2486,7 @@ static int mmc_blk_probe(struct device *dev) | |||
2485 | static int mmc_blk_remove(struct device *dev) | 2486 | static int mmc_blk_remove(struct device *dev) |
2486 | { | 2487 | { |
2487 | struct mmc_card *card = mmc_dev_to_card(dev); | 2488 | struct mmc_card *card = mmc_dev_to_card(dev); |
2488 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 2489 | struct mmc_blk_data *md = dev_get_drvdata(dev); |
2489 | 2490 | ||
2490 | mmc_blk_remove_parts(card, md); | 2491 | mmc_blk_remove_parts(card, md); |
2491 | pm_runtime_get_sync(&card->dev); | 2492 | pm_runtime_get_sync(&card->dev); |
@@ -2496,7 +2497,7 @@ static int mmc_blk_remove(struct device *dev) | |||
2496 | pm_runtime_disable(&card->dev); | 2497 | pm_runtime_disable(&card->dev); |
2497 | pm_runtime_put_noidle(&card->dev); | 2498 | pm_runtime_put_noidle(&card->dev); |
2498 | mmc_blk_remove_req(md); | 2499 | mmc_blk_remove_req(md); |
2499 | mmc_set_drvdata(card, NULL); | 2500 | dev_set_drvdata(dev, NULL); |
2500 | 2501 | ||
2501 | return 0; | 2502 | return 0; |
2502 | } | 2503 | } |
@@ -2504,8 +2505,7 @@ static int mmc_blk_remove(struct device *dev) | |||
2504 | static int _mmc_blk_suspend(struct device *dev) | 2505 | static int _mmc_blk_suspend(struct device *dev) |
2505 | { | 2506 | { |
2506 | struct mmc_blk_data *part_md; | 2507 | struct mmc_blk_data *part_md; |
2507 | struct mmc_card *card = mmc_dev_to_card(dev); | 2508 | struct mmc_blk_data *md = dev_get_drvdata(dev); |
2508 | struct mmc_blk_data *md = mmc_get_drvdata(card); | ||
2509 | 2509 | ||
2510 | if (md) { | 2510 | if (md) { |
2511 | mmc_queue_suspend(&md->queue); | 2511 | mmc_queue_suspend(&md->queue); |
@@ -2530,8 +2530,7 @@ static int mmc_blk_suspend(struct device *dev) | |||
2530 | static int mmc_blk_resume(struct device *dev) | 2530 | static int mmc_blk_resume(struct device *dev) |
2531 | { | 2531 | { |
2532 | struct mmc_blk_data *part_md; | 2532 | struct mmc_blk_data *part_md; |
2533 | struct mmc_card *card = mmc_dev_to_card(dev); | 2533 | struct mmc_blk_data *md = dev_get_drvdata(dev); |
2534 | struct mmc_blk_data *md = mmc_get_drvdata(card); | ||
2535 | 2534 | ||
2536 | if (md) { | 2535 | if (md) { |
2537 | /* | 2536 | /* |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index cf54afe5d863..64f413676410 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -510,8 +510,6 @@ static inline int mmc_card_broken_irq_polling(const struct mmc_card *c) | |||
510 | #define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) | 510 | #define mmc_dev_to_card(d) container_of(d, struct mmc_card, dev) |
511 | 511 | ||
512 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) | 512 | #define mmc_list_to_card(l) container_of(l, struct mmc_card, node) |
513 | #define mmc_get_drvdata(c) dev_get_drvdata(&(c)->dev) | ||
514 | #define mmc_set_drvdata(c,d) dev_set_drvdata(&(c)->dev, d) | ||
515 | 513 | ||
516 | extern int mmc_register_driver(struct device_driver *); | 514 | extern int mmc_register_driver(struct device_driver *); |
517 | extern void mmc_unregister_driver(struct device_driver *); | 515 | extern void mmc_unregister_driver(struct device_driver *); |