diff options
| author | Shuah Khan <shuah.kh@samsung.com> | 2014-02-10 11:12:27 -0500 |
|---|---|---|
| committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-03-06 23:54:48 -0500 |
| commit | 639291f263c14dd20938dca296ab04b535cafd37 (patch) | |
| tree | a02f1cc15557ea0b850033e2b26bc9dad5452edf /drivers/macintosh | |
| parent | 3c8464a9b12bf83807b6e2c896d7e7b633e1cae7 (diff) | |
macintosh/adb: Change platform power management to use dev_pm_ops
Change adb 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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh')
| -rw-r--r-- | drivers/macintosh/adb.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 53611de7a457..9e9c56758a08 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c | |||
| @@ -262,7 +262,7 @@ adb_reset_bus(void) | |||
| 262 | /* | 262 | /* |
| 263 | * notify clients before sleep | 263 | * notify clients before sleep |
| 264 | */ | 264 | */ |
| 265 | static int adb_suspend(struct platform_device *dev, pm_message_t state) | 265 | static int __adb_suspend(struct platform_device *dev, pm_message_t state) |
| 266 | { | 266 | { |
| 267 | adb_got_sleep = 1; | 267 | adb_got_sleep = 1; |
| 268 | /* We need to get a lock on the probe thread */ | 268 | /* We need to get a lock on the probe thread */ |
| @@ -275,10 +275,25 @@ static int adb_suspend(struct platform_device *dev, pm_message_t state) | |||
| 275 | return 0; | 275 | return 0; |
| 276 | } | 276 | } |
| 277 | 277 | ||
| 278 | static int adb_suspend(struct device *dev) | ||
| 279 | { | ||
| 280 | return __adb_suspend(to_platform_device(dev), PMSG_SUSPEND); | ||
| 281 | } | ||
| 282 | |||
| 283 | static int adb_freeze(struct device *dev) | ||
| 284 | { | ||
| 285 | return __adb_suspend(to_platform_device(dev), PMSG_FREEZE); | ||
| 286 | } | ||
| 287 | |||
| 288 | static int adb_poweroff(struct device *dev) | ||
| 289 | { | ||
| 290 | return __adb_suspend(to_platform_device(dev), PMSG_HIBERNATE); | ||
| 291 | } | ||
| 292 | |||
| 278 | /* | 293 | /* |
| 279 | * reset bus after sleep | 294 | * reset bus after sleep |
| 280 | */ | 295 | */ |
| 281 | static int adb_resume(struct platform_device *dev) | 296 | static int __adb_resume(struct platform_device *dev) |
| 282 | { | 297 | { |
| 283 | adb_got_sleep = 0; | 298 | adb_got_sleep = 0; |
| 284 | up(&adb_probe_mutex); | 299 | up(&adb_probe_mutex); |
| @@ -286,6 +301,11 @@ static int adb_resume(struct platform_device *dev) | |||
| 286 | 301 | ||
| 287 | return 0; | 302 | return 0; |
| 288 | } | 303 | } |
| 304 | |||
| 305 | static int adb_resume(struct device *dev) | ||
| 306 | { | ||
| 307 | return __adb_resume(to_platform_device(dev)); | ||
| 308 | } | ||
| 289 | #endif /* CONFIG_PM */ | 309 | #endif /* CONFIG_PM */ |
| 290 | 310 | ||
| 291 | static int __init adb_init(void) | 311 | static int __init adb_init(void) |
| @@ -829,14 +849,25 @@ static const struct file_operations adb_fops = { | |||
| 829 | .release = adb_release, | 849 | .release = adb_release, |
| 830 | }; | 850 | }; |
| 831 | 851 | ||
| 852 | #ifdef CONFIG_PM | ||
| 853 | static const struct dev_pm_ops adb_dev_pm_ops = { | ||
| 854 | .suspend = adb_suspend, | ||
| 855 | .resume = adb_resume, | ||
| 856 | /* Hibernate hooks */ | ||
| 857 | .freeze = adb_freeze, | ||
| 858 | .thaw = adb_resume, | ||
| 859 | .poweroff = adb_poweroff, | ||
| 860 | .restore = adb_resume, | ||
| 861 | }; | ||
| 862 | #endif | ||
| 863 | |||
| 832 | static struct platform_driver adb_pfdrv = { | 864 | static struct platform_driver adb_pfdrv = { |
| 833 | .driver = { | 865 | .driver = { |
| 834 | .name = "adb", | 866 | .name = "adb", |
| 835 | }, | ||
| 836 | #ifdef CONFIG_PM | 867 | #ifdef CONFIG_PM |
| 837 | .suspend = adb_suspend, | 868 | .pm = &adb_dev_pm_ops, |
| 838 | .resume = adb_resume, | ||
| 839 | #endif | 869 | #endif |
| 870 | }, | ||
| 840 | }; | 871 | }; |
| 841 | 872 | ||
| 842 | static struct platform_device adb_pfdev = { | 873 | static struct platform_device adb_pfdev = { |
