diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2015-04-14 07:06:12 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-04-17 05:48:01 -0400 |
commit | 96541bac0b4e62efa42e7900d9b32e6baa9a214c (patch) | |
tree | d8377a74bab6e42d98bfd1a32fc352968d3769d8 /drivers/mmc/card | |
parent | 636efbc66452659840a9a4df1daf80074ee439f6 (diff) |
Revert "mmc: core: Convert mmc_driver to device_driver"
This reverts commit 6685ac62b2f0 ("mmc: core: Convert mmc_driver to
device_driver")
The reverted commit went too far in simplifing the device driver parts
for mmc.
Let's restore the old mmc_driver to enable driver core to sooner
or later to remove the ->probe(), ->remove() and ->shutdown() callbacks
from the struct device_driver.
Note that, the old ->suspend|resume() callbacks in the struct
mmc_driver don't need to be restored, since the mmc block layer has
converted to the modern system PM ops.
Fixes: 6685ac62b2f0 ("mmc: core: Convert mmc_driver to device_driver")
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 34 | ||||
-rw-r--r-- | drivers/mmc/card/mmc_test.c | 18 |
2 files changed, 24 insertions, 28 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 2fc426926574..2c25271f8c41 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -2418,9 +2418,8 @@ static const struct mmc_fixup blk_fixups[] = | |||
2418 | END_FIXUP | 2418 | END_FIXUP |
2419 | }; | 2419 | }; |
2420 | 2420 | ||
2421 | static int mmc_blk_probe(struct device *dev) | 2421 | static int mmc_blk_probe(struct mmc_card *card) |
2422 | { | 2422 | { |
2423 | struct mmc_card *card = mmc_dev_to_card(dev); | ||
2424 | struct mmc_blk_data *md, *part_md; | 2423 | struct mmc_blk_data *md, *part_md; |
2425 | char cap_str[10]; | 2424 | char cap_str[10]; |
2426 | 2425 | ||
@@ -2445,7 +2444,7 @@ static int mmc_blk_probe(struct device *dev) | |||
2445 | if (mmc_blk_alloc_parts(card, md)) | 2444 | if (mmc_blk_alloc_parts(card, md)) |
2446 | goto out; | 2445 | goto out; |
2447 | 2446 | ||
2448 | dev_set_drvdata(dev, md); | 2447 | dev_set_drvdata(&card->dev, md); |
2449 | 2448 | ||
2450 | if (mmc_add_disk(md)) | 2449 | if (mmc_add_disk(md)) |
2451 | goto out; | 2450 | goto out; |
@@ -2475,10 +2474,9 @@ static int mmc_blk_probe(struct device *dev) | |||
2475 | return 0; | 2474 | return 0; |
2476 | } | 2475 | } |
2477 | 2476 | ||
2478 | static int mmc_blk_remove(struct device *dev) | 2477 | static void mmc_blk_remove(struct mmc_card *card) |
2479 | { | 2478 | { |
2480 | struct mmc_card *card = mmc_dev_to_card(dev); | 2479 | struct mmc_blk_data *md = dev_get_drvdata(&card->dev); |
2481 | struct mmc_blk_data *md = dev_get_drvdata(dev); | ||
2482 | 2480 | ||
2483 | mmc_blk_remove_parts(card, md); | 2481 | mmc_blk_remove_parts(card, md); |
2484 | pm_runtime_get_sync(&card->dev); | 2482 | pm_runtime_get_sync(&card->dev); |
@@ -2489,15 +2487,13 @@ static int mmc_blk_remove(struct device *dev) | |||
2489 | pm_runtime_disable(&card->dev); | 2487 | pm_runtime_disable(&card->dev); |
2490 | pm_runtime_put_noidle(&card->dev); | 2488 | pm_runtime_put_noidle(&card->dev); |
2491 | mmc_blk_remove_req(md); | 2489 | mmc_blk_remove_req(md); |
2492 | dev_set_drvdata(dev, NULL); | 2490 | dev_set_drvdata(&card->dev, NULL); |
2493 | |||
2494 | return 0; | ||
2495 | } | 2491 | } |
2496 | 2492 | ||
2497 | static int _mmc_blk_suspend(struct device *dev) | 2493 | static int _mmc_blk_suspend(struct mmc_card *card) |
2498 | { | 2494 | { |
2499 | struct mmc_blk_data *part_md; | 2495 | struct mmc_blk_data *part_md; |
2500 | struct mmc_blk_data *md = dev_get_drvdata(dev); | 2496 | struct mmc_blk_data *md = dev_get_drvdata(&card->dev); |
2501 | 2497 | ||
2502 | if (md) { | 2498 | if (md) { |
2503 | mmc_queue_suspend(&md->queue); | 2499 | mmc_queue_suspend(&md->queue); |
@@ -2508,15 +2504,17 @@ static int _mmc_blk_suspend(struct device *dev) | |||
2508 | return 0; | 2504 | return 0; |
2509 | } | 2505 | } |
2510 | 2506 | ||
2511 | static void mmc_blk_shutdown(struct device *dev) | 2507 | static void mmc_blk_shutdown(struct mmc_card *card) |
2512 | { | 2508 | { |
2513 | _mmc_blk_suspend(dev); | 2509 | _mmc_blk_suspend(card); |
2514 | } | 2510 | } |
2515 | 2511 | ||
2516 | #ifdef CONFIG_PM_SLEEP | 2512 | #ifdef CONFIG_PM_SLEEP |
2517 | static int mmc_blk_suspend(struct device *dev) | 2513 | static int mmc_blk_suspend(struct device *dev) |
2518 | { | 2514 | { |
2519 | return _mmc_blk_suspend(dev); | 2515 | struct mmc_card *card = mmc_dev_to_card(dev); |
2516 | |||
2517 | return _mmc_blk_suspend(card); | ||
2520 | } | 2518 | } |
2521 | 2519 | ||
2522 | static int mmc_blk_resume(struct device *dev) | 2520 | static int mmc_blk_resume(struct device *dev) |
@@ -2541,9 +2539,11 @@ static int mmc_blk_resume(struct device *dev) | |||
2541 | 2539 | ||
2542 | static SIMPLE_DEV_PM_OPS(mmc_blk_pm_ops, mmc_blk_suspend, mmc_blk_resume); | 2540 | static SIMPLE_DEV_PM_OPS(mmc_blk_pm_ops, mmc_blk_suspend, mmc_blk_resume); |
2543 | 2541 | ||
2544 | static struct device_driver mmc_driver = { | 2542 | static struct mmc_driver mmc_driver = { |
2545 | .name = "mmcblk", | 2543 | .drv = { |
2546 | .pm = &mmc_blk_pm_ops, | 2544 | .name = "mmcblk", |
2545 | .pm = &mmc_blk_pm_ops, | ||
2546 | }, | ||
2547 | .probe = mmc_blk_probe, | 2547 | .probe = mmc_blk_probe, |
2548 | .remove = mmc_blk_remove, | 2548 | .remove = mmc_blk_remove, |
2549 | .shutdown = mmc_blk_shutdown, | 2549 | .shutdown = mmc_blk_shutdown, |
diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 7dac4695163b..53b741398b93 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c | |||
@@ -14,7 +14,6 @@ | |||
14 | #include <linux/mmc/host.h> | 14 | #include <linux/mmc/host.h> |
15 | #include <linux/mmc/mmc.h> | 15 | #include <linux/mmc/mmc.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/device.h> | ||
18 | 17 | ||
19 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
20 | #include <linux/swap.h> /* For nr_free_buffer_pages() */ | 19 | #include <linux/swap.h> /* For nr_free_buffer_pages() */ |
@@ -2996,9 +2995,8 @@ err: | |||
2996 | return ret; | 2995 | return ret; |
2997 | } | 2996 | } |
2998 | 2997 | ||
2999 | static int mmc_test_probe(struct device *dev) | 2998 | static int mmc_test_probe(struct mmc_card *card) |
3000 | { | 2999 | { |
3001 | struct mmc_card *card = mmc_dev_to_card(dev); | ||
3002 | int ret; | 3000 | int ret; |
3003 | 3001 | ||
3004 | if (!mmc_card_mmc(card) && !mmc_card_sd(card)) | 3002 | if (!mmc_card_mmc(card) && !mmc_card_sd(card)) |
@@ -3013,22 +3011,20 @@ static int mmc_test_probe(struct device *dev) | |||
3013 | return 0; | 3011 | return 0; |
3014 | } | 3012 | } |
3015 | 3013 | ||
3016 | static int mmc_test_remove(struct device *dev) | 3014 | static void mmc_test_remove(struct mmc_card *card) |
3017 | { | 3015 | { |
3018 | struct mmc_card *card = mmc_dev_to_card(dev); | ||
3019 | |||
3020 | mmc_test_free_result(card); | 3016 | mmc_test_free_result(card); |
3021 | mmc_test_free_dbgfs_file(card); | 3017 | mmc_test_free_dbgfs_file(card); |
3022 | |||
3023 | return 0; | ||
3024 | } | 3018 | } |
3025 | 3019 | ||
3026 | static void mmc_test_shutdown(struct device *dev) | 3020 | static void mmc_test_shutdown(struct mmc_card *card) |
3027 | { | 3021 | { |
3028 | } | 3022 | } |
3029 | 3023 | ||
3030 | static struct device_driver mmc_driver = { | 3024 | static struct mmc_driver mmc_driver = { |
3031 | .name = "mmc_test", | 3025 | .drv = { |
3026 | .name = "mmc_test", | ||
3027 | }, | ||
3032 | .probe = mmc_test_probe, | 3028 | .probe = mmc_test_probe, |
3033 | .remove = mmc_test_remove, | 3029 | .remove = mmc_test_remove, |
3034 | .shutdown = mmc_test_shutdown, | 3030 | .shutdown = mmc_test_shutdown, |