[PATCH] drm/tegra: vic: fix unused-function warnings

Arnd Bergmann arnd at kernel.org
Wed Apr 6 15:51:59 UTC 2022


On Wed, Apr 6, 2022 at 3:21 PM Thierry Reding <thierry.reding at gmail.com> wrote:
> On Wed, Mar 16, 2022 at 07:36:47PM +0100, Arnd Bergmann wrote:
> >  static const struct dev_pm_ops vic_pm_ops = {
> > -     SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> > -     SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
> > -                             pm_runtime_force_resume)
> > +     RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
> > +     SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
> >  };
> >
> >  struct platform_driver tegra_vic_driver = {
>
> Hi Arnd,
>
> is this a replacement for __maybe_unused annotations that we would
> typically use to address these? Is the ternary operator in PTR_IF enough
> to eliminate the warning? Does that work the same way for structure
> definitions as it does for conditionals where we use IS_ENABLED() to use
> the compiler's DCE for improved coverage?

Yes to all three.

> It looks like it, but just making sure because there's another patch
> that fixes this warning by adding __maybe_unused.

I sent a lot of patches in the past to add __maybe_unused, but this was
mainly because we could never come up with a good replacement.
Paul Cercueil has finally come up with a good solution, so this is how
we should do it from now on.

        Arnd


More information about the dri-devel mailing list