Re: [PATCH] Input: wdt87xx_i2c - fix compiler warning
From: Andy Shevchenko
Date: Tue Feb 25 2025 - 02:26:55 EST
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