public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: interwave: guard PM-only restore helpers with CONFIG_PM
@ 2026-04-10 13:56 Cássio Gabriel
  2026-04-10 14:37 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-04-10 13:56 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: linux-sound, linux-kernel, kernel test robot, Cássio Gabriel

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>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: interwave: guard PM-only restore helpers with CONFIG_PM
  2026-04-10 13:56 [PATCH] ALSA: interwave: guard PM-only restore helpers with CONFIG_PM Cássio Gabriel
@ 2026-04-10 14:37 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-04-10 14:37 UTC (permalink / raw)
  To: Cássio Gabriel
  Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel,
	kernel test robot

On Fri, 10 Apr 2026 15:56:52 +0200,
Cássio Gabriel wrote:
> 
> 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>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-10 14:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10 13:56 [PATCH] ALSA: interwave: guard PM-only restore helpers with CONFIG_PM Cássio Gabriel
2026-04-10 14:37 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox