summaryrefslogtreecommitdiff
path: root/sound/pci/ali5451
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-02-07 16:51:26 +0100
committerTakashi Iwai <tiwai@suse.de>2024-02-12 11:50:25 +0100
commitb9beb229eb265c544314a4e834d8467943c89650 (patch)
treedc0c74ad21713c24b746d1f4c4ac3d84f6c5b60d /sound/pci/ali5451
parent8ca0d10268b8b5951de13a21eb24744dc88d2e4b (diff)
ALSA: ali5451: Embed suspend image into struct snd_ali
Instead of allocating the memory with an additional devm_kmalloc(), just put the image into the existing struct snd_ali. The allocation size isn't too big, hence it works better with less allocation calls. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://lore.kernel.org/r/20240207155140.18238-16-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ali5451')
-rw-r--r--sound/pci/ali5451/ali5451.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 2378a39abaeb..9d48638a3ab4 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -244,7 +244,7 @@ struct snd_ali {
spinlock_t voice_alloc;
#ifdef CONFIG_PM_SLEEP
- struct snd_ali_image *image;
+ struct snd_ali_image image;
#endif
};
@@ -1829,13 +1829,9 @@ static int ali_suspend(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct snd_ali *chip = card->private_data;
- struct snd_ali_image *im;
+ struct snd_ali_image *im = &chip->image;
int i, j;
- im = chip->image;
- if (!im)
- return 0;
-
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
for (i = 0; i < chip->num_of_codecs; i++)
snd_ac97_suspend(chip->ac97[i]);
@@ -1872,13 +1868,9 @@ static int ali_resume(struct device *dev)
{
struct snd_card *card = dev_get_drvdata(dev);
struct snd_ali *chip = card->private_data;
- struct snd_ali_image *im;
+ struct snd_ali_image *im = &chip->image;
int i, j;
- im = chip->image;
- if (!im)
- return 0;
-
spin_lock_irq(&chip->reg_lock);
for (i = 0; i < ALI_CHANNELS; i++) {
@@ -2112,13 +2104,6 @@ static int snd_ali_create(struct snd_card *card,
return err;
}
-#ifdef CONFIG_PM_SLEEP
- codec->image = devm_kmalloc(&pci->dev, sizeof(*codec->image),
- GFP_KERNEL);
- if (!codec->image)
- dev_warn(card->dev, "can't allocate apm buffer\n");
-#endif
-
snd_ali_enable_address_interrupt(codec);
codec->hw_initialized = 1;
return 0;