Re: [PATCH v1 9/9] ACPI: AC: Define ACPI_AC_CLASS in one place

From: Ilpo Järvinen

Date: Fri Mar 06 2026 - 07:54:00 EST


On Thu, 5 Mar 2026, Rafael J. Wysocki wrote:

> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> The ACPI_AC_CLASS symbol is defined in several places in the same way
> which is rather unfortunate.
>
> Instead, define it in one common header file (acpi_bus.h) that is
> already included by all of its users.

It's a bit misleading to say it like that as acpi_bus.h is included only
through another include (at least acpi/acpi.h) for most of the
cases.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>

--
i.

> No intentional functional impact.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> ---
> drivers/acpi/ac.c | 1 -
> drivers/acpi/sbs.c | 1 -
> drivers/gpu/drm/amd/include/amd_acpi.h | 2 --
> drivers/gpu/drm/radeon/radeon_acpi.c | 2 --
> drivers/platform/x86/hp/hp-wmi.c | 2 --
> drivers/platform/x86/lenovo/wmi-capdata.c | 1 -
> include/acpi/acpi_bus.h | 2 ++
> 7 files changed, 2 insertions(+), 9 deletions(-)
>
> --- a/drivers/acpi/ac.c
> +++ b/drivers/acpi/ac.c
> @@ -21,7 +21,6 @@
> #include <linux/acpi.h>
> #include <acpi/battery.h>
>
> -#define ACPI_AC_CLASS "ac_adapter"
> #define ACPI_AC_FILE_STATE "state"
> #define ACPI_AC_NOTIFY_STATUS 0x80
> #define ACPI_AC_STATUS_OFFLINE 0x00
> --- a/drivers/acpi/sbs.c
> +++ b/drivers/acpi/sbs.c
> @@ -26,7 +26,6 @@
>
> #include "sbshc.h"
>
> -#define ACPI_AC_CLASS "ac_adapter"
> #define ACPI_SBS_DEVICE_NAME "Smart Battery System"
> #define ACPI_BATTERY_DIR_NAME "BAT%i"
> #define ACPI_AC_DIR_NAME "AC0"
> --- a/drivers/gpu/drm/amd/include/amd_acpi.h
> +++ b/drivers/gpu/drm/amd/include/amd_acpi.h
> @@ -26,8 +26,6 @@
>
> #include <linux/types.h>
>
> -#define ACPI_AC_CLASS "ac_adapter"
> -
> struct atif_verify_interface {
> u16 size; /* structure size in bytes (includes size field) */
> u16 version; /* version */
> --- a/drivers/gpu/drm/radeon/radeon_acpi.c
> +++ b/drivers/gpu/drm/radeon/radeon_acpi.c
> @@ -44,8 +44,6 @@ bool radeon_atpx_dgpu_req_power_for_disp
> static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; }
> #endif
>
> -#define ACPI_AC_CLASS "ac_adapter"
> -
> struct atif_verify_interface {
> u16 size; /* structure size in bytes (includes size field) */
> u16 version; /* version */
> --- a/drivers/platform/x86/hp/hp-wmi.c
> +++ b/drivers/platform/x86/hp/hp-wmi.c
> @@ -58,8 +58,6 @@ enum hp_ec_offsets {
> #define HP_POWER_LIMIT_DEFAULT 0x00
> #define HP_POWER_LIMIT_NO_CHANGE 0xFF
>
> -#define ACPI_AC_CLASS "ac_adapter"
> -
> #define zero_if_sup(tmp) (zero_insize_support?0:sizeof(tmp)) // use when zero insize is required
>
> enum hp_thermal_profile_omen_v0 {
> --- a/drivers/platform/x86/lenovo/wmi-capdata.c
> +++ b/drivers/platform/x86/lenovo/wmi-capdata.c
> @@ -53,7 +53,6 @@
> #define LENOVO_CAPABILITY_DATA_01_GUID "7A8F5407-CB67-4D6E-B547-39B3BE018154"
> #define LENOVO_FAN_TEST_DATA_GUID "B642801B-3D21-45DE-90AE-6E86F164FB21"
>
> -#define ACPI_AC_CLASS "ac_adapter"
> #define ACPI_AC_NOTIFY_STATUS 0x80
>
> #define LWMI_FEATURE_ID_FAN_TEST 0x05
> --- a/include/acpi/acpi_bus.h
> +++ b/include/acpi/acpi_bus.h
> @@ -613,6 +613,8 @@ struct acpi_bus_event {
> u32 data;
> };
>
> +#define ACPI_AC_CLASS "ac_adapter"
> +
> extern struct kobject *acpi_kobj;
> extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
> void acpi_bus_private_data_handler(acpi_handle, void *);