Skip to contentSkip to conversation

hwmon: (gpd-fan) Fix compilation error in non-ACPI builds

PATCH Applied Gopi Krishna Menon 2 participants 2 messages Oct 24, 2025 – Oct 25, 2025

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

PATCH 1/1 hwmon: (gpd-fan) Fix compilation error in non-ACPI builds

Building gpd-fan driver without CONFIG_ACPI results in the following build errors:

drivers/hwmon/gpd-fan.c: In function ‘gpd_ecram_read’:
drivers/hwmon/gpd-fan.c:228:9: error: implicit declaration of function ‘outb’ [-Werror=implicit-function-declaration]

  228 |         outb(0x2E, addr_port);
      |         ^~~~

drivers/hwmon/gpd-fan.c:241:16: error: implicit declaration of function ‘inb’ [-Werror=implicit-function-declaration]
241 | *val = inb(data_port);

The definitions for inb() and outb() come from <linux/io.h> (specifically through <asm/io.h>), which is implicitly included via <acpi_io.h>. When CONFIG_ACPI is not set, <acpi_io.h> is not included resulting in <linux/io.h> to be omitted as well.

Since the driver does not depend on ACPI, remove <linux/acpi.h> and add <linux/io.h> directly to fix the compilation errors.

---

Tested the changes by recompiling the kernel with and without CONFIG_ACPI for x86_64 architecture verifying that no compilation errors are generated.

 drivers/hwmon/gpd-fan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/gpd-fan.c +1 -1
index 138cff0beb4c..4c45c0154a45 100644
@@ -12,9 +12,9 @@
  * Copyright (c) 2024 Cryolitia PukNgae
  */
 
-#include <linux/acpi.h>
 #include <linux/dmi.h>
 #include <linux/hwmon.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 15 lines · Gopi Krishna Menon

Building gpd-fan driver without CONFIG_ACPI results in the following build errors:

drivers/hwmon/gpd-fan.c: In function ‘gpd_ecram_read’:
drivers/hwmon/gpd-fan.c:228:9: error: implicit declaration of function ‘outb’ [-Werror=implicit-function-declaration]

  228 |         outb(0x2E, addr_port);
      |         ^~~~

drivers/hwmon/gpd-fan.c:241:16: error: implicit declaration of function ‘inb’ [-Werror=implicit-function-declaration]
241 | *val = inb(data_port);

The definitions for inb() and outb() come from <linux/io.h> (specifically through <asm/io.h>), which is implicitly included via <acpi_io.h>. When CONFIG_ACPI is not set, <acpi_io.h> is not included resulting in <linux/io.h> to be omitted as well.

Quoted 4 lines

Since the driver does not depend on ACPI, remove <linux/acpi.h> and add <linux/io.h> directly to fix the compilation errors.

Applied.

Thanks,
Guenter