Skip to contentSkip to conversation

PM / wakeup: Register class wakeup in pure_initcall phase

PATCH In review Heiner Kallweit 3 participants 3 messages Apr 3 – Apr 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / wakeup: Register class wakeup in pure_initcall phase

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.

---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup_stats.c +1 -1
index 308f8bde9..30f0d3d61 100644
@@ -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);
Signature · 1 line
2.53.0
#1 lore raw
Quoted 26 lines · Heiner Kallweit

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.

---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup_stats.c +1 -1
index 308f8bde9..30f0d3d61 100644
@@ -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);
Signature · 1 line
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

#2 lore raw
Quoted 21 lines · Greg Kroah-Hartman
Quoted 19 lines · Heiner Kallweit

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.

---
 drivers/base/power/wakeup_stats.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/power/wakeup_stats.c +0 -0
index 308f8bde9..30f0d3d61 100644
@@ -216,4 +216,4 @@ static int __init wakeup_sources_sysfs_init(void)
 
Quoted 11 lines
Quoted 7 lines
drivers/base/power/wakeup_stats.c +1 -2
      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.