All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tasos Sahanidis via Alsa-devel <alsa-devel@alsa-project.org>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.com, tasos@tasossah.com
Subject: [PATCH 2/4] ALSA: ymfpci: Move allocation of saved registers to struct snd_ymfpci
Date: Wed, 29 Mar 2023 07:14:38 +0300	[thread overview]
Message-ID: <168006334833.26.13441719652980718121@mailman-core.alsa-project.org> (raw)
In-Reply-To: <20230329041440.177363-1-tasos@tasossah.com>


[-- Attachment #0: Type: message/rfc822, Size: 6581 bytes --]

From: Tasos Sahanidis <tasos@tasossah.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.com, tasos@tasossah.com
Subject: [PATCH 2/4] ALSA: ymfpci: Move allocation of saved registers to struct snd_ymfpci
Date: Wed, 29 Mar 2023 07:14:38 +0300
Message-ID: <20230329041440.177363-3-tasos@tasossah.com>

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>
---
 sound/pci/ymfpci/ymfpci.h      | 31 ++++++++++++++++++++++++++++++-
 sound/pci/ymfpci/ymfpci_main.c | 34 ----------------------------------
 2 files changed, 30 insertions(+), 35 deletions(-)

diff --git a/sound/pci/ymfpci/ymfpci.h b/sound/pci/ymfpci/ymfpci.h
index 2103654c6..04e280004 100644
--- a/sound/pci/ymfpci/ymfpci.h
+++ b/sound/pci/ymfpci/ymfpci.h
@@ -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;
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 6d13f4152..8bf647824 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -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;
-- 
2.25.1


  parent reply	other threads:[~2023-03-29  4:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230329041440.177363-1-tasos@tasossah.com>
2023-03-29  4:14 ` [PATCH 1/4] ALSA: ymfpci: Switch to DEFINE_SIMPLE_DEV_PM_OPS() Tasos Sahanidis via Alsa-devel
2023-03-29  4:14 ` Tasos Sahanidis via Alsa-devel [this message]
2023-03-29  4:14 ` [PATCH 3/4] ALSA: ymfpci: Store saved legacy registers in an array Tasos Sahanidis via Alsa-devel
2023-03-29  4:14 ` [PATCH 4/4] ALSA: ymfpci: Store additional legacy registers on suspend Tasos Sahanidis via Alsa-devel
2023-03-29  6:40 ` [PATCH 0/4] ALSA: ymfpci: PM related cleanups and fixes Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=168006334833.26.13441719652980718121@mailman-core.alsa-project.org \
    --to=alsa-devel@alsa-project.org \
    --cc=tasos@tasossah.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.