ALSA: es1938: Simplify with DEFINE_SIMPLE_DEV_PM_OPS()

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-22-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2024-02-07 16:51:32 +01:00
parent f8f137a708
commit c70b12adf2

View file

@ -216,9 +216,7 @@ struct es1938 {
#ifdef SUPPORT_JOYSTICK #ifdef SUPPORT_JOYSTICK
struct gameport *gameport; struct gameport *gameport;
#endif #endif
#ifdef CONFIG_PM_SLEEP
unsigned char saved_regs[SAVED_REG_SIZE]; unsigned char saved_regs[SAVED_REG_SIZE];
#endif
}; };
static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id); static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id);
@ -1395,7 +1393,6 @@ static void snd_es1938_chip_init(struct es1938 *chip)
outb(0, SLDM_REG(chip, DMACLEAR)); outb(0, SLDM_REG(chip, DMACLEAR));
} }
#ifdef CONFIG_PM_SLEEP
/* /*
* PM support * PM support
*/ */
@ -1461,11 +1458,7 @@ static int es1938_resume(struct device *dev)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume); static DEFINE_SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume);
#define ES1938_PM_OPS &es1938_pm
#else
#define ES1938_PM_OPS NULL
#endif /* CONFIG_PM_SLEEP */
#ifdef SUPPORT_JOYSTICK #ifdef SUPPORT_JOYSTICK
static int snd_es1938_create_gameport(struct es1938 *chip) static int snd_es1938_create_gameport(struct es1938 *chip)
@ -1787,7 +1780,7 @@ static struct pci_driver es1938_driver = {
.id_table = snd_es1938_ids, .id_table = snd_es1938_ids,
.probe = snd_es1938_probe, .probe = snd_es1938_probe,
.driver = { .driver = {
.pm = ES1938_PM_OPS, .pm = &es1938_pm,
}, },
}; };