Commit 0967edc6 authored by Ulf Hansson's avatar Ulf Hansson

mmc: core: Convert the mmc_driver to use the modern PM ops

Instead of having specific mmc system PM callbacks for the mmc driver,
let's convert to use the common ones.
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 433b7b12
...@@ -2516,15 +2516,17 @@ static void mmc_blk_shutdown(struct mmc_card *card) ...@@ -2516,15 +2516,17 @@ static void mmc_blk_shutdown(struct mmc_card *card)
_mmc_blk_suspend(card); _mmc_blk_suspend(card);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int mmc_blk_suspend(struct mmc_card *card) static int mmc_blk_suspend(struct device *dev)
{ {
struct mmc_card *card = mmc_dev_to_card(dev);
return _mmc_blk_suspend(card); return _mmc_blk_suspend(card);
} }
static int mmc_blk_resume(struct mmc_card *card) static int mmc_blk_resume(struct device *dev)
{ {
struct mmc_blk_data *part_md; struct mmc_blk_data *part_md;
struct mmc_card *card = mmc_dev_to_card(dev);
struct mmc_blk_data *md = mmc_get_drvdata(card); struct mmc_blk_data *md = mmc_get_drvdata(card);
if (md) { if (md) {
...@@ -2540,19 +2542,17 @@ static int mmc_blk_resume(struct mmc_card *card) ...@@ -2540,19 +2542,17 @@ static int mmc_blk_resume(struct mmc_card *card)
} }
return 0; return 0;
} }
#else
#define mmc_blk_suspend NULL
#define mmc_blk_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(mmc_blk_pm_ops, mmc_blk_suspend, mmc_blk_resume);
static struct mmc_driver mmc_driver = { static struct mmc_driver mmc_driver = {
.drv = { .drv = {
.name = "mmcblk", .name = "mmcblk",
.pm = &mmc_blk_pm_ops,
}, },
.probe = mmc_blk_probe, .probe = mmc_blk_probe,
.remove = mmc_blk_remove, .remove = mmc_blk_remove,
.suspend = mmc_blk_suspend,
.resume = mmc_blk_resume,
.shutdown = mmc_blk_shutdown, .shutdown = mmc_blk_shutdown,
}; };
......
...@@ -145,16 +145,13 @@ static void mmc_bus_shutdown(struct device *dev) ...@@ -145,16 +145,13 @@ static void mmc_bus_shutdown(struct device *dev)
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int mmc_bus_suspend(struct device *dev) static int mmc_bus_suspend(struct device *dev)
{ {
struct mmc_driver *drv = to_mmc_driver(dev->driver);
struct mmc_card *card = mmc_dev_to_card(dev); struct mmc_card *card = mmc_dev_to_card(dev);
struct mmc_host *host = card->host; struct mmc_host *host = card->host;
int ret; int ret;
if (dev->driver && drv->suspend) { ret = pm_generic_suspend(dev);
ret = drv->suspend(card); if (ret)
if (ret) return ret;
return ret;
}
ret = host->bus_ops->suspend(host); ret = host->bus_ops->suspend(host);
return ret; return ret;
...@@ -162,7 +159,6 @@ static int mmc_bus_suspend(struct device *dev) ...@@ -162,7 +159,6 @@ static int mmc_bus_suspend(struct device *dev)
static int mmc_bus_resume(struct device *dev) static int mmc_bus_resume(struct device *dev)
{ {
struct mmc_driver *drv = to_mmc_driver(dev->driver);
struct mmc_card *card = mmc_dev_to_card(dev); struct mmc_card *card = mmc_dev_to_card(dev);
struct mmc_host *host = card->host; struct mmc_host *host = card->host;
int ret; int ret;
...@@ -172,9 +168,7 @@ static int mmc_bus_resume(struct device *dev) ...@@ -172,9 +168,7 @@ static int mmc_bus_resume(struct device *dev)
pr_warn("%s: error %d during resume (card was removed?)\n", pr_warn("%s: error %d during resume (card was removed?)\n",
mmc_hostname(host), ret); mmc_hostname(host), ret);
if (dev->driver && drv->resume) ret = pm_generic_resume(dev);
ret = drv->resume(card);
return ret; return ret;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment