Commit 5947c394 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: es1968: 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: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-23-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c70b12ad
...@@ -473,9 +473,7 @@ struct esschan { ...@@ -473,9 +473,7 @@ struct esschan {
/* linked list */ /* linked list */
struct list_head list; struct list_head list;
#ifdef CONFIG_PM_SLEEP
u16 wc_map[4]; u16 wc_map[4];
#endif
}; };
struct es1968 { struct es1968 {
...@@ -526,9 +524,7 @@ struct es1968 { ...@@ -526,9 +524,7 @@ struct es1968 {
struct list_head substream_list; struct list_head substream_list;
spinlock_t substream_lock; spinlock_t substream_lock;
#ifdef CONFIG_PM_SLEEP
u16 apu_map[NR_APUS][NR_APU_REGS]; u16 apu_map[NR_APUS][NR_APU_REGS];
#endif
#ifdef SUPPORT_JOYSTICK #ifdef SUPPORT_JOYSTICK
struct gameport *gameport; struct gameport *gameport;
...@@ -689,9 +685,7 @@ static void __apu_set_register(struct es1968 *chip, u16 channel, u8 reg, u16 dat ...@@ -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)) if (snd_BUG_ON(channel >= NR_APUS))
return; return;
#ifdef CONFIG_PM_SLEEP
chip->apu_map[channel][reg] = data; chip->apu_map[channel][reg] = data;
#endif
reg |= (channel << 4); reg |= (channel << 4);
apu_index_set(chip, reg); apu_index_set(chip, reg);
apu_data_set(chip, data); apu_data_set(chip, data);
...@@ -976,9 +970,7 @@ static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es ...@@ -976,9 +970,7 @@ static void snd_es1968_program_wavecache(struct es1968 *chip, struct esschan *es
/* set the wavecache control reg */ /* set the wavecache control reg */
wave_set_register(chip, es->apu[channel] << 3, tmpval); wave_set_register(chip, es->apu[channel] << 3, tmpval);
#ifdef CONFIG_PM_SLEEP
es->wc_map[channel] = tmpval; es->wc_map[channel] = tmpval;
#endif
} }
...@@ -2356,7 +2348,6 @@ static void snd_es1968_start_irq(struct es1968 *chip) ...@@ -2356,7 +2348,6 @@ static void snd_es1968_start_irq(struct es1968 *chip)
outw(w, chip->io_port + ESM_PORT_HOST_IRQ); outw(w, chip->io_port + ESM_PORT_HOST_IRQ);
} }
#ifdef CONFIG_PM_SLEEP
/* /*
* PM support * PM support
*/ */
...@@ -2418,11 +2409,7 @@ static int es1968_resume(struct device *dev) ...@@ -2418,11 +2409,7 @@ static int es1968_resume(struct device *dev)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume); static DEFINE_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 */
#ifdef SUPPORT_JOYSTICK #ifdef SUPPORT_JOYSTICK
#define JOYSTICK_ADDR 0x200 #define JOYSTICK_ADDR 0x200
...@@ -2852,7 +2839,7 @@ static struct pci_driver es1968_driver = { ...@@ -2852,7 +2839,7 @@ static struct pci_driver es1968_driver = {
.id_table = snd_es1968_ids, .id_table = snd_es1968_ids,
.probe = snd_es1968_probe, .probe = snd_es1968_probe,
.driver = { .driver = {
.pm = ES1968_PM_OPS, .pm = &es1968_pm,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment