mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda_acpi: eliminate defined but not used warnings
@ 2025-05-22 20:30 Randy Dunlap
  2025-05-22 20:42 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2025-05-22 20:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Daniel Dadap, Takashi Iwai, Jaroslav Kysela, linux-sound

When CONFIG_PM_SLEEP is not set, the hda_acpi_suspend() and
hda_acpi_resume() functions are not used and cause build warnings:

sound/pci/hda/hda_acpi.c:282:12: warning: 'hda_acpi_resume' defined but not used [-Wunused-function]
  282 | static int hda_acpi_resume(struct device *dev)
sound/pci/hda/hda_acpi.c:269:12: warning: 'hda_acpi_suspend' defined but not used [-Wunused-function]
  269 | static int hda_acpi_suspend(struct device *dev)

Enclose these functions inside an ifdef CONFIG_PM_SLEEP block to
prevent the warnings.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Daniel Dadap <ddadap@nvidia.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: linux-sound@vger.kernel.org
---
 sound/pci/hda/hda_acpi.c |    2 ++
 1 file changed, 2 insertions(+)

--- linux-next-20250522.orig/sound/pci/hda/hda_acpi.c
+++ linux-next-20250522/sound/pci/hda/hda_acpi.c
@@ -266,6 +266,7 @@ static void hda_acpi_shutdown(struct pla
 		azx_stop_chip(chip);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int hda_acpi_suspend(struct device *dev)
 {
 	struct snd_card *card = dev_get_drvdata(dev);
@@ -291,6 +292,7 @@ static int hda_acpi_resume(struct device
 
 	return 0;
 }
+#endif /* CONFIG_PM_SLEEP */
 
 static const struct dev_pm_ops hda_acpi_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(hda_acpi_suspend, hda_acpi_resume)

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

* Re: [PATCH] ALSA: hda_acpi: eliminate defined but not used warnings
  2025-05-22 20:30 [PATCH] ALSA: hda_acpi: eliminate defined but not used warnings Randy Dunlap
@ 2025-05-22 20:42 ` Takashi Iwai
  2025-05-22 21:12   ` Daniel Dadap
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2025-05-22 20:42 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: linux-kernel, Daniel Dadap, Takashi Iwai, Jaroslav Kysela, linux-sound

On Thu, 22 May 2025 22:30:20 +0200,
Randy Dunlap wrote:
> 
> When CONFIG_PM_SLEEP is not set, the hda_acpi_suspend() and
> hda_acpi_resume() functions are not used and cause build warnings:
> 
> sound/pci/hda/hda_acpi.c:282:12: warning: 'hda_acpi_resume' defined but not used [-Wunused-function]
>   282 | static int hda_acpi_resume(struct device *dev)
> sound/pci/hda/hda_acpi.c:269:12: warning: 'hda_acpi_suspend' defined but not used [-Wunused-function]
>   269 | static int hda_acpi_suspend(struct device *dev)
> 
> Enclose these functions inside an ifdef CONFIG_PM_SLEEP block to
> prevent the warnings.
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Daniel Dadap <ddadap@nvidia.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: linux-sound@vger.kernel.org

Err, it just an incorrect use of SET_SYSTEM_SLEEP_PM_OPS() instead of
SYSTEM_SLEEP_OPS().  It seems that v5 patch went back to a wrong
macro, likely mistakenly.

A fix patch will follow.


thanks,

Takashi

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

* Re: [PATCH] ALSA: hda_acpi: eliminate defined but not used warnings
  2025-05-22 20:42 ` Takashi Iwai
@ 2025-05-22 21:12   ` Daniel Dadap
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Dadap @ 2025-05-22 21:12 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Randy Dunlap, linux-kernel, Jaroslav Kysela, linux-sound

On Thu, May 22, 2025 at 10:42:17PM +0200, Takashi Iwai wrote:
> On Thu, 22 May 2025 22:30:20 +0200,
> Randy Dunlap wrote:
> > 
> > When CONFIG_PM_SLEEP is not set, the hda_acpi_suspend() and
> > hda_acpi_resume() functions are not used and cause build warnings:
> > 
> > sound/pci/hda/hda_acpi.c:282:12: warning: 'hda_acpi_resume' defined but not used [-Wunused-function]
> >   282 | static int hda_acpi_resume(struct device *dev)
> > sound/pci/hda/hda_acpi.c:269:12: warning: 'hda_acpi_suspend' defined but not used [-Wunused-function]
> >   269 | static int hda_acpi_suspend(struct device *dev)
> > 
> > Enclose these functions inside an ifdef CONFIG_PM_SLEEP block to
> > prevent the warnings.
> > 
> > Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> > Cc: Daniel Dadap <ddadap@nvidia.com>
> > Cc: Takashi Iwai <tiwai@suse.de>
> > Cc: Jaroslav Kysela <perex@perex.cz>
> > Cc: linux-sound@vger.kernel.org
> 
> Err, it just an incorrect use of SET_SYSTEM_SLEEP_PM_OPS() instead of
> SYSTEM_SLEEP_OPS().  It seems that v5 patch went back to a wrong
> macro, likely mistakenly.
> 

Sorry about that, I'm not sure how that change got lost between v3 and v5.
(I also introduced a typo in the commit message of v5 that wasn't in the
original patch, oops.)

> A fix patch will follow.
> 
> 
> thanks,
> 
> Takashi

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

end of thread, other threads:[~2025-05-22 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-22 20:30 [PATCH] ALSA: hda_acpi: eliminate defined but not used warnings Randy Dunlap
2025-05-22 20:42 ` Takashi Iwai
2025-05-22 21:12   ` Daniel Dadap

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®