Hi Arnd, Jonathan,
Le dim., nov. 28 2021 at 10:17:55 +0100, Arnd Bergmann <arnd@xxxxxxxx>
a écrit :
On Sat, Nov 27, 2021 at 7:09 PM Jonathan Cameron <jic23@xxxxxxxxxx>
wrote:
On Wed, 24 Nov 2021 15:10:06 +0000 Paul Cercueil
<paul@xxxxxxxxxxxxxxx> wrote:
> Le mer., nov. 24 2021 at 13:23:47 +0100, Arnd Bergmann
<arnd@xxxxxxxx>
>
> So you want to rename the current macros (to e.g. *_PM_OPS_LEGACY)
> everywhere so that new ones can be defined?
>
> What about we introduce new macros, and just deprecate the old
ones
> (with e.g. a checkpatch warning)? That would be way less work.
Sounds like a sensible approach to me. If Arnd is happy with that we
can move forwards and get the bikshedding on the naming started.
I suggested renaming the current macros as a way to avoid having to
come up with new names. If you have an idea for a new name that makes
sense in the long run, please just go ahead with that.
Yes, I totally understand that. But renaming such a widespread macro
sounds like a huge undertaking...
What about:
#define SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
.suspend = pm_sleep_ptr(suspend_fn), \
.resume = pm_sleep_ptr(resume_fn), \
...
#ifndef CONFIG_PM_SLEEP
#define SET_SYSTEM_SLEEP_PM_OPS(a, b) SYSTEM_SLEEP_PM_OPS(a, b)
#else
#define SET_SYSTEM_SLEEP_PM_OPS(a, b)
#endif
#define DEFINE_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
static const struct dev_pm_ops name = { \
SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn), \
}
SET_SYSTEM_SLEEP_PM_OPS -> SYSTEM_SLEEP_PM_OPS, with the old one now
defined from the new one;
SIMPLE_DEV_PM_OPS -> DEFINE_SIMPLE_DEV_PM_OPS.
Thoughts?
Cheers,
-Paul