RE: [PATCH 5.10.y-cip 14/23] PM: core: Add new *_PM_OPS macros, deprecate old ones

Biju Das
2023-05-20T15:01:04Z

Hi Pavel,

> Subject: Re: [PATCH 5.10.y-cip 14/23] PM: core: Add new *_PM_OPS macros,
> deprecate old ones
>
> Hi!
>
> I'll have comments on 19/, but this one is kind of important:
>
> > From: Paul Cercueil <paul@crapouillou.net>
> >
> > commit 1a3c7bb088266fa2db017be299f91f1c1894c857 upstream.
> >
> > This commit introduces the following macros:
> >
> > SYSTEM_SLEEP_PM_OPS()
> > LATE_SYSTEM_SLEEP_PM_OPS()
> > NOIRQ_SYSTEM_SLEEP_PM_OPS()
> > RUNTIME_PM_OPS()
> >
> > These new macros are very similar to their SET_*_PM_OPS() equivalent.
> > They however differ in the fact that the callbacks they set will
> > always be seen as referenced by the compiler. This means that the
> > callback functions don't need to be wrapped with a #ifdef CONFIG_PM
> > guard, or tagged with __maybe_unused, to prevent the compiler from
> > complaining about unused static symbols. The compiler will then simply
> > evaluate at compile time whether or not these symbols are dead code.
> >
> > The callbacks that are only useful with CONFIG_PM_SLEEP is enabled,
> > are now also wrapped with a new pm_sleep_ptr() macro, which is
> > inspired from pm_ptr(). This is needed for drivers that use different
> > callbacks for sleep and runtime PM, to handle the case where CONFIG_PM
> > is set and CONFIG_PM_SLEEP is not.
> >
> > This commit also deprecates the following macros:
> >
> > SIMPLE_DEV_PM_OPS()
> > UNIVERSAL_DEV_PM_OPS()
> >
> > And introduces the following macros:
> >
> > DEFINE_SIMPLE_DEV_PM_OPS()
> > DEFINE_UNIVERSAL_DEV_PM_OPS()
>
> Changing interfaces / deprecating macros is not good thing to do in -cip
> kernel. How sure are we this will not cause build failures or build
> warnings in unrelated piece of code?

Please see the commit [1] carefully,

Deprecated is just a comment and it is just single header file change and
There is no existing macros changed.

Please let me know, if I am missing anything.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/pm.h?h=v6.4-rc2&id=1a3c7bb088266fa2db017be299f91f1c1894c857

Cheers,
Biju