* [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
@ 2024-04-03 8:06 ` Arnd Bergmann
2024-04-03 9:36 ` Andy Shevchenko
2024-04-03 9:55 ` Krzysztof Kozlowski
2024-04-06 5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Arnd Bergmann @ 2024-04-03 8:06 UTC (permalink / raw)
To: linux-kernel, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron
Cc: Arnd Bergmann, linux-iio
From: Arnd Bergmann <arnd@arndb.de>
When the driver is built-in, 'make W=1' warns about an unused
ID table:
drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
866 | static const struct of_device_id ad5755_of_match[] = {
While the data is duplicated in the spi_device_id, it's common
to use the actual OF compatible strings in the driver.
Since there are no in-tree users of plain platform devices, the
spi_device_id table could actually be dropped entirely with this.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/iio/dac/ad5755.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index 404865e35460..5c1e7f428c25 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);
static struct spi_driver ad5755_driver = {
.driver = {
.name = "ad5755",
+ .of_match_table = ad5755_of_match,
},
.probe = ad5755_probe,
.id_table = ad5755_id,
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
@ 2024-04-03 9:36 ` Andy Shevchenko
2024-04-03 9:55 ` Krzysztof Kozlowski
1 sibling, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2024-04-03 9:36 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-kernel, Lars-Peter Clausen, Michael Hennerich,
Jonathan Cameron, Arnd Bergmann, linux-iio
On Wed, Apr 03, 2024 at 10:06:34AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When the driver is built-in, 'make W=1' warns about an unused
> ID table:
>
> drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
> 866 | static const struct of_device_id ad5755_of_match[] = {
>
> While the data is duplicated in the spi_device_id, it's common
> to use the actual OF compatible strings in the driver.
>
> Since there are no in-tree users of plain platform devices, the
> spi_device_id table could actually be dropped entirely with this.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
2024-04-03 9:36 ` Andy Shevchenko
@ 2024-04-03 9:55 ` Krzysztof Kozlowski
2024-04-03 10:01 ` Arnd Bergmann
2024-04-06 15:31 ` Jonathan Cameron
1 sibling, 2 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2024-04-03 9:55 UTC (permalink / raw)
To: Arnd Bergmann, linux-kernel, Lars-Peter Clausen,
Michael Hennerich, Jonathan Cameron
Cc: Arnd Bergmann, linux-iio
On 03/04/2024 10:06, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> When the driver is built-in, 'make W=1' warns about an unused
> ID table:
>
> drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
> 866 | static const struct of_device_id ad5755_of_match[] = {
>
> While the data is duplicated in the spi_device_id, it's common
> to use the actual OF compatible strings in the driver.
>
> Since there are no in-tree users of plain platform devices, the
> spi_device_id table could actually be dropped entirely with this.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/iio/dac/ad5755.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> index 404865e35460..5c1e7f428c25 100644
> --- a/drivers/iio/dac/ad5755.c
> +++ b/drivers/iio/dac/ad5755.c
> @@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);
> static struct spi_driver ad5755_driver = {
> .driver = {
> .name = "ad5755",
> + .of_match_table = ad5755_of_match,
I was working on this as well and have a bit bigger solution, following
Jonathan's preference (I think):
https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
I need to send v3, somehow I missed his comments.
Jonathan,
Do you want me to still work on this according to your comments (which I
missed, I am sorry).
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 9:55 ` Krzysztof Kozlowski
@ 2024-04-03 10:01 ` Arnd Bergmann
2024-04-06 15:30 ` Jonathan Cameron
2024-04-06 15:31 ` Jonathan Cameron
1 sibling, 1 reply; 10+ messages in thread
From: Arnd Bergmann @ 2024-04-03 10:01 UTC (permalink / raw)
To: Krzysztof Kozlowski, Arnd Bergmann, linux-kernel,
Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron
Cc: linux-iio
On Wed, Apr 3, 2024, at 11:55, Krzysztof Kozlowski wrote:
> On 03/04/2024 10:06, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> When the driver is built-in, 'make W=1' warns about an unused
>> ID table:
>>
>> drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
>> 866 | static const struct of_device_id ad5755_of_match[] = {
>>
>> While the data is duplicated in the spi_device_id, it's common
>> to use the actual OF compatible strings in the driver.
>>
>> Since there are no in-tree users of plain platform devices, the
>> spi_device_id table could actually be dropped entirely with this.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/iio/dac/ad5755.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
>> index 404865e35460..5c1e7f428c25 100644
>> --- a/drivers/iio/dac/ad5755.c
>> +++ b/drivers/iio/dac/ad5755.c
>> @@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);
>> static struct spi_driver ad5755_driver = {
>> .driver = {
>> .name = "ad5755",
>> + .of_match_table = ad5755_of_match,
>
> I was working on this as well and have a bit bigger solution, following
> Jonathan's preference (I think):
>
> https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
>
> I need to send v3, somehow I missed his comments.
Yes, that looks good as well, though you might need to drop
spi_device_id table if you convert it to using pointers.
Arnd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 10:01 ` Arnd Bergmann
@ 2024-04-06 15:30 ` Jonathan Cameron
0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2024-04-06 15:30 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Krzysztof Kozlowski, Arnd Bergmann, linux-kernel,
Lars-Peter Clausen, Michael Hennerich, linux-iio
On Wed, 03 Apr 2024 12:01:13 +0200
"Arnd Bergmann" <arnd@arndb.de> wrote:
> On Wed, Apr 3, 2024, at 11:55, Krzysztof Kozlowski wrote:
> > On 03/04/2024 10:06, Arnd Bergmann wrote:
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> When the driver is built-in, 'make W=1' warns about an unused
> >> ID table:
> >>
> >> drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
> >> 866 | static const struct of_device_id ad5755_of_match[] = {
> >>
> >> While the data is duplicated in the spi_device_id, it's common
> >> to use the actual OF compatible strings in the driver.
> >>
> >> Since there are no in-tree users of plain platform devices, the
> >> spi_device_id table could actually be dropped entirely with this.
> >>
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> ---
> >> drivers/iio/dac/ad5755.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> >> index 404865e35460..5c1e7f428c25 100644
> >> --- a/drivers/iio/dac/ad5755.c
> >> +++ b/drivers/iio/dac/ad5755.c
> >> @@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);
> >> static struct spi_driver ad5755_driver = {
> >> .driver = {
> >> .name = "ad5755",
> >> + .of_match_table = ad5755_of_match,
> >
> > I was working on this as well and have a bit bigger solution, following
> > Jonathan's preference (I think):
> >
> > https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
> >
> > I need to send v3, somehow I missed his comments.
>
> Yes, that looks good as well, though you might need to drop
> spi_device_id table if you convert it to using pointers.
Put them in there as well (with appropriate cast). We don't want
to stop supporting probe paths that might be using that.
My preference is for both tables, same pointers in each then
the use of the relevant bus specific wrapper - here
spi_get_device_match_data() which will happily deal with matches
in either table (thus avoiding the potential mess of them getting out
of sync)
Jonathan
>
> Arnd
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver
2024-04-03 9:55 ` Krzysztof Kozlowski
2024-04-03 10:01 ` Arnd Bergmann
@ 2024-04-06 15:31 ` Jonathan Cameron
1 sibling, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2024-04-06 15:31 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Arnd Bergmann, linux-kernel, Lars-Peter Clausen,
Michael Hennerich, Arnd Bergmann, linux-iio
On Wed, 3 Apr 2024 11:55:06 +0200
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:
> On 03/04/2024 10:06, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > When the driver is built-in, 'make W=1' warns about an unused
> > ID table:
> >
> > drivers/iio/dac/ad5755.c:866:34: error: 'ad5755_of_match' defined but not used [-Werror=unused-const-variable=]
> > 866 | static const struct of_device_id ad5755_of_match[] = {
> >
> > While the data is duplicated in the spi_device_id, it's common
> > to use the actual OF compatible strings in the driver.
> >
> > Since there are no in-tree users of plain platform devices, the
> > spi_device_id table could actually be dropped entirely with this.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
> > drivers/iio/dac/ad5755.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
> > index 404865e35460..5c1e7f428c25 100644
> > --- a/drivers/iio/dac/ad5755.c
> > +++ b/drivers/iio/dac/ad5755.c
> > @@ -876,6 +876,7 @@ MODULE_DEVICE_TABLE(of, ad5755_of_match);
> > static struct spi_driver ad5755_driver = {
> > .driver = {
> > .name = "ad5755",
> > + .of_match_table = ad5755_of_match,
>
> I was working on this as well and have a bit bigger solution, following
> Jonathan's preference (I think):
>
> https://lore.kernel.org/all/20240226192555.14aa178e@jic23-huawei/
>
> I need to send v3, somehow I missed his comments.
>
> Jonathan,
> Do you want me to still work on this according to your comments (which I
> missed, I am sorry).
No problem on missing the reply! (I'd forgotten all about this!)
I would prefer that solution to this one that relies on the two
tables having equivalent entries. So I'll not pick up this patch.
Thanks,
Jonathan
>
> Best regards,
> Krzysztof
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 00/34] address all -Wunused-const warnings
2024-04-03 8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
2024-04-03 8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
@ 2024-04-06 5:20 ` patchwork-bot+netdevbpf
2024-04-10 8:02 ` (subset) " Sebastian Reichel
2024-04-22 8:16 ` Michael Ellerman
3 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-04-06 5:20 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-kernel, arnd, mpe, christophe.leroy, dlemoal, jikos,
gregkh, minyard, peterhuewe, jarkko, kristo, sboyd, abbotti,
hsweeten, srinivas.pandruvada, lenb, rafael, john.allen, herbert,
vkoul, ardb, andersson, mdf, liviu.dudau, benjamin.tissoires,
andi.shyti, michael.hennerich, peda, lars, jic23,
dmitry.torokhov, markuss.broks, alexandre.torgue, lee, kuba,
Shyam-sundar.S-k, iyappan, yisen.zhuang, stf_xl, kvalo, sre,
tony, broonie, alexandre.belloni, chenxiang66, martin.petersen,
neil.armstrong, heiko, krzysztof.kozlowski, hvaibhav.linux,
elder, jirislaby, ychuang3, deller, hch, robin.murphy, rostedt,
mhiramat, akpm, keescook, trond.myklebust, anna, masahiroy,
nathan, tiwai, linuxppc-dev, linux-ide, openipmi-developer,
linux-integrity, linux-omap, linux-clk, linux-pm, linux-crypto,
dmaengine, linux-efi, linux-arm-msm, linux-fpga, dri-devel,
linux-input, linux-i2c, linux-iio, linux-stm32, linux-arm-kernel,
netdev, linux-leds, linux-wireless, linux-rtc, linux-scsi,
linux-spi, linux-amlogic, linux-rockchip, linux-samsung-soc,
greybus-dev, linux-staging, linux-serial, linux-usb, linux-fbdev,
iommu, linux-trace-kernel, kasan-dev, linux-hardening, linux-nfs,
linux-kbuild, alsa-devel, linux-sound
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 3 Apr 2024 10:06:18 +0200 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Compilers traditionally warn for unused 'static' variables, but not
> if they are constant. The reason here is a custom for C++ programmers
> to define named constants as 'static const' variables in header files
> instead of using macros or enums.
>
> [...]
Here is the summary with links:
- [05/34] 3c515: remove unused 'mtu' variable
https://git.kernel.org/netdev/net-next/c/17b35355c2c6
- [19/34] sunrpc: suppress warnings for unused procfs functions
(no matching commit)
- [26/34] isdn: kcapi: don't build unused procfs code
https://git.kernel.org/netdev/net-next/c/91188544af06
- [28/34] net: xgbe: remove extraneous #ifdef checks
https://git.kernel.org/netdev/net-next/c/0ef416e045ad
- [33/34] drivers: remove incorrect of_match_ptr/ACPI_PTR annotations
(no matching commit)
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH 00/34] address all -Wunused-const warnings
2024-04-03 8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
2024-04-03 8:06 ` [PATCH 16/34] iio: ad5755: hook up of_device_id lookup to platform driver Arnd Bergmann
2024-04-06 5:20 ` [PATCH 00/34] address all -Wunused-const warnings patchwork-bot+netdevbpf
@ 2024-04-10 8:02 ` Sebastian Reichel
2024-04-22 8:16 ` Michael Ellerman
3 siblings, 0 replies; 10+ messages in thread
From: Sebastian Reichel @ 2024-04-10 8:02 UTC (permalink / raw)
To: linux-kernel, Arnd Bergmann
Cc: Arnd Bergmann, Michael Ellerman, Christophe Leroy,
Damien Le Moal, Jiri Kosina, Greg Kroah-Hartman, Corey Minyard,
Peter Huewe, Jarkko Sakkinen, Tero Kristo, Stephen Boyd,
Ian Abbott, H Hartley Sweeten, Srinivas Pandruvada, Len Brown,
Rafael J. Wysocki, John Allen, Herbert Xu, Vinod Koul,
Ard Biesheuvel, Bjorn Andersson, Moritz Fischer, Liviu Dudau,
Benjamin Tissoires, Andi Shyti, Michael Hennerich, Peter Rosin,
Lars-Peter Clausen, Jonathan Cameron, Dmitry Torokhov,
Markuss Broks, Alexandre Torgue, Lee Jones, Jakub Kicinski,
Shyam Sundar S K, Iyappan Subramanian, Yisen Zhuang,
Stanislaw Gruszka, Kalle Valo, Sebastian Reichel, Tony Lindgren,
Mark Brown, Alexandre Belloni, Xiang Chen, Martin K. Petersen,
Neil Armstrong, Heiko Stuebner, Krzysztof Kozlowski,
Vaibhav Hiremath, Alex Elder, Jiri Slaby, Jacky Huang,
Helge Deller, Christoph Hellwig, Robin Murphy, Steven Rostedt,
Masami Hiramatsu, Andrew Morton, Kees Cook, Trond Myklebust,
Anna Schumaker, Masahiro Yamada, Nathan Chancellor, Takashi Iwai,
linuxppc-dev, linux-ide, openipmi-developer, linux-integrity,
linux-omap, linux-clk, linux-pm, linux-crypto, dmaengine,
linux-efi, linux-arm-msm, linux-fpga, dri-devel, linux-input,
linux-i2c, linux-iio, linux-stm32, linux-arm-kernel, netdev,
linux-leds, linux-wireless, linux-rtc, linux-scsi, linux-spi,
linux-amlogic, linux-rockchip, linux-samsung-soc, greybus-dev,
linux-staging, linux-serial, linux-usb, linux-fbdev, iommu,
linux-trace-kernel, kasan-dev, linux-hardening, linux-nfs,
linux-kbuild, alsa-devel, linux-sound
On Wed, 03 Apr 2024 10:06:18 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Compilers traditionally warn for unused 'static' variables, but not
> if they are constant. The reason here is a custom for C++ programmers
> to define named constants as 'static const' variables in header files
> instead of using macros or enums.
>
> [...]
Applied, thanks!
[09/34] power: rt9455: hide unused rt9455_boost_voltage_values
commit: 452d8950db3e839aba1bb13bc5378f4bac11fa04
Best regards,
--
Sebastian Reichel <sebastian.reichel@collabora.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: (subset) [PATCH 00/34] address all -Wunused-const warnings
2024-04-03 8:06 [PATCH 00/34] address all -Wunused-const warnings Arnd Bergmann
` (2 preceding siblings ...)
2024-04-10 8:02 ` (subset) " Sebastian Reichel
@ 2024-04-22 8:16 ` Michael Ellerman
3 siblings, 0 replies; 10+ messages in thread
From: Michael Ellerman @ 2024-04-22 8:16 UTC (permalink / raw)
To: linux-kernel, Arnd Bergmann
Cc: Arnd Bergmann, Michael Ellerman, Christophe Leroy,
Damien Le Moal, Jiri Kosina, Greg Kroah-Hartman, Corey Minyard,
Peter Huewe, Jarkko Sakkinen, Tero Kristo, Stephen Boyd,
Ian Abbott, H Hartley Sweeten, Srinivas Pandruvada, Len Brown,
Rafael J. Wysocki, John Allen, Herbert Xu, Vinod Koul,
Ard Biesheuvel, Bjorn Andersson, Moritz Fischer, Liviu Dudau,
Benjamin Tissoires, Andi Shyti, Michael Hennerich
On Wed, 03 Apr 2024 10:06:18 +0200, Arnd Bergmann wrote:
> Compilers traditionally warn for unused 'static' variables, but not
> if they are constant. The reason here is a custom for C++ programmers
> to define named constants as 'static const' variables in header files
> instead of using macros or enums.
>
> In W=1 builds, we get warnings only static const variables in C
> files, but not in headers, which is a good compromise, but this still
> produces warning output in at least 30 files. These warnings are
> almost all harmless, but also trivial to fix, and there is no
> good reason to warn only about the non-const variables being unused.
>
> [...]
Applied to powerpc/next.
[01/34] powerpc/fsl-soc: hide unused const variable
https://git.kernel.org/powerpc/c/01acaf3aa75e1641442cc23d8fe0a7bb4226efb1
cheers
^ permalink raw reply [flat|nested] 10+ messages in thread