Commit 284e7ca75f96a18f182cce38ba76ee724fb97e16
1 parent
8bf01d8abc
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ALSA: convert PM ops of platform_driver to new pm ops
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Showing 7 changed files with 58 additions and 51 deletions Side-by-side Diff
sound/arm/pxa2xx-ac97.c
... | ... | @@ -108,7 +108,7 @@ |
108 | 108 | |
109 | 109 | #ifdef CONFIG_PM |
110 | 110 | |
111 | -static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state) | |
111 | +static int pxa2xx_ac97_do_suspend(struct snd_card *card) | |
112 | 112 | { |
113 | 113 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
114 | 114 | |
... | ... | @@ -144,7 +144,7 @@ |
144 | 144 | int ret = 0; |
145 | 145 | |
146 | 146 | if (card) |
147 | - ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND); | |
147 | + ret = pxa2xx_ac97_do_suspend(card); | |
148 | 148 | |
149 | 149 | return ret; |
150 | 150 | } |
... | ... | @@ -160,10 +160,7 @@ |
160 | 160 | return ret; |
161 | 161 | } |
162 | 162 | |
163 | -static const struct dev_pm_ops pxa2xx_ac97_pm_ops = { | |
164 | - .suspend = pxa2xx_ac97_suspend, | |
165 | - .resume = pxa2xx_ac97_resume, | |
166 | -}; | |
163 | +static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); | |
167 | 164 | #endif |
168 | 165 | |
169 | 166 | static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) |
sound/atmel/abdac.c
... | ... | @@ -535,9 +535,9 @@ |
535 | 535 | } |
536 | 536 | |
537 | 537 | #ifdef CONFIG_PM |
538 | -static int atmel_abdac_suspend(struct platform_device *pdev, pm_message_t msg) | |
538 | +static int atmel_abdac_suspend(struct device *pdev) | |
539 | 539 | { |
540 | - struct snd_card *card = platform_get_drvdata(pdev); | |
540 | + struct snd_card *card = dev_get_drvdata(pdev); | |
541 | 541 | struct atmel_abdac *dac = card->private_data; |
542 | 542 | |
543 | 543 | dw_dma_cyclic_stop(dac->dma.chan); |
544 | 544 | |
... | ... | @@ -547,9 +547,9 @@ |
547 | 547 | return 0; |
548 | 548 | } |
549 | 549 | |
550 | -static int atmel_abdac_resume(struct platform_device *pdev) | |
550 | +static int atmel_abdac_resume(struct device *pdev) | |
551 | 551 | { |
552 | - struct snd_card *card = platform_get_drvdata(pdev); | |
552 | + struct snd_card *card = dev_get_drvdata(pdev); | |
553 | 553 | struct atmel_abdac *dac = card->private_data; |
554 | 554 | |
555 | 555 | clk_enable(dac->pclk); |
556 | 556 | |
... | ... | @@ -559,9 +559,11 @@ |
559 | 559 | |
560 | 560 | return 0; |
561 | 561 | } |
562 | + | |
563 | +static SIMPLE_DEV_PM_OPS(atmel_abdac_pm, atmel_abdac_suspend, atmel_abdac_resume); | |
564 | +#define ATMEL_ABDAC_PM_OPS &atmel_abdac_pm | |
562 | 565 | #else |
563 | -#define atmel_abdac_suspend NULL | |
564 | -#define atmel_abdac_resume NULL | |
566 | +#define ATMEL_ABDAC_PM_OPS NULL | |
565 | 567 | #endif |
566 | 568 | |
567 | 569 | static int __devexit atmel_abdac_remove(struct platform_device *pdev) |
568 | 570 | |
... | ... | @@ -590,9 +592,8 @@ |
590 | 592 | .driver = { |
591 | 593 | .name = "atmel_abdac", |
592 | 594 | .owner = THIS_MODULE, |
595 | + .pm = ATMEL_ABDAC_PM_OPS, | |
593 | 596 | }, |
594 | - .suspend = atmel_abdac_suspend, | |
595 | - .resume = atmel_abdac_resume, | |
596 | 597 | }; |
597 | 598 | |
598 | 599 | static int __init atmel_abdac_init(void) |
sound/atmel/ac97c.c
... | ... | @@ -1135,9 +1135,9 @@ |
1135 | 1135 | } |
1136 | 1136 | |
1137 | 1137 | #ifdef CONFIG_PM |
1138 | -static int atmel_ac97c_suspend(struct platform_device *pdev, pm_message_t msg) | |
1138 | +static int atmel_ac97c_suspend(struct device *pdev) | |
1139 | 1139 | { |
1140 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1140 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1141 | 1141 | struct atmel_ac97c *chip = card->private_data; |
1142 | 1142 | |
1143 | 1143 | if (cpu_is_at32ap7000()) { |
1144 | 1144 | |
... | ... | @@ -1151,9 +1151,9 @@ |
1151 | 1151 | return 0; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | -static int atmel_ac97c_resume(struct platform_device *pdev) | |
1154 | +static int atmel_ac97c_resume(struct device *pdev) | |
1155 | 1155 | { |
1156 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1156 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1157 | 1157 | struct atmel_ac97c *chip = card->private_data; |
1158 | 1158 | |
1159 | 1159 | clk_enable(chip->pclk); |
1160 | 1160 | |
... | ... | @@ -1165,9 +1165,11 @@ |
1165 | 1165 | } |
1166 | 1166 | return 0; |
1167 | 1167 | } |
1168 | + | |
1169 | +static SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume); | |
1170 | +#define ATMEL_AC97C_PM_OPS &atmel_ac97c_pm | |
1168 | 1171 | #else |
1169 | -#define atmel_ac97c_suspend NULL | |
1170 | -#define atmel_ac97c_resume NULL | |
1172 | +#define ATMEL_AC97C_PM_OPS NULL | |
1171 | 1173 | #endif |
1172 | 1174 | |
1173 | 1175 | static int __devexit atmel_ac97c_remove(struct platform_device *pdev) |
1174 | 1176 | |
... | ... | @@ -1211,9 +1213,8 @@ |
1211 | 1213 | .driver = { |
1212 | 1214 | .name = "atmel_ac97c", |
1213 | 1215 | .owner = THIS_MODULE, |
1216 | + .pm = ATMEL_AC97C_PM_OPS, | |
1214 | 1217 | }, |
1215 | - .suspend = atmel_ac97c_suspend, | |
1216 | - .resume = atmel_ac97c_resume, | |
1217 | 1218 | }; |
1218 | 1219 | |
1219 | 1220 | static int __init atmel_ac97c_init(void) |
sound/drivers/aloop.c
... | ... | @@ -1177,10 +1177,9 @@ |
1177 | 1177 | } |
1178 | 1178 | |
1179 | 1179 | #ifdef CONFIG_PM |
1180 | -static int loopback_suspend(struct platform_device *pdev, | |
1181 | - pm_message_t state) | |
1180 | +static int loopback_suspend(struct device *pdev) | |
1182 | 1181 | { |
1183 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1182 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1184 | 1183 | struct loopback *loopback = card->private_data; |
1185 | 1184 | |
1186 | 1185 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1187 | 1186 | |
1188 | 1187 | |
... | ... | @@ -1190,13 +1189,18 @@ |
1190 | 1189 | return 0; |
1191 | 1190 | } |
1192 | 1191 | |
1193 | -static int loopback_resume(struct platform_device *pdev) | |
1192 | +static int loopback_resume(struct device *pdev) | |
1194 | 1193 | { |
1195 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1194 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1196 | 1195 | |
1197 | 1196 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
1198 | 1197 | return 0; |
1199 | 1198 | } |
1199 | + | |
1200 | +static SIMPLE_DEV_PM_OPS(loopback_pm, loopback_suspend, loopback_resume); | |
1201 | +#define LOOPBACK_PM_OPS &loopback_pm | |
1202 | +#else | |
1203 | +#define LOOPBACK_PM_OPS NULL | |
1200 | 1204 | #endif |
1201 | 1205 | |
1202 | 1206 | #define SND_LOOPBACK_DRIVER "snd_aloop" |
1203 | 1207 | |
... | ... | @@ -1204,13 +1208,10 @@ |
1204 | 1208 | static struct platform_driver loopback_driver = { |
1205 | 1209 | .probe = loopback_probe, |
1206 | 1210 | .remove = __devexit_p(loopback_remove), |
1207 | -#ifdef CONFIG_PM | |
1208 | - .suspend = loopback_suspend, | |
1209 | - .resume = loopback_resume, | |
1210 | -#endif | |
1211 | 1211 | .driver = { |
1212 | 1212 | .name = SND_LOOPBACK_DRIVER, |
1213 | 1213 | .owner = THIS_MODULE, |
1214 | + .pm = LOOPBACK_PM_OPS, | |
1214 | 1215 | }, |
1215 | 1216 | }; |
1216 | 1217 |
sound/drivers/dummy.c
... | ... | @@ -1065,9 +1065,9 @@ |
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | #ifdef CONFIG_PM |
1068 | -static int snd_dummy_suspend(struct platform_device *pdev, pm_message_t state) | |
1068 | +static int snd_dummy_suspend(struct device *pdev) | |
1069 | 1069 | { |
1070 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1070 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1071 | 1071 | struct snd_dummy *dummy = card->private_data; |
1072 | 1072 | |
1073 | 1073 | snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); |
1074 | 1074 | |
1075 | 1075 | |
... | ... | @@ -1075,13 +1075,18 @@ |
1075 | 1075 | return 0; |
1076 | 1076 | } |
1077 | 1077 | |
1078 | -static int snd_dummy_resume(struct platform_device *pdev) | |
1078 | +static int snd_dummy_resume(struct device *pdev) | |
1079 | 1079 | { |
1080 | - struct snd_card *card = platform_get_drvdata(pdev); | |
1080 | + struct snd_card *card = dev_get_drvdata(pdev); | |
1081 | 1081 | |
1082 | 1082 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |
1083 | 1083 | return 0; |
1084 | 1084 | } |
1085 | + | |
1086 | +static SIMPLE_DEV_PM_OPS(snd_dummy_pm, snd_dummy_suspend, snd_dummy_resume); | |
1087 | +#define SND_DUMMY_PM_OPS &snd_dummy_pm | |
1088 | +#else | |
1089 | +#define SND_DUMMY_PM_OPS NULL | |
1085 | 1090 | #endif |
1086 | 1091 | |
1087 | 1092 | #define SND_DUMMY_DRIVER "snd_dummy" |
1088 | 1093 | |
... | ... | @@ -1089,13 +1094,10 @@ |
1089 | 1094 | static struct platform_driver snd_dummy_driver = { |
1090 | 1095 | .probe = snd_dummy_probe, |
1091 | 1096 | .remove = __devexit_p(snd_dummy_remove), |
1092 | -#ifdef CONFIG_PM | |
1093 | - .suspend = snd_dummy_suspend, | |
1094 | - .resume = snd_dummy_resume, | |
1095 | -#endif | |
1096 | 1097 | .driver = { |
1097 | 1098 | .name = SND_DUMMY_DRIVER, |
1098 | 1099 | .owner = THIS_MODULE, |
1100 | + .pm = SND_DUMMY_PM_OPS, | |
1099 | 1101 | }, |
1100 | 1102 | }; |
1101 | 1103 |
sound/drivers/pcsp/pcsp.c
... | ... | @@ -200,15 +200,18 @@ |
200 | 200 | } |
201 | 201 | |
202 | 202 | #ifdef CONFIG_PM |
203 | -static int pcsp_suspend(struct platform_device *dev, pm_message_t state) | |
203 | +static int pcsp_suspend(struct device *dev) | |
204 | 204 | { |
205 | - struct snd_pcsp *chip = platform_get_drvdata(dev); | |
205 | + struct snd_pcsp *chip = dev_get_drvdata(dev); | |
206 | 206 | pcsp_stop_beep(chip); |
207 | 207 | snd_pcm_suspend_all(chip->pcm); |
208 | 208 | return 0; |
209 | 209 | } |
210 | + | |
211 | +static SIMPLE_DEV_PM_OPS(pcsp_pm, pcsp_suspend, NULL); | |
212 | +#define PCSP_PM_OPS &pcsp_pm | |
210 | 213 | #else |
211 | -#define pcsp_suspend NULL | |
214 | +#define PCSP_PM_OPS NULL | |
212 | 215 | #endif /* CONFIG_PM */ |
213 | 216 | |
214 | 217 | static void pcsp_shutdown(struct platform_device *dev) |
215 | 218 | |
... | ... | @@ -221,10 +224,10 @@ |
221 | 224 | .driver = { |
222 | 225 | .name = "pcspkr", |
223 | 226 | .owner = THIS_MODULE, |
227 | + .pm = PCSP_PM_OPS, | |
224 | 228 | }, |
225 | 229 | .probe = pcsp_probe, |
226 | 230 | .remove = __devexit_p(pcsp_remove), |
227 | - .suspend = pcsp_suspend, | |
228 | 231 | .shutdown = pcsp_shutdown, |
229 | 232 | }; |
230 | 233 |
sound/ppc/powermac.c
... | ... | @@ -144,19 +144,24 @@ |
144 | 144 | } |
145 | 145 | |
146 | 146 | #ifdef CONFIG_PM |
147 | -static int snd_pmac_driver_suspend(struct platform_device *devptr, pm_message_t state) | |
147 | +static int snd_pmac_driver_suspend(struct device *dev) | |
148 | 148 | { |
149 | - struct snd_card *card = platform_get_drvdata(devptr); | |
149 | + struct snd_card *card = dev_get_drvdata(dev); | |
150 | 150 | snd_pmac_suspend(card->private_data); |
151 | 151 | return 0; |
152 | 152 | } |
153 | 153 | |
154 | -static int snd_pmac_driver_resume(struct platform_device *devptr) | |
154 | +static int snd_pmac_driver_resume(struct device *dev) | |
155 | 155 | { |
156 | - struct snd_card *card = platform_get_drvdata(devptr); | |
156 | + struct snd_card *card = dev_get_drvdata(dev); | |
157 | 157 | snd_pmac_resume(card->private_data); |
158 | 158 | return 0; |
159 | 159 | } |
160 | + | |
161 | +static SIMPLE_DEV_PM_OPS(snd_pmac_pm, snd_pmac_driver_suspend, snd_pmac_driver_resume); | |
162 | +#define SND_PMAC_PM_OPS &snd_pmac_pm | |
163 | +#else | |
164 | +#define SND_PMAC_PM_OPS NULL | |
160 | 165 | #endif |
161 | 166 | |
162 | 167 | #define SND_PMAC_DRIVER "snd_powermac" |
163 | 168 | |
... | ... | @@ -164,13 +169,10 @@ |
164 | 169 | static struct platform_driver snd_pmac_driver = { |
165 | 170 | .probe = snd_pmac_probe, |
166 | 171 | .remove = __devexit_p(snd_pmac_remove), |
167 | -#ifdef CONFIG_PM | |
168 | - .suspend = snd_pmac_driver_suspend, | |
169 | - .resume = snd_pmac_driver_resume, | |
170 | -#endif | |
171 | 172 | .driver = { |
172 | 173 | .name = SND_PMAC_DRIVER, |
173 | 174 | .owner = THIS_MODULE, |
175 | + .pm = SND_PMAC_PM_OPS, | |
174 | 176 | }, |
175 | 177 | }; |
176 | 178 |