Commit 9bc07dfb authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Takashi Iwai

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Acked-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 00833d70
...@@ -732,8 +732,7 @@ static int wm97xx_remove(struct device *dev) ...@@ -732,8 +732,7 @@ static int wm97xx_remove(struct device *dev)
return 0; return 0;
} }
#ifdef CONFIG_PM static int __maybe_unused wm97xx_suspend(struct device *dev)
static int wm97xx_suspend(struct device *dev, pm_message_t state)
{ {
struct wm97xx *wm = dev_get_drvdata(dev); struct wm97xx *wm = dev_get_drvdata(dev);
u16 reg; u16 reg;
...@@ -765,7 +764,7 @@ static int wm97xx_suspend(struct device *dev, pm_message_t state) ...@@ -765,7 +764,7 @@ static int wm97xx_suspend(struct device *dev, pm_message_t state)
return 0; return 0;
} }
static int wm97xx_resume(struct device *dev) static int __maybe_unused wm97xx_resume(struct device *dev)
{ {
struct wm97xx *wm = dev_get_drvdata(dev); struct wm97xx *wm = dev_get_drvdata(dev);
...@@ -799,10 +798,7 @@ static int wm97xx_resume(struct device *dev) ...@@ -799,10 +798,7 @@ static int wm97xx_resume(struct device *dev)
return 0; return 0;
} }
#else static SIMPLE_DEV_PM_OPS(wm97xx_pm_ops, wm97xx_suspend, wm97xx_resume);
#define wm97xx_suspend NULL
#define wm97xx_resume NULL
#endif
/* /*
* Machine specific operations * Machine specific operations
...@@ -836,8 +832,7 @@ static struct device_driver wm97xx_driver = { ...@@ -836,8 +832,7 @@ static struct device_driver wm97xx_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.probe = wm97xx_probe, .probe = wm97xx_probe,
.remove = wm97xx_remove, .remove = wm97xx_remove,
.suspend = wm97xx_suspend, .pm = &wm97xx_pm_ops,
.resume = wm97xx_resume,
}; };
static int __init wm97xx_init(void) static int __init wm97xx_init(void)
......
...@@ -27,35 +27,9 @@ static int ac97_bus_match(struct device *dev, struct device_driver *drv) ...@@ -27,35 +27,9 @@ static int ac97_bus_match(struct device *dev, struct device_driver *drv)
return 1; return 1;
} }
#ifdef CONFIG_PM
static int ac97_bus_suspend(struct device *dev, pm_message_t state)
{
int ret = 0;
if (dev->driver && dev->driver->suspend)
ret = dev->driver->suspend(dev, state);
return ret;
}
static int ac97_bus_resume(struct device *dev)
{
int ret = 0;
if (dev->driver && dev->driver->resume)
ret = dev->driver->resume(dev);
return ret;
}
#endif /* CONFIG_PM */
struct bus_type ac97_bus_type = { struct bus_type ac97_bus_type = {
.name = "ac97", .name = "ac97",
.match = ac97_bus_match, .match = ac97_bus_match,
#ifdef CONFIG_PM
.suspend = ac97_bus_suspend,
.resume = ac97_bus_resume,
#endif /* CONFIG_PM */
}; };
static int __init ac97_bus_init(void) static int __init ac97_bus_init(void)
......
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