ALSA: cmipci: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Feb 2024 15:51:29 +0000 (16:51 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Feb 2024 10:50:25 +0000 (11:50 +0100)
Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.

This ends up with the allocation of a few additional bytes for the
register dumps even if it's not really used, but the code
simplification should justify the cost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/cmipci.c

index 08e34b184780187f66922448c40761e6281d84a2..36014501f7ed2e26595deee70aa8bc3a3e078f4b 100644 (file)
@@ -486,10 +486,8 @@ struct cmipci {
 
        spinlock_t reg_lock;
 
-#ifdef CONFIG_PM_SLEEP
        unsigned int saved_regs[0x20];
        unsigned char saved_mixers[0x20];
-#endif
 };
 
 
@@ -3260,7 +3258,6 @@ static int snd_cmipci_probe(struct pci_dev *pci,
        return err;
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * power management
  */
@@ -3324,18 +3321,14 @@ static int snd_cmipci_resume(struct device *dev)
        return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(snd_cmipci_pm, snd_cmipci_suspend, snd_cmipci_resume);
-#define SND_CMIPCI_PM_OPS      &snd_cmipci_pm
-#else
-#define SND_CMIPCI_PM_OPS      NULL
-#endif /* CONFIG_PM_SLEEP */
+static DEFINE_SIMPLE_DEV_PM_OPS(snd_cmipci_pm, snd_cmipci_suspend, snd_cmipci_resume);
 
 static struct pci_driver cmipci_driver = {
        .name = KBUILD_MODNAME,
        .id_table = snd_cmipci_ids,
        .probe = snd_cmipci_probe,
        .driver = {
-               .pm = SND_CMIPCI_PM_OPS,
+               .pm = &snd_cmipci_pm,
        },
 };