* [PATCH] sunxi-rsb: Include OF based modalias in device uevent
@ 2017-11-27 12:17 Stefan Brüns
2017-11-27 15:35 ` Maxime Ripard
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Brüns @ 2017-11-27 12:17 UTC (permalink / raw)
To: linux-arm-kernel
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@vger.kernel.org>
Signed-off-by: Stefan Br?ns <stefan.bruens@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
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH] sunxi-rsb: Include OF based modalias in device uevent 2017-11-27 12:17 [PATCH] sunxi-rsb: Include OF based modalias in device uevent Stefan Brüns @ 2017-11-27 15:35 ` Maxime Ripard 2017-11-27 17:19 ` Stefan Brüns 0 siblings, 1 reply; 4+ messages in thread From: Maxime Ripard @ 2017-11-27 15:35 UTC (permalink / raw) To: linux-arm-kernel Hi, On Mon, Nov 27, 2017 at 01:17:25PM +0100, Stefan Br?ns wrote: > 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@vger.kernel.org> > Signed-off-by: Stefan Br?ns <stefan.bruens@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; A comment explaining why we need to ignore the ENODEV error code would be great here. > + 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, Any reason to not use of_device_uevent_modalias directly here? Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171127/2f550d85/attachment.sig> ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] sunxi-rsb: Include OF based modalias in device uevent 2017-11-27 15:35 ` Maxime Ripard @ 2017-11-27 17:19 ` Stefan Brüns 2017-11-27 17:30 ` Chen-Yu Tsai 0 siblings, 1 reply; 4+ messages in thread From: Stefan Brüns @ 2017-11-27 17:19 UTC (permalink / raw) To: linux-arm-kernel On Monday, November 27, 2017 4:35:02 PM CET Maxime Ripard wrote: > Hi, > > On Mon, Nov 27, 2017 at 01:17:25PM +0100, Stefan Br?ns wrote: > > 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@vger.kernel.org> > > Signed-off-by: Stefan Br?ns <stefan.bruens@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; > > A comment explaining why we need to ignore the ENODEV error code would > be great here. Lazy answer - everyone else is doing the same, and nobody cared to add an explanation. For *some* drivers, this is likely because the same device may be enumerated from e.g ACPI or OF, and for an ACPI device -ENODEV will be returned, as dev->of_node is NULL. For devices which are only usable in an OF context, this is bogus. Not sure about sunxi-rsb. > > + 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, > > Any reason to not use of_device_uevent_modalias directly here? *If* sunxi-rsb can be used without OF, then yes, otherwise no. Regards, Stefan -- Stefan Br?ns / Bergstra?e 21 / 52062 Aachen home: +49 241 53809034 mobile: +49 151 50412019 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: This is a digitally signed message part. URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171127/807caf5a/attachment-0001.sig> ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] sunxi-rsb: Include OF based modalias in device uevent 2017-11-27 17:19 ` Stefan Brüns @ 2017-11-27 17:30 ` Chen-Yu Tsai 0 siblings, 0 replies; 4+ messages in thread From: Chen-Yu Tsai @ 2017-11-27 17:30 UTC (permalink / raw) To: linux-arm-kernel On Tue, Nov 28, 2017 at 1:19 AM, Stefan Br?ns <stefan.bruens@rwth-aachen.de> wrote: > On Monday, November 27, 2017 4:35:02 PM CET Maxime Ripard wrote: >> Hi, >> >> On Mon, Nov 27, 2017 at 01:17:25PM +0100, Stefan Br?ns wrote: >> > 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@vger.kernel.org> >> > Signed-off-by: Stefan Br?ns <stefan.bruens@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; >> >> A comment explaining why we need to ignore the ENODEV error code would >> be great here. > > Lazy answer - everyone else is doing the same, and nobody cared to add an > explanation. > > For *some* drivers, this is likely because the same device may be enumerated > from e.g ACPI or OF, and for an ACPI device -ENODEV will be returned, as > dev->of_node is NULL. > > For devices which are only usable in an OF context, this is bogus. Not sure > about sunxi-rsb. sunxi-rsb (and Allwinner support in mainline in general) is OF only. With the exception of mfd sub-devices, if someone is enumerating devices in some other fashion, it should rightly blow up in their face. >> > + 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, >> >> Any reason to not use of_device_uevent_modalias directly here? > > *If* sunxi-rsb can be used without OF, then yes, otherwise no. You can just use of_device_uevent_modalias, like the other OF platforms. ChenYu ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-11-27 17:30 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-11-27 12:17 [PATCH] sunxi-rsb: Include OF based modalias in device uevent Stefan Brüns 2017-11-27 15:35 ` Maxime Ripard 2017-11-27 17:19 ` Stefan Brüns 2017-11-27 17:30 ` Chen-Yu Tsai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).