Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

driver core: make software nodes available earlier

Software nodes are currently initialized in a function registered as
a postcore_initcall(). However, some devices may want to register
software nodes earlier than that (or also in a postcore_initcall() where
they're at the mercy of the link order). Move the initialization to
driver_init() making swnode available much earlier as well as making
their initialization time deterministic.

Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260402-nokia770-gpio-swnodes-v5-3-d730db3dd299@oss.qualcomm.com
[ Fix typo in the commit message: "s/merci/mercy/". - Danilo ]
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

authored by

Bartosz Golaszewski and committed by
Danilo Krummrich
1cf996ac b3eb6a25

+4 -4
+1
drivers/base/base.h
··· 312 312 static inline int devtmpfs_delete_node(struct device *dev) { return 0; } 313 313 #endif 314 314 315 + void software_node_init(void); 315 316 void software_node_notify(struct device *dev); 316 317 void software_node_notify_remove(struct device *dev); 317 318
+1
drivers/base/init.c
··· 34 34 */ 35 35 faux_bus_init(); 36 36 of_core_init(); 37 + software_node_init(); 37 38 platform_bus_init(); 38 39 auxiliary_bus_init(); 39 40 memory_dev_init();
+2 -4
drivers/base/swnode.c
··· 1127 1127 } 1128 1128 } 1129 1129 1130 - static int __init software_node_init(void) 1130 + void __init software_node_init(void) 1131 1131 { 1132 1132 swnode_kset = kset_create_and_add("software_nodes", NULL, kernel_kobj); 1133 1133 if (!swnode_kset) 1134 - return -ENOMEM; 1135 - return 0; 1134 + pr_err("failed to register software nodes\n"); 1136 1135 } 1137 - postcore_initcall(software_node_init);