Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lars-Peter Clausen and committed by
Takashi Iwai
9bc07dfb 00833d70

+4 -35
+4 -9
drivers/input/touchscreen/wm97xx-core.c
··· 732 732 return 0; 733 733 } 734 734 735 - #ifdef CONFIG_PM 736 - static int wm97xx_suspend(struct device *dev, pm_message_t state) 735 + static int __maybe_unused wm97xx_suspend(struct device *dev) 737 736 { 738 737 struct wm97xx *wm = dev_get_drvdata(dev); 739 738 u16 reg; ··· 764 765 return 0; 765 766 } 766 767 767 - static int wm97xx_resume(struct device *dev) 768 + static int __maybe_unused wm97xx_resume(struct device *dev) 768 769 { 769 770 struct wm97xx *wm = dev_get_drvdata(dev); 770 771 ··· 798 799 return 0; 799 800 } 800 801 801 - #else 802 - #define wm97xx_suspend NULL 803 - #define wm97xx_resume NULL 804 - #endif 802 + static SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume); 805 803 806 804 /* 807 805 * Machine specific operations ··· 832 836 .owner = THIS_MODULE, 833 837 .probe = wm97xx_probe, 834 838 .remove = wm97xx_remove, 835 - .suspend = wm97xx_suspend, 836 - .resume = wm97xx_resume, 839 + .pm = &wm97xx_pm_ops, 837 840 }; 838 841 839 842 static int __init wm97xx_init(void)
-26
sound/ac97_bus.c
··· 27 27 return 1; 28 28 } 29 29 30 - #ifdef CONFIG_PM 31 - static 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 - 41 - static 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 - 52 30 struct bus_type ac97_bus_type = { 53 31 .name = "ac97", 54 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 61 35 static int __init ac97_bus_init(void)