Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: proximity: isl29501: fix unused of_device_id table
@ 2024-03-08 18:07 Ben Dooks
  2024-03-09 17:35 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2024-03-08 18:07 UTC (permalink / raw)
  To: linux-iio; +Cc: lars, jic23, Ben Dooks

Under certain build conditions, the following warning is being generated
from the isl29501 driver due to OF being configured but the driver being
built in.

drivers/iio/proximity/isl29501.c:999:34: warning: ‘isl29501_i2c_matches’ defined but not used [-Wunused-const-variable=]
  999 | static const struct of_device_id isl29501_i2c_matches[] = {

The isl29501_i2c_matches[] is only passed to MODULE_DEVICE_TABLE() and thus is
not referenced if the driver is built into the kernel. Fix by adding a check
for MODULE around the #if block.

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 drivers/iio/proximity/isl29501.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
index bcebacaf3dab..d509227f47b7 100644
--- a/drivers/iio/proximity/isl29501.c
+++ b/drivers/iio/proximity/isl29501.c
@@ -995,7 +995,7 @@ static const struct i2c_device_id isl29501_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, isl29501_id);
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_OF) && defined(MODULE)
 static const struct of_device_id isl29501_i2c_matches[] = {
 	{ .compatible = "renesas,isl29501" },
 	{ }
-- 
2.37.2.352.g3c44437643


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: proximity: isl29501: fix unused of_device_id table
  2024-03-08 18:07 [PATCH] iio: proximity: isl29501: fix unused of_device_id table Ben Dooks
@ 2024-03-09 17:35 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-03-09 17:35 UTC (permalink / raw)
  To: Ben Dooks; +Cc: linux-iio, lars

On Fri,  8 Mar 2024 18:07:18 +0000
Ben Dooks <ben.dooks@codethink.co.uk> wrote:

> Under certain build conditions, the following warning is being generated
> from the isl29501 driver due to OF being configured but the driver being
> built in.
> 
> drivers/iio/proximity/isl29501.c:999:34: warning: ‘isl29501_i2c_matches’ defined but not used [-Wunused-const-variable=]
>   999 | static const struct of_device_id isl29501_i2c_matches[] = {
> 
> The isl29501_i2c_matches[] is only passed to MODULE_DEVICE_TABLE() and thus is
> not referenced if the driver is built into the kernel. Fix by adding a check
> for MODULE around the #if block.
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Hi Ben,

Already applied a different fix for this which is to allow matching via the
table.

Thanks

Jonathan
> ---
>  drivers/iio/proximity/isl29501.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/proximity/isl29501.c b/drivers/iio/proximity/isl29501.c
> index bcebacaf3dab..d509227f47b7 100644
> --- a/drivers/iio/proximity/isl29501.c
> +++ b/drivers/iio/proximity/isl29501.c
> @@ -995,7 +995,7 @@ static const struct i2c_device_id isl29501_id[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, isl29501_id);
>  
> -#if defined(CONFIG_OF)
> +#if defined(CONFIG_OF) && defined(MODULE)
>  static const struct of_device_id isl29501_i2c_matches[] = {
>  	{ .compatible = "renesas,isl29501" },
>  	{ }


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-09 17:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 18:07 [PATCH] iio: proximity: isl29501: fix unused of_device_id table Ben Dooks
2024-03-09 17:35 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox