Commit 1cf996ac authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Danilo Krummrich
Browse files

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: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Acked-by: default avatarAndy 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: default avatarDanilo Krummrich <dakr@kernel.org>
parent b3eb6a25
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -312,6 +312,7 @@ static inline int devtmpfs_create_node(struct device *dev) { return 0; }
static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
#endif

void software_node_init(void);
void software_node_notify(struct device *dev);
void software_node_notify_remove(struct device *dev);

+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ void __init driver_init(void)
	 */
	faux_bus_init();
	of_core_init();
	software_node_init();
	platform_bus_init();
	auxiliary_bus_init();
	memory_dev_init();
+2 −4
Original line number Diff line number Diff line
@@ -1127,11 +1127,9 @@ void software_node_notify_remove(struct device *dev)
	}
}

static int __init software_node_init(void)
void __init software_node_init(void)
{
	swnode_kset = kset_create_and_add("software_nodes", NULL, kernel_kobj);
	if (!swnode_kset)
		return -ENOMEM;
	return 0;
		pr_err("failed to register software nodes\n");
}
postcore_initcall(software_node_init);