The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH RESEND] HID: google: fix unused variable warning under !CONFIG_ACPI
@ 2025-02-17 16:50 Yu-Chun Lin
  2025-02-19  9:04 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Yu-Chun Lin @ 2025-02-17 16:50 UTC (permalink / raw)
  To: jikos, bentiss
  Cc: linux-input, linux-kernel, visitorckw, jserv, Yu-Chun Lin,
	kernel test robot

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.

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>
---
 drivers/hid/hid-google-hammer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
index 0f292b5d3e26..eb6fd2dc75d0 100644
--- a/drivers/hid/hid-google-hammer.c
+++ b/drivers/hid/hid-google-hammer.c
@@ -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[] = {
-- 
2.43.0


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

* Re: [PATCH RESEND] HID: google: fix unused variable warning under !CONFIG_ACPI
  2025-02-17 16:50 [PATCH RESEND] HID: google: fix unused variable warning under !CONFIG_ACPI Yu-Chun Lin
@ 2025-02-19  9:04 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2025-02-19  9:04 UTC (permalink / raw)
  To: Yu-Chun Lin
  Cc: bentiss, linux-input, linux-kernel, visitorckw, jserv,
	kernel test robot

On Tue, 18 Feb 2025, Yu-Chun Lin wrote:

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

I've added

	Fixes: eb1aac4c8744f75 ("HID: google: add support tablet mode switch for Whiskers")

and applied, thanks.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2025-02-19  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-17 16:50 [PATCH RESEND] HID: google: fix unused variable warning under !CONFIG_ACPI Yu-Chun Lin
2025-02-19  9:04 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox