aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-08-05 10:19:31 -0400
committerTakashi Iwai <tiwai@suse.de>2015-08-05 10:47:47 -0400
commitf6af5df0c7d7b7d0a80a2f4ac4171912312b55d4 (patch)
tree738276be992406d9aec35d1b17a35655060ebcd8
parent9f502ff55321a5270c3dfbb76ac3774e6b5d8097 (diff)
ALSA: aoa-soundbus: Switch to dev_pm_ops
Update the aoa-soundbus framework to use dev_pm_ops rather than the deprecated legacy suspend and resume callbacks. 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 aoa-soundbus driver implementing suspend and resume, update both the core and driver at the same time to avoid unnecessary code churn. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/aoa/fabrics/layout.c21
-rw-r--r--sound/aoa/soundbus/core.c28
-rw-r--r--sound/aoa/soundbus/soundbus.h2
3 files changed, 12 insertions, 39 deletions
diff --git a/sound/aoa/fabrics/layout.c b/sound/aoa/fabrics/layout.c
index 9dc5806d23dd..8f71f7e4d966 100644
--- a/sound/aoa/fabrics/layout.c
+++ b/sound/aoa/fabrics/layout.c
@@ -1120,10 +1120,10 @@ static int aoa_fabric_layout_remove(struct soundbus_dev *sdev)
1120 return 0; 1120 return 0;
1121} 1121}
1122 1122
1123#ifdef CONFIG_PM 1123#ifdef CONFIG_PM_SLEEP
1124static int aoa_fabric_layout_suspend(struct soundbus_dev *sdev, pm_message_t state) 1124static int aoa_fabric_layout_suspend(struct device *dev)
1125{ 1125{
1126 struct layout_dev *ldev = dev_get_drvdata(&sdev->ofdev.dev); 1126 struct layout_dev *ldev = dev_get_drvdata(dev);
1127 1127
1128 if (ldev->gpio.methods && ldev->gpio.methods->all_amps_off) 1128 if (ldev->gpio.methods && ldev->gpio.methods->all_amps_off)
1129 ldev->gpio.methods->all_amps_off(&ldev->gpio); 1129 ldev->gpio.methods->all_amps_off(&ldev->gpio);
@@ -1131,15 +1131,19 @@ static int aoa_fabric_layout_suspend(struct soundbus_dev *sdev, pm_message_t sta
1131 return 0; 1131 return 0;
1132} 1132}
1133 1133
1134static int aoa_fabric_layout_resume(struct soundbus_dev *sdev) 1134static int aoa_fabric_layout_resume(struct device *dev)
1135{ 1135{
1136 struct layout_dev *ldev = dev_get_drvdata(&sdev->ofdev.dev); 1136 struct layout_dev *ldev = dev_get_drvdata(dev);
1137 1137
1138 if (ldev->gpio.methods && ldev->gpio.methods->all_amps_restore) 1138 if (ldev->gpio.methods && ldev->gpio.methods->all_amps_restore)
1139 ldev->gpio.methods->all_amps_restore(&ldev->gpio); 1139 ldev->gpio.methods->all_amps_restore(&ldev->gpio);
1140 1140
1141 return 0; 1141 return 0;
1142} 1142}
1143
1144static SIMPLE_DEV_PM_OPS(aoa_fabric_layout_pm_ops,
1145 aoa_fabric_layout_suspend, aoa_fabric_layout_resume);
1146
1143#endif 1147#endif
1144 1148
1145static struct soundbus_driver aoa_soundbus_driver = { 1149static struct soundbus_driver aoa_soundbus_driver = {
@@ -1147,12 +1151,11 @@ static struct soundbus_driver aoa_soundbus_driver = {
1147 .owner = THIS_MODULE, 1151 .owner = THIS_MODULE,
1148 .probe = aoa_fabric_layout_probe, 1152 .probe = aoa_fabric_layout_probe,
1149 .remove = aoa_fabric_layout_remove, 1153 .remove = aoa_fabric_layout_remove,
1150#ifdef CONFIG_PM
1151 .suspend = aoa_fabric_layout_suspend,
1152 .resume = aoa_fabric_layout_resume,
1153#endif
1154 .driver = { 1154 .driver = {
1155 .owner = THIS_MODULE, 1155 .owner = THIS_MODULE,
1156#ifdef CONFIG_PM_SLEEP
1157 .pm = &aoa_fabric_layout_pm_ops,
1158#endif
1156 } 1159 }
1157}; 1160};
1158 1161
diff --git a/sound/aoa/soundbus/core.c b/sound/aoa/soundbus/core.c
index 3edf736319fe..70bcaa7f93dd 100644
--- a/sound/aoa/soundbus/core.c
+++ b/sound/aoa/soundbus/core.c
@@ -126,30 +126,6 @@ static void soundbus_device_shutdown(struct device *dev)
126 drv->shutdown(soundbus_dev); 126 drv->shutdown(soundbus_dev);
127} 127}
128 128
129#ifdef CONFIG_PM
130
131static int soundbus_device_suspend(struct device *dev, pm_message_t state)
132{
133 struct soundbus_dev * soundbus_dev = to_soundbus_device(dev);
134 struct soundbus_driver * drv = to_soundbus_driver(dev->driver);
135
136 if (dev->driver && drv->suspend)
137 return drv->suspend(soundbus_dev, state);
138 return 0;
139}
140
141static int soundbus_device_resume(struct device * dev)
142{
143 struct soundbus_dev * soundbus_dev = to_soundbus_device(dev);
144 struct soundbus_driver * drv = to_soundbus_driver(dev->driver);
145
146 if (dev->driver && drv->resume)
147 return drv->resume(soundbus_dev);
148 return 0;
149}
150
151#endif /* CONFIG_PM */
152
153/* soundbus_dev_attrs is declared in sysfs.c */ 129/* soundbus_dev_attrs is declared in sysfs.c */
154ATTRIBUTE_GROUPS(soundbus_dev); 130ATTRIBUTE_GROUPS(soundbus_dev);
155static struct bus_type soundbus_bus_type = { 131static struct bus_type soundbus_bus_type = {
@@ -158,10 +134,6 @@ static struct bus_type soundbus_bus_type = {
158 .uevent = soundbus_uevent, 134 .uevent = soundbus_uevent,
159 .remove = soundbus_device_remove, 135 .remove = soundbus_device_remove,
160 .shutdown = soundbus_device_shutdown, 136 .shutdown = soundbus_device_shutdown,
161#ifdef CONFIG_PM
162 .suspend = soundbus_device_suspend,
163 .resume = soundbus_device_resume,
164#endif
165 .dev_groups = soundbus_dev_groups, 137 .dev_groups = soundbus_dev_groups,
166}; 138};
167 139
diff --git a/sound/aoa/soundbus/soundbus.h b/sound/aoa/soundbus/soundbus.h
index 21e756cf2824..ae4022438e64 100644
--- a/sound/aoa/soundbus/soundbus.h
+++ b/sound/aoa/soundbus/soundbus.h
@@ -188,8 +188,6 @@ struct soundbus_driver {
188 int (*probe)(struct soundbus_dev* dev); 188 int (*probe)(struct soundbus_dev* dev);
189 int (*remove)(struct soundbus_dev* dev); 189 int (*remove)(struct soundbus_dev* dev);
190 190
191 int (*suspend)(struct soundbus_dev* dev, pm_message_t state);
192 int (*resume)(struct soundbus_dev* dev);
193 int (*shutdown)(struct soundbus_dev* dev); 191 int (*shutdown)(struct soundbus_dev* dev);
194 192
195 struct device_driver driver; 193 struct device_driver driver;