public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PM / wakeup: Register class wakeup in pure_initcall phase
@ 2026-04-03 16:09 Heiner Kallweit
  2026-04-03 17:24 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Heiner Kallweit @ 2026-04-03 16:09 UTC (permalink / raw)
  To: Rafael J. Wysocki, Pavel Machek, Len Brown, Greg Kroah-Hartman,
	Danilo Krummrich
  Cc: Linux PM, driver-core

Wakeup sources (e.g. autosleep) can be created as early as core_initcall.
Class wakeup is registered in postcore_initcall only, what results in
autosleep wakeup source not being shown in sysfs. To fix this,
register class wakeup in pure_initcall phase already.

The current behavior doesn't cause any known issue, therefore treat
the change as an improvement.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/power/wakeup_stats.c b/drivers/base/power/wakeup_stats.c
index 308f8bde9..30f0d3d61 100644
--- a/drivers/base/power/wakeup_stats.c
+++ b/drivers/base/power/wakeup_stats.c
@@ -216,4 +216,4 @@ static int __init wakeup_sources_sysfs_init(void)
 
 	return PTR_ERR_OR_ZERO(wakeup_class);
 }
-postcore_initcall(wakeup_sources_sysfs_init);
+pure_initcall(wakeup_sources_sysfs_init);
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM / wakeup: Register class wakeup in pure_initcall phase
  2026-04-03 16:09 [PATCH] PM / wakeup: Register class wakeup in pure_initcall phase Heiner Kallweit
@ 2026-04-03 17:24 ` Greg Kroah-Hartman
  2026-04-06 15:17   ` Rafael J. Wysocki
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-04-03 17:24 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Danilo Krummrich,
	Linux PM, driver-core

On Fri, Apr 03, 2026 at 06:09:59PM +0200, Heiner Kallweit wrote:
> Wakeup sources (e.g. autosleep) can be created as early as core_initcall.
> Class wakeup is registered in postcore_initcall only, what results in
> autosleep wakeup source not being shown in sysfs. To fix this,
> register class wakeup in pure_initcall phase already.
> 
> The current behavior doesn't cause any known issue, therefore treat
> the change as an improvement.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>  drivers/base/power/wakeup_stats.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/base/power/wakeup_stats.c b/drivers/base/power/wakeup_stats.c
> index 308f8bde9..30f0d3d61 100644
> --- a/drivers/base/power/wakeup_stats.c
> +++ b/drivers/base/power/wakeup_stats.c
> @@ -216,4 +216,4 @@ static int __init wakeup_sources_sysfs_init(void)
>  
>  	return PTR_ERR_OR_ZERO(wakeup_class);
>  }
> -postcore_initcall(wakeup_sources_sysfs_init);
> +pure_initcall(wakeup_sources_sysfs_init);
> -- 
> 2.53.0
> 

Wait, if this doesn't need to be change, we shouldn't change it.  Unless
you have a bug that is being fixed here, don't touch init call levels.
They are tricky and will come to bite you if you don't watch out.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PM / wakeup: Register class wakeup in pure_initcall phase
  2026-04-03 17:24 ` Greg Kroah-Hartman
@ 2026-04-06 15:17   ` Rafael J. Wysocki
  0 siblings, 0 replies; 3+ messages in thread
From: Rafael J. Wysocki @ 2026-04-06 15:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Heiner Kallweit
  Cc: Pavel Machek, Danilo Krummrich, Linux PM, driver-core

On Fri, Apr 3, 2026 at 7:24 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Fri, Apr 03, 2026 at 06:09:59PM +0200, Heiner Kallweit wrote:
> > Wakeup sources (e.g. autosleep) can be created as early as core_initcall.
> > Class wakeup is registered in postcore_initcall only, what results in
> > autosleep wakeup source not being shown in sysfs. To fix this,
> > register class wakeup in pure_initcall phase already.
> >
> > The current behavior doesn't cause any known issue, therefore treat
> > the change as an improvement.
> >
> > Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> > ---
> >  drivers/base/power/wakeup_stats.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/base/power/wakeup_stats.c b/drivers/base/power/wakeup_stats.c
> > index 308f8bde9..30f0d3d61 100644
> > --- a/drivers/base/power/wakeup_stats.c
> > +++ b/drivers/base/power/wakeup_stats.c
> > @@ -216,4 +216,4 @@ static int __init wakeup_sources_sysfs_init(void)
> >
> >       return PTR_ERR_OR_ZERO(wakeup_class);
> >  }
> > -postcore_initcall(wakeup_sources_sysfs_init);
> > +pure_initcall(wakeup_sources_sysfs_init);
> > --
> > 2.53.0
> >
>
> Wait, if this doesn't need to be change, we shouldn't change it.  Unless
> you have a bug that is being fixed here, don't touch init call levels.
> They are tricky and will come to bite you if you don't watch out.

Well, if this is objectionable, a quite straightforward alternative is
to call wakeup_sources_sysfs_init() directly from pm_init() before
invoking pm_autosleep_init().

That would also indicate an ordering dependency between the two calls.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-06 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-03 16:09 [PATCH] PM / wakeup: Register class wakeup in pure_initcall phase Heiner Kallweit
2026-04-03 17:24 ` Greg Kroah-Hartman
2026-04-06 15:17   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox