iio: proximity: isl29501: fix unused of_device_id table
PATCH 1/1 iio: proximity: isl29501: fix unused of_device_id table
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.
--- drivers/iio/proximity/isl29501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/isl29501.c +1 -1
@@ -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" }, { }
Signature · 1 line
2.37.2.352.g3c44437643
Jonathan Cameron
maintainerQuoted 4 lines · On Fri, 8 Mar 2024 18:07:18 +0000 Ben Dooks <[email protected]> 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.
Quoted 8 lines
drivers/iio/proximity/isl29501.c:999:34: warning: ‘isl29501_i2c_matches’ defined but not used [-Wunused-const-variable=]
999 | static const structof_device_idisl29501_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 <[email protected]>
Hi Ben,
Already applied a different fix for this which is to allow matching via the table.
Thanks
Jonathan
Quoted 17 lines
--- drivers/iio/proximity/isl29501.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/proximity/isl29501.c +1
-1@@ -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" }, { }