]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: interwave: guard PM-only restore helpers with CONFIG_PM
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Fri, 10 Apr 2026 13:56:52 +0000 (10:56 -0300)
committerTakashi Iwai <tiwai@suse.de>
Fri, 10 Apr 2026 14:34:50 +0000 (16:34 +0200)
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>
Link: https://patch.msgid.link/20260410-alsa-interwave-pm-warning-fix-v1-1-434d14c9c262@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/isa/gus/interwave.c

index 616c11e51a2f609e99c9888f209256201225f8c3..6c3a2977dcb3f1c57fdfd052315b112f7339093a 100644 (file)
@@ -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;