* [PATCH v1] spi: add of_device_uevent_modalias support
@ 2021-05-25 9:10 Marco Felsch
2021-06-04 15:45 ` Mark Brown
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Marco Felsch @ 2021-05-25 9:10 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, kernel
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(+)
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;
--
2.29.2
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v1] spi: add of_device_uevent_modalias support 2021-05-25 9:10 [PATCH v1] spi: add of_device_uevent_modalias support Marco Felsch @ 2021-06-04 15:45 ` Mark Brown 2021-06-09 8:07 ` Marco Felsch 2021-06-15 12:06 ` Mark Brown 2021-07-22 13:48 ` [PATCH] spi: update modalias_show after " Andreas Schwab 2 siblings, 1 reply; 7+ messages in thread From: Mark Brown @ 2021-06-04 15:45 UTC (permalink / raw) To: Marco Felsch; +Cc: linux-spi, kernel [-- Attachment #1: Type: text/plain, Size: 370 bytes --] 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? [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] spi: add of_device_uevent_modalias support 2021-06-04 15:45 ` Mark Brown @ 2021-06-09 8:07 ` Marco Felsch 0 siblings, 0 replies; 7+ messages in thread From: Marco Felsch @ 2021-06-09 8:07 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, kernel 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 -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1] spi: add of_device_uevent_modalias support 2021-05-25 9:10 [PATCH v1] spi: add of_device_uevent_modalias support Marco Felsch 2021-06-04 15:45 ` Mark Brown @ 2021-06-15 12:06 ` Mark Brown 2021-07-22 13:48 ` [PATCH] spi: update modalias_show after " Andreas Schwab 2 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2021-06-15 12:06 UTC (permalink / raw) To: Marco Felsch; +Cc: Mark Brown, kernel, linux-spi 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] spi: update modalias_show after of_device_uevent_modalias support 2021-05-25 9:10 [PATCH v1] spi: add of_device_uevent_modalias support Marco Felsch 2021-06-04 15:45 ` Mark Brown 2021-06-15 12:06 ` Mark Brown @ 2021-07-22 13:48 ` Andreas Schwab 2021-07-22 14:06 ` Mark Brown 2021-07-22 17:09 ` Mark Brown 2 siblings, 2 replies; 7+ messages in thread From: Andreas Schwab @ 2021-07-22 13:48 UTC (permalink / raw) To: Marco Felsch; +Cc: broonie, linux-spi, kernel, linux-kernel Commit 3ce6c9e2617e ("spi: add of_device_uevent_modalias support") is incomplete, as it didn't update the modalias_show function to generate the of: modalias string if available. Fixes: 3ce6c9e2617e ("spi: add of_device_uevent_modalias support") Signed-off-by: Andreas Schwab <schwab@suse.de> --- drivers/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c99181165321..e4dc593b1f32 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -58,6 +58,10 @@ modalias_show(struct device *dev, struct device_attribute *a, char *buf) const struct spi_device *spi = to_spi_device(dev); int len; + len = of_device_modalias(dev, buf, PAGE_SIZE); + if (len != -ENODEV) + return len; + len = acpi_device_modalias(dev, buf, PAGE_SIZE - 1); if (len != -ENODEV) return len; -- 2.32.0 -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different." ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] spi: update modalias_show after of_device_uevent_modalias support 2021-07-22 13:48 ` [PATCH] spi: update modalias_show after " Andreas Schwab @ 2021-07-22 14:06 ` Mark Brown 2021-07-22 17:09 ` Mark Brown 1 sibling, 0 replies; 7+ messages in thread From: Mark Brown @ 2021-07-22 14:06 UTC (permalink / raw) To: Andreas Schwab; +Cc: Marco Felsch, linux-spi, kernel, linux-kernel [-- Attachment #1: Type: text/plain, Size: 537 bytes --] On Thu, Jul 22, 2021 at 03:48:45PM +0200, Andreas Schwab wrote: > Commit 3ce6c9e2617e ("spi: add of_device_uevent_modalias support") is > incomplete, as it didn't update the modalias_show function to generate the > of: modalias string if available. Please don't send new patches in reply to old patches or serieses, this makes it harder for both people and tools to understand what is going on - it can bury things in mailboxes and make it difficult to keep track of what current patches are, both for the new patches and the old ones. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] spi: update modalias_show after of_device_uevent_modalias support 2021-07-22 13:48 ` [PATCH] spi: update modalias_show after " Andreas Schwab 2021-07-22 14:06 ` Mark Brown @ 2021-07-22 17:09 ` Mark Brown 1 sibling, 0 replies; 7+ messages in thread From: Mark Brown @ 2021-07-22 17:09 UTC (permalink / raw) To: Marco Felsch, Andreas Schwab; +Cc: Mark Brown, kernel, linux-spi, linux-kernel On Thu, 22 Jul 2021 15:48:45 +0200, Andreas Schwab wrote: > Commit 3ce6c9e2617e ("spi: add of_device_uevent_modalias support") is > incomplete, as it didn't update the modalias_show function to generate the > of: modalias string if available. Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/1] spi: update modalias_show after of_device_uevent_modalias support commit: e09f2ab8eecc6dcbd7013a1303cbe56b00dc9fb0 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-07-22 17:10 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-05-25 9:10 [PATCH v1] spi: add of_device_uevent_modalias support Marco Felsch 2021-06-04 15:45 ` Mark Brown 2021-06-09 8:07 ` Marco Felsch 2021-06-15 12:06 ` Mark Brown 2021-07-22 13:48 ` [PATCH] spi: update modalias_show after " Andreas Schwab 2021-07-22 14:06 ` Mark Brown 2021-07-22 17:09 ` Mark Brown
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).