Linux IIO development
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: linux-iio@vger.kernel.org
Cc: lars@metafoo.de, jic23@kernel.org, Ben Dooks <ben.dooks@codethink.co.uk>
Subject: [PATCH] iio: proximity: isl29501: fix unused of_device_id table
Date: Fri,  8 Mar 2024 18:07:18 +0000	[thread overview]
Message-ID: <20240308180718.1913090-1-ben.dooks@codethink.co.uk> (raw)

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


             reply	other threads:[~2024-03-08 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-08 18:07 Ben Dooks [this message]
2024-03-09 17:35 ` [PATCH] iio: proximity: isl29501: fix unused of_device_id table Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308180718.1913090-1-ben.dooks@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox