mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2024-12-28 16:53:49 +00:00
ALSA: rme96: 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. The temporary buffers for PCM stream backups are conditionally allocated since the sizes aren't too small. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20240207155140.18238-27-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
9de7d0caef
commit
ea1741dc34
@ -220,12 +220,10 @@ struct rme96 {
|
||||
|
||||
u8 rev; /* card revision number */
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
u32 playback_pointer;
|
||||
u32 capture_pointer;
|
||||
void *playback_suspend_buffer;
|
||||
void *capture_suspend_buffer;
|
||||
#endif
|
||||
|
||||
struct snd_pcm_substream *playback_substream;
|
||||
struct snd_pcm_substream *capture_substream;
|
||||
@ -1543,10 +1541,8 @@ snd_rme96_free(struct rme96 *rme96)
|
||||
rme96->areg &= ~RME96_AR_DAC_EN;
|
||||
writel(rme96->areg, rme96->iobase + RME96_IO_ADDITIONAL_REG);
|
||||
}
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
vfree(rme96->playback_suspend_buffer);
|
||||
vfree(rme96->capture_suspend_buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2329,8 +2325,6 @@ snd_rme96_create_switches(struct snd_card *card,
|
||||
* Card initialisation
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
|
||||
static int rme96_suspend(struct device *dev)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
@ -2392,11 +2386,7 @@ static int rme96_resume(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SIMPLE_DEV_PM_OPS(rme96_pm, rme96_suspend, rme96_resume);
|
||||
#define RME96_PM_OPS &rme96_pm
|
||||
#else
|
||||
#define RME96_PM_OPS NULL
|
||||
#endif /* CONFIG_PM_SLEEP */
|
||||
static DEFINE_SIMPLE_DEV_PM_OPS(rme96_pm, rme96_suspend, rme96_resume);
|
||||
|
||||
static void snd_rme96_card_free(struct snd_card *card)
|
||||
{
|
||||
@ -2432,14 +2422,14 @@ __snd_rme96_probe(struct pci_dev *pci,
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
#ifdef CONFIG_PM_SLEEP
|
||||
rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||
if (!rme96->playback_suspend_buffer)
|
||||
return -ENOMEM;
|
||||
rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||
if (!rme96->capture_suspend_buffer)
|
||||
return -ENOMEM;
|
||||
#endif
|
||||
if (IS_ENABLED(CONFIG_PM_SLEEP)) {
|
||||
rme96->playback_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||
if (!rme96->playback_suspend_buffer)
|
||||
return -ENOMEM;
|
||||
rme96->capture_suspend_buffer = vmalloc(RME96_BUFFER_SIZE);
|
||||
if (!rme96->capture_suspend_buffer)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
strcpy(card->driver, "Digi96");
|
||||
switch (rme96->pci->device) {
|
||||
@ -2483,7 +2473,7 @@ static struct pci_driver rme96_driver = {
|
||||
.id_table = snd_rme96_ids,
|
||||
.probe = snd_rme96_probe,
|
||||
.driver = {
|
||||
.pm = RME96_PM_OPS,
|
||||
.pm = &rme96_pm,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user