[PATCH] sunxi-rsb: Include OF based modalias in device uevent

Stefan Brüns stefan.bruens at rwth-aachen.de
Mon Nov 27 04:17:25 PST 2017


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

Fixes a regression caused by commit 3f241bfa60bd ("arm64: allwinner: a64:
pine64: Use dcdc1 regulator for mmc0"). When the axp20x-rsb module for
the AXP803 PMIC is built as a module, it is not loaded and the system
ends up with an disfunctional MMC controller.

Cc: stable <stable at vger.kernel.org>
Signed-off-by: Stefan Brüns <stefan.bruens at rwth-aachen.de>
---
 drivers/bus/sunxi-rsb.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/bus/sunxi-rsb.c b/drivers/bus/sunxi-rsb.c
index 328ca93781cf..37cb57244cbe 100644
--- a/drivers/bus/sunxi-rsb.c
+++ b/drivers/bus/sunxi-rsb.c
@@ -173,11 +173,24 @@ static int sunxi_rsb_device_remove(struct device *dev)
 	return drv->remove(to_sunxi_rsb_device(dev));
 }
 
+static int sunxi_rsb_device_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 sunxi_rsb_bus = {
 	.name		= RSB_CTRL_NAME,
 	.match		= sunxi_rsb_device_match,
 	.probe		= sunxi_rsb_device_probe,
 	.remove		= sunxi_rsb_device_remove,
+	.uevent		= sunxi_rsb_device_uevent,
 };
 
 static void sunxi_rsb_dev_release(struct device *dev)
-- 
2.15.0




More information about the linux-arm-kernel mailing list