Commit 9de7d0ca authored by Takashi Iwai's avatar Takashi Iwai

ALSA: riptide: 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 an additional allocation of a flag without
CONFIG_PM, 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-26-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a2280df4
...@@ -448,9 +448,7 @@ struct snd_riptide { ...@@ -448,9 +448,7 @@ struct snd_riptide {
unsigned long received_irqs; unsigned long received_irqs;
unsigned long handled_irqs; unsigned long handled_irqs;
#ifdef CONFIG_PM_SLEEP
int in_suspend; int in_suspend;
#endif
}; };
struct sgd { /* scatter gather desriptor */ struct sgd { /* scatter gather desriptor */
...@@ -1142,7 +1140,6 @@ static irqreturn_t riptide_handleirq(int irq, void *dev_id) ...@@ -1142,7 +1140,6 @@ static irqreturn_t riptide_handleirq(int irq, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
#ifdef CONFIG_PM_SLEEP
static int riptide_suspend(struct device *dev) static int riptide_suspend(struct device *dev)
{ {
struct snd_card *card = dev_get_drvdata(dev); struct snd_card *card = dev_get_drvdata(dev);
...@@ -1166,11 +1163,7 @@ static int riptide_resume(struct device *dev) ...@@ -1166,11 +1163,7 @@ static int riptide_resume(struct device *dev)
return 0; return 0;
} }
static SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume); static DEFINE_SIMPLE_DEV_PM_OPS(riptide_pm, riptide_suspend, riptide_resume);
#define RIPTIDE_PM_OPS &riptide_pm
#else
#define RIPTIDE_PM_OPS NULL
#endif /* CONFIG_PM_SLEEP */
static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip) static int try_to_load_firmware(struct cmdif *cif, struct snd_riptide *chip)
{ {
...@@ -2135,7 +2128,7 @@ static struct pci_driver driver = { ...@@ -2135,7 +2128,7 @@ static struct pci_driver driver = {
.id_table = snd_riptide_ids, .id_table = snd_riptide_ids,
.probe = snd_card_riptide_probe, .probe = snd_card_riptide_probe,
.driver = { .driver = {
.pm = RIPTIDE_PM_OPS, .pm = &riptide_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