Message ID | 5393e4bd34e5667b7d00fa09c9d5bee0f68d659f.1392040068.git.shuah.kh@samsung.com (mailing list archive) |
---|---|
State | Not Applicable, archived |
Headers | show |
On Mon, Feb 10, 2014 at 09:12:31AM -0700, Shuah Khan wrote: > Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead > of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces > by passing in the right pm state. [all the patch cut] Aaah, a bit mechanical - this change, isn't it? The suspend/resume callbacks just clears IRQ mask in the device in case it got undefined during sleep state. So the proper change here is to squash all the functions in one, and point all of the hooks to it. With the change you have my ack. BTW, you could move cb710_mmc_suspend() (or whatever you'll call it) to one ifdef block with cb710_mmc_dev_pm_ops. Best Regards, Micha? Miros?aw -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 02/10/2014 04:49 PM, Micha? Miros?aw wrote: > On Mon, Feb 10, 2014 at 09:12:31AM -0700, Shuah Khan wrote: >> Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead >> of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces >> by passing in the right pm state. > [all the patch cut] > > Aaah, a bit mechanical - this change, isn't it? Yes :) > > The suspend/resume callbacks just clears IRQ mask in the device in case it > got undefined during sleep state. So the proper change here is to squash all > the functions in one, and point all of the hooks to it. > > With the change you have my ack. > > BTW, you could move cb710_mmc_suspend() (or whatever you'll call it) to one > ifdef block with cb710_mmc_dev_pm_ops. > It makes perfect sense to squash suspend and resume. Thanks for the review. Code looks lot simpler now. Will send v2 patch shortly. -- Shuah
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 1087b4c..00fd93f 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c @@ -664,7 +664,7 @@ static const struct mmc_host_ops cb710_mmc_host = { #ifdef CONFIG_PM -static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) +static int __cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) { struct cb710_slot *slot = cb710_pdev_to_slot(pdev); @@ -672,7 +672,22 @@ static int cb710_mmc_suspend(struct platform_device *pdev, pm_message_t state) return 0; } -static int cb710_mmc_resume(struct platform_device *pdev) +static int cb710_mmc_suspend(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_SUSPEND); +} + +static int cb710_mmc_freeze(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_FREEZE); +} + +static int cb710_mmc_poweroff(struct device *dev) +{ + return __cb710_mmc_suspend(to_platform_device(dev), PMSG_HIBERNATE); +} + +static int __cb710_mmc_resume(struct platform_device *pdev) { struct cb710_slot *slot = cb710_pdev_to_slot(pdev); @@ -680,6 +695,10 @@ static int cb710_mmc_resume(struct platform_device *pdev) return 0; } +static int cb710_mmc_resume(struct device *dev) +{ + return __cb710_mmc_resume(to_platform_device(dev)); +} #endif /* CONFIG_PM */ static int cb710_mmc_init(struct platform_device *pdev) @@ -762,13 +781,23 @@ static int cb710_mmc_exit(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM +static const struct dev_pm_ops cb710_mmc_dev_pm_ops = { + .suspend = cb710_mmc_suspend, + .resume = cb710_mmc_resume, + /* Hibernate hooks */ + .freeze = cb710_mmc_freeze, + .thaw = cb710_mmc_resume, + .poweroff = cb710_mmc_poweroff, + .restore = cb710_mmc_resume, +}; +#endif static struct platform_driver cb710_mmc_driver = { .driver.name = "cb710-mmc", .probe = cb710_mmc_init, .remove = cb710_mmc_exit, #ifdef CONFIG_PM - .suspend = cb710_mmc_suspend, - .resume = cb710_mmc_resume, + .driver.pm = &cb710_mmc_dev_pm_ops, #endif };
Change cb710-mmc platform driver to register pm ops using dev_pm_ops instead of legacy pm_ops. .pm hooks call existing legacy suspend and resume interfaces by passing in the right pm state. Signed-off-by: Shuah Khan <shuah.kh@samsung.com> --- drivers/mmc/host/cb710-mmc.c | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-)