[alsa-devel] [PATCH] ALSA: hda_intel: mark PM functions as __maybe_unused

Lukas Wunner lukas at wunner.de
Thu Mar 29 13:59:34 CEST 2018


On Thu, Mar 29, 2018 at 12:14:03AM +0200, Arnd Bergmann wrote:
> On Wed, Mar 28, 2018 at 4:31 PM, Lukas Wunner <lukas at wunner.de> wrote:
> > On Wed, Mar 28, 2018 at 04:19:29PM +0200, Arnd Bergmann wrote:
> >> Two callsites of azx_suspend/azx_resume were removed, leaving these
> >> functions only called from the optional SET_SYSTEM_SLEEP_PM_OPS()
> >> and causing a warning without CONFIG_PM_SLEEP:
> >>
> >> sound/pci/hda/hda_intel.c:1029:12: error: 'azx_resume' defined but not used [-Werror=unused-function]
> >>  static int azx_resume(struct device *dev)
> >>             ^~~~~~~~~~
> >> sound/pci/hda/hda_intel.c:994:12: error: 'azx_suspend' defined but not used [-Werror=unused-function]
> >>  static int azx_suspend(struct device *dev)
> >>             ^~~~~~~~~~~
> >>
> >> Keeping track of the correct #ifdef checks is hard, so this removes
> >> all the #ifdefs for power management in this file and instead uses
> >> __maybe_unused annotations that let the compiler do the job right
> >> by itself.
> >
> > Ugh, this isn't as hard as it may seem, just replace
> >
> >         #if defined(CONFIG_PM_SLEEP) || defined(SUPPORT_VGA_SWITCHEROO)
> >
> > with
> >
> >         #if defined(CONFIG_PM_SLEEP)
> >
> > That way it's just a simple one line change which is less intrusive.
> >
> > Care to respin like this?
> 
> I won't be able to test that properly before the merge window. If you
> are sure that works, maybe you can send that patch and just mark
> it as 'Reported-by: Arnd Bergmann <arnd at arndb.de>'?

Okay, I've just sent out the patch.  Could somebody ack this?  I'll then
be able to push it to drm-misc-next-fixes before the merge window opens.
>From that point on the issue will be gone in linux-next.  The drm pull
for 4.17 has already been sent out by Dave Airlie tonight, but he's
indicated that he'll send another pull with fixes during the second
half of the merge window.  Once that lands, the issue will be fixed in
Linus' tree as well.

I've verified that with this patch, the build compiles cleanly using the
drm-misc defconfigs for x86 and arm, and I've also verified that the
compiler warning is present without the patch, and gone with the patch.

Thanks again for the report.

Lukas


More information about the Alsa-devel mailing list