mbox series

[0/5] Rework pm_ptr() and *_PM_OPS macros

Message ID 20211207002102.26414-1-paul@crapouillou.net (mailing list archive)
Headers show
Series Rework pm_ptr() and *_PM_OPS macros | expand

Message

Paul Cercueil Dec. 7, 2021, 12:20 a.m. UTC
Hi,

This patchset reworks the pm_ptr() macro I introduced a few versions
ago, so that it is not conditionally defined.

It applies the same treatment to the *_PM_OPS macros. Instead of
modifying the existing ones, which would mean a 2000+ patch bomb, this
patchset introduce two new macros to replace the now deprecated
UNIVERSAL_DEV_PM_OPS() and SIMPLE_DEV_PM_OPS().

The point of all of this, is to progressively switch from a code model
where PM callbacks are all protected behind CONFIG_PM guards, to a code
model where PM callbacks are always seen by the compiler, but discarded
if not used.

Patch [4/5] and [5/5] are just examples to illustrate the use of the new
macros. As such they don't really have to be merged at the same time as
the rest and can be delayed until a subsystem-wide patchset is proposed.

- Patch [4/5] modifies a driver that already used the pm_ptr() macro,
  but had to use the __maybe_unused flag to avoid compiler warnings;
- Patch [5/5] modifies a driver that used a #ifdef CONFIG_PM guard
  around its suspend/resume functions.

Paul Cercueil (5):
  r8169: Avoid misuse of pm_ptr() macro
  PM: core: Redefine pm_ptr() macro
  PM: core: Add new *_PM_OPS macros, deprecate old ones
  mmc: jz4740: Use the new PM macros
  mmc: mxc: Use the new PM macros

 drivers/mmc/host/jz4740_mmc.c             |  8 +--
 drivers/mmc/host/mxcmmc.c                 |  6 +-
 drivers/net/ethernet/realtek/r8169_main.c |  4 +-
 include/linux/pm.h                        | 80 +++++++++++++++--------
 4 files changed, 60 insertions(+), 38 deletions(-)

Comments

Arnd Bergmann Dec. 7, 2021, 9:22 a.m. UTC | #1
On Tue, Dec 7, 2021 at 1:20 AM Paul Cercueil <paul@crapouillou.net> wrote:
>
> This patchset reworks the pm_ptr() macro I introduced a few versions
> ago, so that it is not conditionally defined.
>
> It applies the same treatment to the *_PM_OPS macros. Instead of
> modifying the existing ones, which would mean a 2000+ patch bomb, this
> patchset introduce two new macros to replace the now deprecated
> UNIVERSAL_DEV_PM_OPS() and SIMPLE_DEV_PM_OPS().
>
> The point of all of this, is to progressively switch from a code model
> where PM callbacks are all protected behind CONFIG_PM guards, to a code
> model where PM callbacks are always seen by the compiler, but discarded
> if not used.
>
> Patch [4/5] and [5/5] are just examples to illustrate the use of the new
> macros. As such they don't really have to be merged at the same time as
> the rest and can be delayed until a subsystem-wide patchset is proposed.
>
> - Patch [4/5] modifies a driver that already used the pm_ptr() macro,
>   but had to use the __maybe_unused flag to avoid compiler warnings;
> - Patch [5/5] modifies a driver that used a #ifdef CONFIG_PM guard
>   around its suspend/resume functions.

This is fantastic, I love the new naming and it should provide a great path
towards converting all drivers eventually. I've added the patches to
my randconfig test build box to see if something breaks, but otherwise
I think these are ready to get into linux-next, at least patches 1-3,
so subsystem
maintainers can start queuing up the conversion patches once the
initial set is merged.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Rafael J. Wysocki Dec. 17, 2021, 3:07 p.m. UTC | #2
On Tue, Dec 7, 2021 at 10:22 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Tue, Dec 7, 2021 at 1:20 AM Paul Cercueil <paul@crapouillou.net> wrote:
> >
> > This patchset reworks the pm_ptr() macro I introduced a few versions
> > ago, so that it is not conditionally defined.
> >
> > It applies the same treatment to the *_PM_OPS macros. Instead of
> > modifying the existing ones, which would mean a 2000+ patch bomb, this
> > patchset introduce two new macros to replace the now deprecated
> > UNIVERSAL_DEV_PM_OPS() and SIMPLE_DEV_PM_OPS().
> >
> > The point of all of this, is to progressively switch from a code model
> > where PM callbacks are all protected behind CONFIG_PM guards, to a code
> > model where PM callbacks are always seen by the compiler, but discarded
> > if not used.
> >
> > Patch [4/5] and [5/5] are just examples to illustrate the use of the new
> > macros. As such they don't really have to be merged at the same time as
> > the rest and can be delayed until a subsystem-wide patchset is proposed.
> >
> > - Patch [4/5] modifies a driver that already used the pm_ptr() macro,
> >   but had to use the __maybe_unused flag to avoid compiler warnings;
> > - Patch [5/5] modifies a driver that used a #ifdef CONFIG_PM guard
> >   around its suspend/resume functions.
>
> This is fantastic, I love the new naming and it should provide a great path
> towards converting all drivers eventually. I've added the patches to
> my randconfig test build box to see if something breaks, but otherwise
> I think these are ready to get into linux-next, at least patches 1-3,
> so subsystem
> maintainers can start queuing up the conversion patches once the
> initial set is merged.
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>

Patches [0-3/5] applied as 5.17 material.

The mmc patches need ACKs, but I can take them too.
Ulf Hansson Dec. 17, 2021, 5:16 p.m. UTC | #3
On Fri, 17 Dec 2021 at 16:07, Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Tue, Dec 7, 2021 at 10:22 AM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Tue, Dec 7, 2021 at 1:20 AM Paul Cercueil <paul@crapouillou.net> wrote:
> > >
> > > This patchset reworks the pm_ptr() macro I introduced a few versions
> > > ago, so that it is not conditionally defined.
> > >
> > > It applies the same treatment to the *_PM_OPS macros. Instead of
> > > modifying the existing ones, which would mean a 2000+ patch bomb, this
> > > patchset introduce two new macros to replace the now deprecated
> > > UNIVERSAL_DEV_PM_OPS() and SIMPLE_DEV_PM_OPS().
> > >
> > > The point of all of this, is to progressively switch from a code model
> > > where PM callbacks are all protected behind CONFIG_PM guards, to a code
> > > model where PM callbacks are always seen by the compiler, but discarded
> > > if not used.
> > >
> > > Patch [4/5] and [5/5] are just examples to illustrate the use of the new
> > > macros. As such they don't really have to be merged at the same time as
> > > the rest and can be delayed until a subsystem-wide patchset is proposed.
> > >
> > > - Patch [4/5] modifies a driver that already used the pm_ptr() macro,
> > >   but had to use the __maybe_unused flag to avoid compiler warnings;
> > > - Patch [5/5] modifies a driver that used a #ifdef CONFIG_PM guard
> > >   around its suspend/resume functions.
> >
> > This is fantastic, I love the new naming and it should provide a great path
> > towards converting all drivers eventually. I've added the patches to
> > my randconfig test build box to see if something breaks, but otherwise
> > I think these are ready to get into linux-next, at least patches 1-3,
> > so subsystem
> > maintainers can start queuing up the conversion patches once the
> > initial set is merged.
> >
> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>
> Patches [0-3/5] applied as 5.17 material.
>
> The mmc patches need ACKs, but I can take them too.

Sure, please add my ack for them!

Kind regards
Uffe
Rafael J. Wysocki Dec. 17, 2021, 6:22 p.m. UTC | #4
On Fri, Dec 17, 2021 at 6:17 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Fri, 17 Dec 2021 at 16:07, Rafael J. Wysocki <rafael@kernel.org> wrote:
> >
> > On Tue, Dec 7, 2021 at 10:22 AM Arnd Bergmann <arnd@arndb.de> wrote:
> > >
> > > On Tue, Dec 7, 2021 at 1:20 AM Paul Cercueil <paul@crapouillou.net> wrote:
> > > >
> > > > This patchset reworks the pm_ptr() macro I introduced a few versions
> > > > ago, so that it is not conditionally defined.
> > > >
> > > > It applies the same treatment to the *_PM_OPS macros. Instead of
> > > > modifying the existing ones, which would mean a 2000+ patch bomb, this
> > > > patchset introduce two new macros to replace the now deprecated
> > > > UNIVERSAL_DEV_PM_OPS() and SIMPLE_DEV_PM_OPS().
> > > >
> > > > The point of all of this, is to progressively switch from a code model
> > > > where PM callbacks are all protected behind CONFIG_PM guards, to a code
> > > > model where PM callbacks are always seen by the compiler, but discarded
> > > > if not used.
> > > >
> > > > Patch [4/5] and [5/5] are just examples to illustrate the use of the new
> > > > macros. As such they don't really have to be merged at the same time as
> > > > the rest and can be delayed until a subsystem-wide patchset is proposed.
> > > >
> > > > - Patch [4/5] modifies a driver that already used the pm_ptr() macro,
> > > >   but had to use the __maybe_unused flag to avoid compiler warnings;
> > > > - Patch [5/5] modifies a driver that used a #ifdef CONFIG_PM guard
> > > >   around its suspend/resume functions.
> > >
> > > This is fantastic, I love the new naming and it should provide a great path
> > > towards converting all drivers eventually. I've added the patches to
> > > my randconfig test build box to see if something breaks, but otherwise
> > > I think these are ready to get into linux-next, at least patches 1-3,
> > > so subsystem
> > > maintainers can start queuing up the conversion patches once the
> > > initial set is merged.
> > >
> > > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
> >
> > Patches [0-3/5] applied as 5.17 material.
> >
> > The mmc patches need ACKs, but I can take them too.
>
> Sure, please add my ack for them!

Both applied as 5.17 material with your ACKs, thanks!