Re: [PATCH v3 1/3] firmware: Move firmware attributes class helper

From: Mark Pearson

Date: Fri Jul 10 2026 - 08:24:40 EST




On Fri, Jul 10, 2026, at 2:12 AM, Sean Rhodes wrote:
> Move the firmware attributes class helper from drivers/platform/x86 to
> drivers/firmware and expose its class declaration through a public Linux
> header.
>
> The helper is not x86-specific. Keeping it in firmware lets coreboot
> firmware drivers use the standard firmware-attributes ABI without living
> under platform/x86.
>
> Signed-off-by: Sean Rhodes <sean@starlabs.systems>
> ---
> MAINTAINERS | 8 ++++++++
> drivers/firmware/Kconfig | 3 +++
> drivers/firmware/Makefile | 1 +
> .../x86 => firmware}/firmware_attributes_class.c | 2 +-
> drivers/platform/x86/Kconfig | 3 ---
> drivers/platform/x86/Makefile | 2 --
> drivers/platform/x86/asus-armoury.c | 2 +-
> drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 2 +-
> drivers/platform/x86/hp/hp-bioscfg/bioscfg.c | 2 +-
> drivers/platform/x86/lenovo/think-lmi.c | 2 +-
> drivers/platform/x86/lenovo/wmi-other.c | 2 +-
> drivers/platform/x86/samsung-galaxybook.c | 2 +-
> .../linux/firmware_attributes.h | 6 +++---
> 13 files changed, 22 insertions(+), 15 deletions(-)
> rename drivers/{platform/x86 => firmware}/firmware_attributes_class.c
> (94%)
> rename drivers/platform/x86/firmware_attributes_class.h =>
> include/linux/firmware_attributes.h (60%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 15011f5752a9..ec0a12121357 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10114,6 +10114,14 @@ F: include/linux/firewire.h
> F: include/uapi/linux/firewire*.h
> F: tools/firewire/
>
> +FIRMWARE ATTRIBUTES CLASS
> +M: Hans de Goede <hansg@xxxxxxxxxx>
> +M: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> +L: platform-driver-x86@xxxxxxxxxxxxxxx
> +S: Maintained
> +F: drivers/firmware/firmware_attributes_class.c
> +F: include/linux/firmware_attributes.h
> +
> FIRMWARE FRAMEWORK FOR ARMV8-A
> M: Sudeep Holla <sudeep.holla@xxxxxxxxxx>
> L: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx (moderated for non-subscribers)
> diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
> index 12dc70254842..78a239f8bbef 100644
> --- a/drivers/firmware/Kconfig
> +++ b/drivers/firmware/Kconfig
> @@ -8,6 +8,9 @@ menu "Firmware Drivers"
>
> source "drivers/firmware/arm_scmi/Kconfig"
>
> +config FW_ATTR_CLASS
> + tristate
> +
> config ARM_SCPI_PROTOCOL
> tristate "ARM System Control and Power Interface (SCPI) Message
> Protocol"
> depends on ARM || ARM64 || COMPILE_TEST
> diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
> index 4ddec2820c96..385b6e8b7fc6 100644
> --- a/drivers/firmware/Makefile
> +++ b/drivers/firmware/Makefile
> @@ -16,6 +16,7 @@ obj-$(CONFIG_FIRMWARE_MEMMAP) += memmap.o
> obj-$(CONFIG_MTK_ADSP_IPC) += mtk-adsp-ipc.o
> obj-$(CONFIG_RASPBERRYPI_FIRMWARE) += raspberrypi.o
> obj-$(CONFIG_FW_CFG_SYSFS) += qemu_fw_cfg.o
> +obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
> obj-$(CONFIG_SYSFB) += sysfb.o
> obj-$(CONFIG_SYSFB_SIMPLEFB) += sysfb_simplefb.o
> obj-$(CONFIG_TH1520_AON_PROTOCOL) += thead,th1520-aon.o
> diff --git a/drivers/platform/x86/firmware_attributes_class.c
> b/drivers/firmware/firmware_attributes_class.c
> similarity index 94%
> rename from drivers/platform/x86/firmware_attributes_class.c
> rename to drivers/firmware/firmware_attributes_class.c
> index 736e96c186d9..503ecc288086 100644
> --- a/drivers/platform/x86/firmware_attributes_class.c
> +++ b/drivers/firmware/firmware_attributes_class.c
> @@ -3,7 +3,7 @@
> /* Firmware attributes class helper module */
>
> #include <linux/module.h>
> -#include "firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
>
> const struct class firmware_attributes_class = {
> .name = "firmware-attributes",
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index b54b5212b204..beed14c38b54 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -926,9 +926,6 @@ config DASHARO_ACPI
>
> source "drivers/platform/x86/x86-android-tablets/Kconfig"
>
> -config FW_ATTR_CLASS
> - tristate
> -
> config INTEL_IMR
> bool "Intel Isolated Memory Region support"
> depends on X86_INTEL_QUARK && IOSF_MBI
> diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
> index 872ac3842391..cab20a4145e3 100644
> --- a/drivers/platform/x86/Makefile
> +++ b/drivers/platform/x86/Makefile
> @@ -63,8 +63,6 @@ obj-$(CONFIG_X86_PLATFORM_DRIVERS_HP) += hp/
> # Hewlett Packard Enterprise
> obj-$(CONFIG_UV_SYSFS) += uv_sysfs.o
>
> -obj-$(CONFIG_FW_ATTR_CLASS) += firmware_attributes_class.o
> -
> # IBM Thinkpad (before 2005)
> obj-$(CONFIG_IBM_RTL) += ibm_rtl.o
> obj-$(CONFIG_SENSORS_HDAPS) += hdaps.o
> diff --git a/drivers/platform/x86/asus-armoury.c
> b/drivers/platform/x86/asus-armoury.c
> index 495dc1e31d40..93fac0d464d2 100644
> --- a/drivers/platform/x86/asus-armoury.c
> +++ b/drivers/platform/x86/asus-armoury.c
> @@ -34,7 +34,7 @@
> #include <linux/sysfs.h>
>
> #include "asus-armoury.h"
> -#include "firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
>
> #define ASUS_NB_WMI_EVENT_GUID "0B3CBB35-E3C2-45ED-91C2-4C5A6D195D1C"
>
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index ab46a023cc34..85670be01647 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -16,7 +16,7 @@
> #include <linux/sysfs.h>
> #include <linux/wmi.h>
> #include "dell-wmi-sysman.h"
> -#include "../../firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
>
> #define MAX_TYPES 4
> #include <linux/nls.h>
> diff --git a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> index 27fd6cd21529..44314ae4e5e3 100644
> --- a/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> +++ b/drivers/platform/x86/hp/hp-bioscfg/bioscfg.c
> @@ -14,7 +14,7 @@
> #include <linux/string.h>
> #include <linux/wmi.h>
> #include "bioscfg.h"
> -#include "../../firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
> #include <linux/nls.h>
> #include <linux/errno.h>
>
> diff --git a/drivers/platform/x86/lenovo/think-lmi.c
> b/drivers/platform/x86/lenovo/think-lmi.c
> index e215e86e3db7..a56f152b5f28 100644
> --- a/drivers/platform/x86/lenovo/think-lmi.c
> +++ b/drivers/platform/x86/lenovo/think-lmi.c
> @@ -20,7 +20,7 @@
> #include <linux/types.h>
> #include <linux/dmi.h>
> #include <linux/wmi.h>
> -#include "../firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
> #include "think-lmi.h"
>
> static bool debug_support;
> diff --git a/drivers/platform/x86/lenovo/wmi-other.c
> b/drivers/platform/x86/lenovo/wmi-other.c
> index fbb32bf404f2..e9a2c4684e5f 100644
> --- a/drivers/platform/x86/lenovo/wmi-other.c
> +++ b/drivers/platform/x86/lenovo/wmi-other.c
> @@ -50,7 +50,7 @@
> #include "wmi-capdata.h"
> #include "wmi-events.h"
> #include "wmi-helpers.h"
> -#include "../firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
>
> #define LENOVO_OTHER_MODE_GUID "DC2A8805-3A8C-41BA-A6F7-092E0089CD3B"
>
> diff --git a/drivers/platform/x86/samsung-galaxybook.c
> b/drivers/platform/x86/samsung-galaxybook.c
> index 6382af0b106c..74b8c887dd79 100644
> --- a/drivers/platform/x86/samsung-galaxybook.c
> +++ b/drivers/platform/x86/samsung-galaxybook.c
> @@ -28,7 +28,7 @@
> #include <linux/uuid.h>
> #include <linux/workqueue.h>
> #include <acpi/battery.h>
> -#include "firmware_attributes_class.h"
> +#include <linux/firmware_attributes.h>
>
> #define DRIVER_NAME "samsung-galaxybook"
>
> diff --git a/drivers/platform/x86/firmware_attributes_class.h
> b/include/linux/firmware_attributes.h
> similarity index 60%
> rename from drivers/platform/x86/firmware_attributes_class.h
> rename to include/linux/firmware_attributes.h
> index d27abe54fcf9..d4026ba1fcc2 100644
> --- a/drivers/platform/x86/firmware_attributes_class.h
> +++ b/include/linux/firmware_attributes.h
> @@ -2,11 +2,11 @@
>
> /* Firmware attributes class helper module */
>
> -#ifndef FW_ATTR_CLASS_H
> -#define FW_ATTR_CLASS_H
> +#ifndef _LINUX_FIRMWARE_ATTRIBUTES_H
> +#define _LINUX_FIRMWARE_ATTRIBUTES_H
>
> #include <linux/device/class.h>
>
> extern const struct class firmware_attributes_class;
>
> -#endif /* FW_ATTR_CLASS_H */
> +#endif /* _LINUX_FIRMWARE_ATTRIBUTES_H */

Looks good to me.
Reviewed-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>

Mark