ALSA: es1968: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Feb 2024 15:51:33 +0000 (16:51 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Feb 2024 10:50:26 +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-23-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/es1968.c

index 4bc0f53c223b7949cf9c33acee56166da301114b..c6c018b40c69f9bd1af9c4d361cb6258ae01b077 100644 (file)
@@ -473,9 +473,7 @@ struct esschan {
        /* linked list */
        struct list_head list;
 
-#ifdef CONFIG_PM_SLEEP
        u16 wc_map[4];
-#endif
 };
 
 struct es1968 {
@@ -526,9 +524,7 @@ struct es1968 {
        struct list_head substream_list;
        spinlock_t substream_lock;
 
-#ifdef CONFIG_PM_SLEEP
        u16 apu_map[NR_APUS][NR_APU_REGS];
-#endif
 
 #ifdef SUPPORT_JOYSTICK
        struct gameport *gameport;
@@ -689,9 +685,7 @@ static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 dat
 {
        if (snd_BUG_ON(channel >= NR_APUS))
                return;
-#ifdef CONFIG_PM_SLEEP
        chip->apu_map[channel][reg] = data;
-#endif
        reg |= (channel << 4);
        apu_index_set(chip, reg);
        apu_data_set(chip, data);
@@ -976,9 +970,7 @@ static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es
        /* set the wavecache control reg */
        wave_set_register(chip, es->apu[channel] << 3, tmpval);
 
-#ifdef CONFIG_PM_SLEEP
        es->wc_map[channel] = tmpval;
-#endif
 }
 
 
@@ -2356,7 +2348,6 @@ static void snd_es1968_start_irq(struct es1968 *chip)
        outw(w, chip->io_port + ESM_PORT_HOST_IRQ);
 }
 
-#ifdef CONFIG_PM_SLEEP
 /*
  * PM support
  */
@@ -2418,11 +2409,7 @@ static int es1968_resume(struct device *dev)
        return 0;
 }
 
-static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume);
-#define ES1968_PM_OPS  &es1968_pm
-#else
-#define ES1968_PM_OPS  NULL
-#endif /* CONFIG_PM_SLEEP */
+static DEFINE_SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume);
 
 #ifdef SUPPORT_JOYSTICK
 #define JOYSTICK_ADDR  0x200
@@ -2852,7 +2839,7 @@ static struct pci_driver es1968_driver = {
        .id_table = snd_es1968_ids,
        .probe = snd_es1968_probe,
        .driver = {
-               .pm = ES1968_PM_OPS,
+               .pm = &es1968_pm,
        },
 };