Skip to contentSkip to conversation

Input: wdt87xx_i2c - fix compiler warning

PATCH Applied Yu-Chun Lin 3 participants 3 messages Jan 19, 2025 – Feb 25, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: wdt87xx_i2c - fix compiler warning

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

Quoted 1 line
Quoted 1 line

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.

---
 drivers/input/touchscreen/wdt87xx_i2c.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/input/touchscreen/wdt87xx_i2c.c +2 -0
index 27941245e962..88d376090e6e 100644
@@ -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,
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 6 lines · Yu-Chun Lin

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

Quoted 1 line
Quoted 1 line

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[] = {
         |                                    ^~~~~~~~~~~~~~~
Quoted 7 lines

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.

Applied, thank you.

Signature · 1 line
Dmitry
#2 lore raw
In reply to Yu-Chun Lin

Sun, Jan 19, 2025 at 04:43:12PM +0800, Yu-Chun Lin kirjoitti:

Quoted 10 lines

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

Quoted 1 line
Quoted 1 line

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.

drivers/input/touchscreen/wdt87xx_i2c.c static const struct i2c_device_id wdt87xx_dev_id[] = { · line 1162

Quoted 7 lines
drivers/input/touchscreen/wdt87xx_i2c.c +2 -0
+#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).

Signature · 2 lines
With Best Regards,
Andy Shevchenko