[PATCH v3 05/14] software node: Add software_node_device_uevent() API

Manivannan Sadhasivam via B4 Relay posted 14 patches 4 weeks, 1 day ago
There is a newer version of this series
[PATCH v3 05/14] software node: Add software_node_device_uevent() API
Posted by Manivannan Sadhasivam via B4 Relay 4 weeks, 1 day ago
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

Add software_node_device_uevent() API to return the uevent variable for
swnode using the DT compatible property. The uevent will have the DT prefix
of "of:N*T*C" to match the DT's module device table.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/base/swnode.c    | 13 +++++++++++++
 include/linux/property.h |  1 +
 2 files changed, 14 insertions(+)

diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
index 4a3b367dea02..c33e09300e5f 100644
--- a/drivers/base/swnode.c
+++ b/drivers/base/swnode.c
@@ -388,6 +388,19 @@ bool software_node_match_device(struct device *dev, const struct device_driver *
 }
 EXPORT_SYMBOL_GPL(software_node_match_device);
 
+int software_node_device_uevent(const struct device *dev, struct kobj_uevent_env *env)
+{
+	const char *compatible;
+	int ret;
+
+	ret = device_property_read_string(dev, "compatible", &compatible);
+	if (ret)
+		return ret;
+
+	return add_uevent_var(env, "MODALIAS=of:N*T*C%s", compatible);
+}
+EXPORT_SYMBOL_GPL(software_node_device_uevent);
+
 /* -------------------------------------------------------------------------- */
 /* fwnode operations */
 
diff --git a/include/linux/property.h b/include/linux/property.h
index 7fe75ab732f6..14f85fd66bfc 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -599,6 +599,7 @@ int software_node_register(const struct software_node *node);
 void software_node_unregister(const struct software_node *node);
 
 bool software_node_match_device(struct device *dev, const struct device_driver *drv);
+int software_node_device_uevent(const struct device *dev, struct kobj_uevent_env *env);
 
 struct fwnode_handle *
 fwnode_create_software_node(const struct property_entry *properties,

-- 
2.48.1
Re: [PATCH v3 05/14] software node: Add software_node_device_uevent() API
Posted by Andy Shevchenko 3 weeks, 6 days ago
On Sat, Jan 10, 2026 at 12:26:23PM +0530, Manivannan Sadhasivam via B4 Relay wrote:

> Add software_node_device_uevent() API to return the uevent variable for
> swnode using the DT compatible property. The uevent will have the DT prefix
> of "of:N*T*C" to match the DT's module device table.

This even sounds wrong.
NAK.

-- 
With Best Regards,
Andy Shevchenko