mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-28 12:19:09 -04:00
ALSA: ymfpci: Move allocation of saved registers to struct snd_ymfpci
The registers were previously allocated when CONFIG_PM_SLEEP was set, however this only saved an insignificant amount of memory otherwise. Signed-off-by: Tasos Sahanidis <tasos@tasossah.com> Link: https://lore.kernel.org/r/20230329041440.177363-3-tasos@tasossah.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
committed by
Takashi Iwai
parent
081364d703
commit
69a6c1ba42
@@ -268,6 +268,35 @@ struct snd_ymfpci_pcm {
|
||||
u32 shift;
|
||||
};
|
||||
|
||||
static const int saved_regs_index[] = {
|
||||
/* spdif */
|
||||
YDSXGR_SPDIFOUTCTRL,
|
||||
YDSXGR_SPDIFOUTSTATUS,
|
||||
YDSXGR_SPDIFINCTRL,
|
||||
/* volumes */
|
||||
YDSXGR_PRIADCLOOPVOL,
|
||||
YDSXGR_NATIVEDACINVOL,
|
||||
YDSXGR_NATIVEDACOUTVOL,
|
||||
YDSXGR_BUF441OUTVOL,
|
||||
YDSXGR_NATIVEADCINVOL,
|
||||
YDSXGR_SPDIFLOOPVOL,
|
||||
YDSXGR_SPDIFOUTVOL,
|
||||
YDSXGR_ZVOUTVOL,
|
||||
YDSXGR_LEGACYOUTVOL,
|
||||
/* address bases */
|
||||
YDSXGR_PLAYCTRLBASE,
|
||||
YDSXGR_RECCTRLBASE,
|
||||
YDSXGR_EFFCTRLBASE,
|
||||
YDSXGR_WORKBASE,
|
||||
/* capture set up */
|
||||
YDSXGR_MAPOFREC,
|
||||
YDSXGR_RECFORMAT,
|
||||
YDSXGR_RECSLOTSR,
|
||||
YDSXGR_ADCFORMAT,
|
||||
YDSXGR_ADCSLOTSR,
|
||||
};
|
||||
#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
|
||||
|
||||
struct snd_ymfpci {
|
||||
int irq;
|
||||
|
||||
@@ -345,7 +374,7 @@ struct snd_ymfpci {
|
||||
const struct firmware *dsp_microcode;
|
||||
const struct firmware *controller_microcode;
|
||||
|
||||
u32 *saved_regs;
|
||||
u32 saved_regs[YDSXGR_NUM_SAVED_REGS];
|
||||
u32 saved_ydsxgr_mode;
|
||||
u16 saved_dsxg_legacy;
|
||||
u16 saved_dsxg_elegacy;
|
||||
|
||||
@@ -2220,35 +2220,6 @@ static void snd_ymfpci_free(struct snd_card *card)
|
||||
release_firmware(chip->controller_microcode);
|
||||
}
|
||||
|
||||
static const int saved_regs_index[] = {
|
||||
/* spdif */
|
||||
YDSXGR_SPDIFOUTCTRL,
|
||||
YDSXGR_SPDIFOUTSTATUS,
|
||||
YDSXGR_SPDIFINCTRL,
|
||||
/* volumes */
|
||||
YDSXGR_PRIADCLOOPVOL,
|
||||
YDSXGR_NATIVEDACINVOL,
|
||||
YDSXGR_NATIVEDACOUTVOL,
|
||||
YDSXGR_BUF441OUTVOL,
|
||||
YDSXGR_NATIVEADCINVOL,
|
||||
YDSXGR_SPDIFLOOPVOL,
|
||||
YDSXGR_SPDIFOUTVOL,
|
||||
YDSXGR_ZVOUTVOL,
|
||||
YDSXGR_LEGACYOUTVOL,
|
||||
/* address bases */
|
||||
YDSXGR_PLAYCTRLBASE,
|
||||
YDSXGR_RECCTRLBASE,
|
||||
YDSXGR_EFFCTRLBASE,
|
||||
YDSXGR_WORKBASE,
|
||||
/* capture set up */
|
||||
YDSXGR_MAPOFREC,
|
||||
YDSXGR_RECFORMAT,
|
||||
YDSXGR_RECSLOTSR,
|
||||
YDSXGR_ADCFORMAT,
|
||||
YDSXGR_ADCSLOTSR,
|
||||
};
|
||||
#define YDSXGR_NUM_SAVED_REGS ARRAY_SIZE(saved_regs_index)
|
||||
|
||||
static int snd_ymfpci_suspend(struct device *dev)
|
||||
{
|
||||
struct snd_card *card = dev_get_drvdata(dev);
|
||||
@@ -2372,11 +2343,6 @@ int snd_ymfpci_create(struct snd_card *card,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
chip->saved_regs = devm_kmalloc_array(&pci->dev, YDSXGR_NUM_SAVED_REGS,
|
||||
sizeof(u32), GFP_KERNEL);
|
||||
if (!chip->saved_regs)
|
||||
return -ENOMEM;
|
||||
|
||||
snd_ymfpci_proc_init(card, chip);
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user