mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cássio Gabriel" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	"kernel test robot" <lkp@intel.com>,
	"Cássio Gabriel" <cassiogabrielcontato@gmail.com>
Subject: [PATCH] ALSA: interwave: guard PM-only restore helpers with CONFIG_PM
Date: Fri, 10 Apr 2026 10:56:52 -0300	[thread overview]
Message-ID: <20260410-alsa-interwave-pm-warning-fix-v1-1-434d14c9c262@gmail.com> (raw)

The InterWave PM patch added snd_interwave_restore_regs() and
snd_interwave_restore_memory() as static helpers, but both are used only
from the resume path under CONFIG_PM.

On configurations without CONFIG_PM, such as alpha allyesconfig, this
leaves both helpers unused and triggers -Wunused-function warnings with
W=1.

Move the PM-only helpers into the existing CONFIG_PM section. Keep
__snd_interwave_restore_regs() outside the guard because it is also used
during probe-time initialization.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202604101958.x16oNkfo-lkp@intel.com/
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
 sound/isa/gus/interwave.c | 76 +++++++++++++++++++++++------------------------
 1 file changed, 38 insertions(+), 38 deletions(-)

diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 616c11e51a2f..6c3a2977dcb3 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -480,44 +480,6 @@ static void __snd_interwave_restore_regs(struct snd_gus_card *gus)
 	snd_gf1_write8(gus, SNDRV_GF1_GB_EMULATION_IRQ, 0x00);
 }
 
-static void snd_interwave_restore_regs(struct snd_gus_card *gus)
-{
-	scoped_guard(spinlock_irqsave, &gus->reg_lock)
-		__snd_interwave_restore_regs(gus);
-}
-
-static void snd_interwave_restore_memory(struct snd_gus_card *gus)
-{
-	unsigned short mem_cfg;
-	unsigned int lmct = 0;
-	int i, lmc_cfg;
-
-	if (!gus->gf1.memory)
-		return;
-
-	for (i = 0; i < 4; i++)
-		lmct |= (gus->gf1.mem_alloc.banks_16[i].size >> 18) << (i * 8);
-
-	lmc_cfg = snd_interwave_find_memory_config(lmct);
-	if (lmc_cfg < 0) {
-		if (!gus->gf1.enh_mode) {
-			lmc_cfg = 2;
-		} else {
-			dev_warn(gus->card->dev,
-				 "cannot restore InterWave memory layout 0x%08x\n",
-				 lmct);
-			return;
-		}
-	}
-
-	scoped_guard(spinlock_irqsave, &gus->reg_lock) {
-		mem_cfg = snd_gf1_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG);
-		mem_cfg = (mem_cfg & 0xfff0) | lmc_cfg;
-		mem_cfg = (mem_cfg & 0xff1f) | (4 << 5);
-		snd_gf1_write16(gus, SNDRV_GF1_GW_MEMORY_CONFIG, mem_cfg);
-	}
-}
-
 static void snd_interwave_init(int dev, struct snd_gus_card *gus)
 {
 	/* Probe-time setup also clears the timer control register. */
@@ -888,6 +850,44 @@ static int snd_interwave_isa_probe(struct device *pdev,
 }
 
 #ifdef CONFIG_PM
+static void snd_interwave_restore_regs(struct snd_gus_card *gus)
+{
+	scoped_guard(spinlock_irqsave, &gus->reg_lock)
+		__snd_interwave_restore_regs(gus);
+}
+
+static void snd_interwave_restore_memory(struct snd_gus_card *gus)
+{
+	unsigned short mem_cfg;
+	unsigned int lmct = 0;
+	int i, lmc_cfg;
+
+	if (!gus->gf1.memory)
+		return;
+
+	for (i = 0; i < 4; i++)
+		lmct |= (gus->gf1.mem_alloc.banks_16[i].size >> 18) << (i * 8);
+
+	lmc_cfg = snd_interwave_find_memory_config(lmct);
+	if (lmc_cfg < 0) {
+		if (!gus->gf1.enh_mode) {
+			lmc_cfg = 2;
+		} else {
+			dev_warn(gus->card->dev,
+				 "cannot restore InterWave memory layout 0x%08x\n",
+				 lmct);
+			return;
+		}
+	}
+
+	scoped_guard(spinlock_irqsave, &gus->reg_lock) {
+		mem_cfg = snd_gf1_look16(gus, SNDRV_GF1_GW_MEMORY_CONFIG);
+		mem_cfg = (mem_cfg & 0xfff0) | lmc_cfg;
+		mem_cfg = (mem_cfg & 0xff1f) | (4 << 5);
+		snd_gf1_write16(gus, SNDRV_GF1_GW_MEMORY_CONFIG, mem_cfg);
+	}
+}
+
 static int snd_interwave_card_suspend(struct snd_card *card)
 {
 	struct snd_interwave *iwcard = card->private_data;

---
base-commit: 80cdbd09760cdfe3c643ef43c1ff2d798babb28a
change-id: 20260410-alsa-interwave-pm-warning-fix-ca355d1853ce

Best regards,
--  
Cássio Gabriel <cassiogabrielcontato@gmail.com>


             reply	other threads:[~2026-04-10 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 13:56 Cássio Gabriel [this message]
2026-04-10 14:37 ` 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=20260410-alsa-interwave-pm-warning-fix-v1-1-434d14c9c262@gmail.com \
    --to=cassiogabrielcontato@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=perex@perex.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®