Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: google: fix unused variable warning under !CONFIG_ACPI

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

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

Fixes: eb1aac4c8744f75 ("HID: google: add support tablet mode switch for Whiskers")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501201141.jctFH5eB-lkp@intel.com/
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Yu-Chun Lin and committed by
Jiri Kosina
4bd0725c 44afc10d

+2
+2
drivers/hid/hid-google-hammer.c
··· 268 268 mutex_unlock(&cbas_ec_reglock); 269 269 } 270 270 271 + #ifdef CONFIG_ACPI 271 272 static const struct acpi_device_id cbas_ec_acpi_ids[] = { 272 273 { "GOOG000B", 0 }, 273 274 { } 274 275 }; 275 276 MODULE_DEVICE_TABLE(acpi, cbas_ec_acpi_ids); 277 + #endif 276 278 277 279 #ifdef CONFIG_OF 278 280 static const struct of_device_id cbas_ec_of_match[] = {