HID: google: fix unused variable warning under !CONFIG_ACPI
PATCH RESEND 1/1 HID: google: fix unused variable warning under !CONFIG_ACPI
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/hid/hid-google-hammer.c:261:36: warning: 'cbas_ec_acpi_ids' defined but not used [-Wunused-const-variable=]
261 | static const struct acpi_device_id cbas_ec_acpi_ids[] = {
| ^~~~~~~~~~~~~~~~The 'cbas_ec_acpi_ids' 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/hid/hid-google-hammer.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/hid-google-hammer.c +2 -0
@@ -268,11 +268,13 @@ static void cbas_ec_remove(struct platform_device *pdev)mutex_unlock (&cbas_ec_reglock); } +#ifdef CONFIG_ACPI static const struct acpi_device_id cbas_ec_acpi_ids[] = { {"GOOG000B" ,0 }, { } };MODULE_DEVICE_TABLE (acpi, cbas_ec_acpi_ids); +#endif #ifdef CONFIG_OF static const struct of_device_id cbas_ec_of_match[] = {
Signature · 1 line
2.43.0
Jiri Kosina
maintainerQuoted 6 lines · Yu-Chun Lin
As reported by the kernel test robot, the following warning occurs:
Quoted 1 line
Quoted 1 line
drivers/hid/hid-google-hammer.c:261:36: warning: 'cbas_ec_acpi_ids' defined but not used [-Wunused-const-variable=]261 | static const struct acpi_device_id cbas_ec_acpi_ids[] = { | ^~~~~~~~~~~~~~~~
Quoted 7 lines
The '
cbas_ec_acpi_ids' array is only used whenCONFIG_ACPIis enabled. Wrapping its definition and 'MODULE_DEVICE_TABLE' in '#ifdefCONFIG_ACPI' prevents a compiler warning when ACPI is disabled.Reported-by kernel test robot <[email protected]>Signed-off-by Yu-Chun Lin <[email protected]>
I've added
and applied, thanks.
Signature · 2 lines
Jiri Kosina SUSE Labs