Skip to contentSkip to conversation

spmi: Include OF based modalias in device uevent

PATCH RESEND In review Bjorn Andersson 2 participants 2 messages Jun 29, 2017

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

PATCH RESEND 1/1 spmi: Include OF based modalias in device uevent

Include the OF-based modalias in the uevent sent when registering SPMI devices, so that user space has a chance to autoload the kernel module for the device.

---

Resend to collect Rob's T-b and Stephen's R-b, and add Greg as recipient.

 drivers/spmi/spmi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/spmi/spmi.c +12 -0
index 2b9b0941d9eb..6d23226e5f69 100644
@@ -365,11 +365,23 @@ static int spmi_drv_remove(struct device *dev)
 	return 0;
 }
 
+static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+	int ret;
+
+	ret = of_device_uevent_modalias(dev, env);
+	if (ret != -ENODEV)
+		return ret;
+
+	return 0;
+}
+
 static struct bus_type spmi_bus_type = {
 	.name		= "spmi",
 	.match		= spmi_device_match,
 	.probe		= spmi_drv_probe,
 	.remove		= spmi_drv_remove,
+	.uevent		= spmi_drv_uevent,
 };
 
 /**
Signature · 1 line
2.12.0
#1 lore raw
Quoted 8 lines · Bjorn Andersson

Include the OF-based modalias in the uevent sent when registering SPMI devices, so that user space has a chance to autoload the kernel module for the device.

And probably make sense to:

Quoted 38 lines

---

Resend to collect Rob's T-b and Stephen's R-b, and add Greg as recipient.

 drivers/spmi/spmi.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/spmi/spmi.c +12 -1
index 2b9b0941d9eb..6d23226e5f69 100644
@@ -365,11 +365,23 @@ static int spmi_drv_remove(struct device *dev)
        return 0;
 }
 
+static int spmi_drv_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+       int ret;
+
+       ret = of_device_uevent_modalias(dev, env);
+       if (ret != -ENODEV)
+               return ret;
+
+       return 0;
+}
+
 static struct bus_type spmi_bus_type = {
        .name           = "spmi",
        .match          = spmi_device_match,
        .probe          = spmi_drv_probe,
        .remove         = spmi_drv_remove,
+       .uevent         = spmi_drv_uevent,
 };
 
 /**
--

2.12.0