Re: [PATCH RESEND] drm/rockchip: cdn-dp-core: Fix cdn_dp_resume unused warning

From: Arnd Bergmann
Date: Tue Sep 07 2021 - 04:18:00 EST


On Tue, Sep 7, 2021 at 9:02 AM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> On Mon, Sep 6, 2021 at 9:58 PM Palmer Dabbelt <palmer@xxxxxxxxxxx> wrote:
> > From: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

> >
> > +#ifdef CONFIG_PM_SLEEP
> > static int cdn_dp_resume(struct device *dev)
>
> An alternative solution would be to tag the function with
> __maybe_unused.

Right. In this case, both are correct, but generally speaking I tend to use the
__maybe_unused variant because it's more reliable at fixing the warning for
good when there are additional functions called by the suspend/resume
helpers that now become unused in some configurations, or when you pick
the wrong set of #ifdefs.

Having fewer #ifdef checks also helps with build coverage testing when there
is a warning inside of an #ifdef.

Arnd