@@ -186,8 +186,10 @@ MODULE_PARM_DESC(pm_blacklist, "Enable power-management denylist");
186186static bool power_save_controller = 1 ;
187187module_param (power_save_controller , bool , 0644 );
188188MODULE_PARM_DESC (power_save_controller , "Reset controller in power save mode." );
189- #else
189+ #else /* CONFIG_PM */
190190#define power_save 0
191+ #define pm_blacklist false
192+ #define power_save_controller false
191193#endif /* CONFIG_PM */
192194
193195static int align_buffer_size = -1 ;
@@ -890,7 +892,6 @@ static void __azx_shutdown_chip(struct azx *chip, bool skip_link_reset)
890892 display_power (chip , false);
891893}
892894
893- #ifdef CONFIG_PM
894895static DEFINE_MUTEX (card_list_lock );
895896static LIST_HEAD (card_list );
896897
@@ -916,7 +917,7 @@ static void azx_del_card_list(struct azx *chip)
916917}
917918
918919/* trigger power-save check at writing parameter */
919- static int param_set_xint (const char * val , const struct kernel_param * kp )
920+ static int __maybe_unused param_set_xint (const char * val , const struct kernel_param * kp )
920921{
921922 struct hda_intel * hda ;
922923 struct azx * chip ;
@@ -987,7 +988,6 @@ static void __azx_runtime_resume(struct azx *chip)
987988 display_power (chip , false);
988989}
989990
990- #ifdef CONFIG_PM_SLEEP
991991static int azx_prepare (struct device * dev )
992992{
993993 struct snd_card * card = dev_get_drvdata (dev );
@@ -1046,7 +1046,7 @@ static int azx_suspend(struct device *dev)
10461046 return 0 ;
10471047}
10481048
1049- static int azx_resume (struct device * dev )
1049+ static int __maybe_unused azx_resume (struct device * dev )
10501050{
10511051 struct snd_card * card = dev_get_drvdata (dev );
10521052 struct azx * chip ;
@@ -1097,9 +1097,8 @@ static int azx_thaw_noirq(struct device *dev)
10971097
10981098 return 0 ;
10991099}
1100- #endif /* CONFIG_PM_SLEEP */
11011100
1102- static int azx_runtime_suspend (struct device * dev )
1101+ static int __maybe_unused azx_runtime_suspend (struct device * dev )
11031102{
11041103 struct snd_card * card = dev_get_drvdata (dev );
11051104 struct azx * chip ;
@@ -1116,7 +1115,7 @@ static int azx_runtime_suspend(struct device *dev)
11161115 return 0 ;
11171116}
11181117
1119- static int azx_runtime_resume (struct device * dev )
1118+ static int __maybe_unused azx_runtime_resume (struct device * dev )
11201119{
11211120 struct snd_card * card = dev_get_drvdata (dev );
11221121 struct azx * chip ;
@@ -1133,7 +1132,7 @@ static int azx_runtime_resume(struct device *dev)
11331132 return 0 ;
11341133}
11351134
1136- static int azx_runtime_idle (struct device * dev )
1135+ static int __maybe_unused azx_runtime_idle (struct device * dev )
11371136{
11381137 struct snd_card * card = dev_get_drvdata (dev );
11391138 struct azx * chip ;
@@ -1159,23 +1158,14 @@ static int azx_runtime_idle(struct device *dev)
11591158}
11601159
11611160static const struct dev_pm_ops azx_pm = {
1162- SET_SYSTEM_SLEEP_PM_OPS (azx_suspend , azx_resume )
1163- #ifdef CONFIG_PM_SLEEP
1164- .prepare = azx_prepare ,
1165- .complete = azx_complete ,
1166- .freeze_noirq = azx_freeze_noirq ,
1167- .thaw_noirq = azx_thaw_noirq ,
1168- #endif
1161+ SYSTEM_SLEEP_PM_OPS (azx_suspend , azx_resume )
1162+ .prepare = pm_sleep_ptr (azx_prepare ),
1163+ .complete = pm_sleep_ptr (azx_complete ),
1164+ .freeze_noirq = pm_sleep_ptr (azx_freeze_noirq ),
1165+ .thaw_noirq = pm_sleep_ptr (azx_thaw_noirq ),
11691166 SET_RUNTIME_PM_OPS (azx_runtime_suspend , azx_runtime_resume , azx_runtime_idle )
11701167};
11711168
1172- #define AZX_PM_OPS &azx_pm
1173- #else
1174- #define azx_add_card_list (chip ) /* NOP */
1175- #define azx_del_card_list (chip ) /* NOP */
1176- #define AZX_PM_OPS NULL
1177- #endif /* CONFIG_PM */
1178-
11791169
11801170static int azx_probe_continue (struct azx * chip );
11811171
@@ -2206,7 +2196,6 @@ static int azx_probe(struct pci_dev *pci,
22062196 return err ;
22072197}
22082198
2209- #ifdef CONFIG_PM
22102199/* On some boards setting power_save to a non 0 value leads to clicking /
22112200 * popping sounds when ever we enter/leave powersaving mode. Ideally we would
22122201 * figure out how to avoid these sounds, but that is not always feasible.
@@ -2248,13 +2237,11 @@ static const struct snd_pci_quirk power_save_denylist[] = {
22482237 SND_PCI_QUIRK (0x1734 , 0x1232 , "KONTRON SinglePC" , 0 ),
22492238 {}
22502239};
2251- #endif /* CONFIG_PM */
22522240
22532241static void set_default_power_save (struct azx * chip )
22542242{
22552243 int val = power_save ;
22562244
2257- #ifdef CONFIG_PM
22582245 if (pm_blacklist ) {
22592246 const struct snd_pci_quirk * q ;
22602247
@@ -2265,7 +2252,6 @@ static void set_default_power_save(struct azx *chip)
22652252 val = 0 ;
22662253 }
22672254 }
2268- #endif /* CONFIG_PM */
22692255 snd_hda_set_power_save (& chip -> bus , val * 1000 );
22702256}
22712257
@@ -2321,10 +2307,6 @@ static int azx_probe_continue(struct azx *chip)
23212307 chip -> fw -> data );
23222308 if (err < 0 )
23232309 goto out_free ;
2324- #ifndef CONFIG_PM
2325- release_firmware (chip -> fw ); /* no longer needed */
2326- chip -> fw = NULL ;
2327- #endif
23282310 }
23292311#endif
23302312
@@ -2765,7 +2747,7 @@ static struct pci_driver azx_driver = {
27652747 .remove = azx_remove ,
27662748 .shutdown = azx_shutdown ,
27672749 .driver = {
2768- .pm = AZX_PM_OPS ,
2750+ .pm = & azx_pm ,
27692751 },
27702752};
27712753
0 commit comments