summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-08-21 03:48:33 -0400
committerTakashi Iwai <tiwai@suse.de>2015-08-21 13:27:23 -0400
commit9bc07dfbcde5b6f3aefa06b902b47eef9769d260 (patch)
treee559087d82895098a2c7b78a074857dadc675ddb
parent00833d70ca29a9d60c694b9475a9d3327ed9461e (diff)
ALSA: ac97: Switch to dev_pm_ops
Convert the ac97_bus from legacy suspend/resume callbacks to dev_pm_ops. Since there isn't anything special to do at the bus level the bus driver does not have to implement any callbacks. The device driver core will automatically pick up and execute the device's PM ops. As there is only a single AC'97 driver implementing suspend and resume, update both the core and driver at the same time to avoid unnecessary code churn. While we are at it also drop the ifdefs around the suspend/resume functions to increase compile test coverage. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--drivers/input/touchscreen/wm97xx-core.c13
-rw-r--r--sound/ac97_bus.c26
2 files changed, 4 insertions, 35 deletions
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index b1ae77995968..1534e9b0788c 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -732,8 +732,7 @@ static int wm97xx_remove(struct device *dev)
732 return 0; 732 return 0;
733} 733}
734 734
735#ifdef CONFIG_PM 735static int __maybe_unused wm97xx_suspend(struct device *dev)
736static int wm97xx_suspend(struct device *dev, pm_message_t state)
737{ 736{
738 struct wm97xx *wm = dev_get_drvdata(dev); 737 struct wm97xx *wm = dev_get_drvdata(dev);
739 u16 reg; 738 u16 reg;
@@ -765,7 +764,7 @@ static int wm97xx_suspend(struct device *dev, pm_message_t state)
765 return 0; 764 return 0;
766} 765}
767 766
768static int wm97xx_resume(struct device *dev) 767static int __maybe_unused wm97xx_resume(struct device *dev)
769{ 768{
770 struct wm97xx *wm = dev_get_drvdata(dev); 769 struct wm97xx *wm = dev_get_drvdata(dev);
771 770
@@ -799,10 +798,7 @@ static int wm97xx_resume(struct device *dev)
799 return 0; 798 return 0;
800} 799}
801 800
802#else 801static SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume);
803#define wm97xx_suspend NULL
804#define wm97xx_resume NULL
805#endif
806 802
807/* 803/*
808 * Machine specific operations 804 * Machine specific operations
@@ -836,8 +832,7 @@ static struct device_driver wm97xx_driver = {
836 .owner = THIS_MODULE, 832 .owner = THIS_MODULE,
837 .probe = wm97xx_probe, 833 .probe = wm97xx_probe,
838 .remove = wm97xx_remove, 834 .remove = wm97xx_remove,
839 .suspend = wm97xx_suspend, 835 .pm = &wm97xx_pm_ops,
840 .resume = wm97xx_resume,
841}; 836};
842 837
843static int __init wm97xx_init(void) 838static int __init wm97xx_init(void)
diff --git a/sound/ac97_bus.c b/sound/ac97_bus.c
index 2b50cbe6aca9..57a6dfc4b694 100644
--- a/sound/ac97_bus.c
+++ b/sound/ac97_bus.c
@@ -27,35 +27,9 @@ static int ac97_bus_match(struct device *dev, struct device_driver *drv)
27 return 1; 27 return 1;
28} 28}
29 29
30#ifdef CONFIG_PM
31static int ac97_bus_suspend(struct device *dev, pm_message_t state)
32{
33 int ret = 0;
34
35 if (dev->driver && dev->driver->suspend)
36 ret = dev->driver->suspend(dev, state);
37
38 return ret;
39}
40
41static int ac97_bus_resume(struct device *dev)
42{
43 int ret = 0;
44
45 if (dev->driver && dev->driver->resume)
46 ret = dev->driver->resume(dev);
47
48 return ret;
49}
50#endif /* CONFIG_PM */
51
52struct bus_type ac97_bus_type = { 30struct bus_type ac97_bus_type = {
53 .name = "ac97", 31 .name = "ac97",
54 .match = ac97_bus_match, 32 .match = ac97_bus_match,
55#ifdef CONFIG_PM
56 .suspend = ac97_bus_suspend,
57 .resume = ac97_bus_resume,
58#endif /* CONFIG_PM */
59}; 33};
60 34
61static int __init ac97_bus_init(void) 35static int __init ac97_bus_init(void)