linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: wdt87xx_i2c - fix compiler warning
@ 2025-01-19  8:43 Yu-Chun Lin
  2025-01-22 18:40 ` Dmitry Torokhov
  2025-02-25  7:25 ` Andy Shevchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Yu-Chun Lin @ 2025-01-19  8:43 UTC (permalink / raw)
  To: dmitry.torokhov
  Cc: linux-input, linux-kernel, jserv, visitorckw, Yu-Chun Lin,
	kernel test robot

As reported by the kernel test robot, the following warning occur:

>> drivers/input/touchscreen/wdt87xx_i2c.c:1166:36: warning: 'wdt87xx_acpi_id' defined but not used [-Wunused-const-variable=]
    1166 | static const struct acpi_device_id wdt87xx_acpi_id[] = {
         |                                    ^~~~~~~~~~~~~~~

The 'wdt87xx_acpi_id' array is only used when CONFIG_ACPI is enabled.
Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_ACPI'
prevents a compiler warning when ACPI is disabled.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501181549.uzdlBwuN-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
---
 drivers/input/touchscreen/wdt87xx_i2c.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 27941245e962..88d376090e6e 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -1153,11 +1153,13 @@ static const struct i2c_device_id wdt87xx_dev_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, wdt87xx_dev_id);
 
+#ifdef CONFIG_ACPI
 static const struct acpi_device_id wdt87xx_acpi_id[] = {
 	{ "WDHT0001", 0 },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id);
+#endif
 
 static struct i2c_driver wdt87xx_driver = {
 	.probe		= wdt87xx_ts_probe,
-- 
2.43.0


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

* Re: [PATCH] Input: wdt87xx_i2c - fix compiler warning
  2025-01-19  8:43 [PATCH] Input: wdt87xx_i2c - fix compiler warning Yu-Chun Lin
@ 2025-01-22 18:40 ` Dmitry Torokhov
  2025-02-25  7:25 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2025-01-22 18:40 UTC (permalink / raw)
  To: Yu-Chun Lin
  Cc: linux-input, linux-kernel, jserv, visitorckw, kernel test robot

On Sun, Jan 19, 2025 at 04:43:12PM +0800, Yu-Chun Lin wrote:
> As reported by the kernel test robot, the following warning occur:
> 
> >> drivers/input/touchscreen/wdt87xx_i2c.c:1166:36: warning: 'wdt87xx_acpi_id' defined but not used [-Wunused-const-variable=]
>     1166 | static const struct acpi_device_id wdt87xx_acpi_id[] = {
>          |                                    ^~~~~~~~~~~~~~~
> 
> The 'wdt87xx_acpi_id' array is only used when CONFIG_ACPI is enabled.
> Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_ACPI'
> prevents a compiler warning when ACPI is disabled.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501181549.uzdlBwuN-lkp@intel.com/
> Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>

Applied, thank you.

-- 
Dmitry

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

* Re: [PATCH] Input: wdt87xx_i2c - fix compiler warning
  2025-01-19  8:43 [PATCH] Input: wdt87xx_i2c - fix compiler warning Yu-Chun Lin
  2025-01-22 18:40 ` Dmitry Torokhov
@ 2025-02-25  7:25 ` Andy Shevchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2025-02-25  7:25 UTC (permalink / raw)
  To: Yu-Chun Lin
  Cc: dmitry.torokhov, linux-input, linux-kernel, jserv, visitorckw,
	kernel test robot

Sun, Jan 19, 2025 at 04:43:12PM +0800, Yu-Chun Lin kirjoitti:
> As reported by the kernel test robot, the following warning occur:
> 
> >> drivers/input/touchscreen/wdt87xx_i2c.c:1166:36: warning: 'wdt87xx_acpi_id' defined but not used [-Wunused-const-variable=]
>     1166 | static const struct acpi_device_id wdt87xx_acpi_id[] = {
>          |                                    ^~~~~~~~~~~~~~~
> 
> The 'wdt87xx_acpi_id' array is only used when CONFIG_ACPI is enabled.
> Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdef CONFIG_ACPI'
> prevents a compiler warning when ACPI is disabled.

> +#ifdef CONFIG_ACPI
>  static const struct acpi_device_id wdt87xx_acpi_id[] = {
>  	{ "WDHT0001", 0 },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id);
> +#endif

Instead, this should get rid of ugly ifdeffery and whatever that makes variable
disappear (ACPI_PTR() call?). It even possible that this make unneeded of
inclusion of some header(s).

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2025-02-25  7:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-19  8:43 [PATCH] Input: wdt87xx_i2c - fix compiler warning Yu-Chun Lin
2025-01-22 18:40 ` Dmitry Torokhov
2025-02-25  7:25 ` Andy Shevchenko

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).