Message ID | 20210525091003.18228-1-m.felsch@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 3ce6c9e2617ebc09b2d55cc88134b90c19ff6d31 |
Headers | show |
Series | [v1] spi: add of_device_uevent_modalias support | expand |
On Tue, May 25, 2021 at 11:10:03AM +0200, Marco Felsch wrote: > Add OF support as already done for ACPI to take driver > MODULE_DEVICE_TABLE(of, ..) into account. > > For example with this change a spi nor device MODALIAS changes from: > > MODALIAS=spi:spi-nor > > to > > MODALIAS=of:Nspi-flashT(null)Cjedec,spi-nor Will this break existing userspace?
On 21-06-04 16:45, Mark Brown wrote: > On Tue, May 25, 2021 at 11:10:03AM +0200, Marco Felsch wrote: > > Add OF support as already done for ACPI to take driver > > MODULE_DEVICE_TABLE(of, ..) into account. > > > > For example with this change a spi nor device MODALIAS changes from: > > > > MODALIAS=spi:spi-nor > > > > to > > > > MODALIAS=of:Nspi-flashT(null)Cjedec,spi-nor > > Will this break existing userspace? No, if I understood the mechanism correctly. The MODULE_DEVICE_TABLE(of, ..) and the MODULE_DEVICE_TABLE(spi, ..) should equal except for the "vendor," prefix used by the MODULE_DEVICE_TABLE(of, ..). If a driver don't support MODULE_DEVICE_TABLE(of, ..) we fallback to the MODULE_DEVICE_TABLE(spi, ..). I would instead say that it fixes at least the spi-nor usage e.g. spi-nor@0 { compatible = "vendor,product", "jedec,spi-nor"; } is a common OF usage: the compatible list goes from the exact compatible to the least common compatible. Here I should fix my commit message which should include this line: "MODALIAS=of:Nspi-flashT(null)Cwinbond,w25q16dwCjedec,spi-nor". Anyway this scenario don't work for spi-nor driver since the spi-core only take the MODULE_DEVICE_TABLE(spi, ..) into account. So the compatible must not include the "vendor,product" compatible. With my change in place we can specify the 'complete' compatible list. Regards, Marco
On Tue, 25 May 2021 11:10:03 +0200, Marco Felsch wrote: > Add OF support as already done for ACPI to take driver > MODULE_DEVICE_TABLE(of, ..) into account. > > For example with this change a spi nor device MODALIAS changes from: > > MODALIAS=spi:spi-nor > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: add of_device_uevent_modalias support commit: 3ce6c9e2617ebc09b2d55cc88134b90c19ff6d31 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 0cab239d8e7f..82078226c460 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -367,6 +367,10 @@ static int spi_uevent(struct device *dev, struct kobj_uevent_env *env) const struct spi_device *spi = to_spi_device(dev); int rc; + rc = of_device_uevent_modalias(dev, env); + if (rc != -ENODEV) + return rc; + rc = acpi_device_uevent_modalias(dev, env); if (rc != -ENODEV) return rc;
Add OF support as already done for ACPI to take driver MODULE_DEVICE_TABLE(of, ..) into account. For example with this change a spi nor device MODALIAS changes from: MODALIAS=spi:spi-nor to MODALIAS=of:Nspi-flashT(null)Cjedec,spi-nor Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> --- drivers/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+)