[PATCH v2 0/5] platform/x86: lenovo-wmi-other: Refine firmware_attributes interface
From: Rong Zhang
Date: Tue Nov 24 2026 - 13:03:11 EST
The driver declares `.no_singleton = true' but stores device-specific
data to statically allocated tunable_attr_01 variables. This violates
the requirements of a no_singleton driver (even though no device in wild
ever has more than one such WMI device).
The series moves tunable_attr_01.device to the firmware_attributes
device's drvdata and introduces a tunable_attr_01_ctx array to struct
to store c[dv]_mode_id. In this manner, all statically allocated
variables relevant to our firmware_attributes interface are constified.
This also eliminates all attribute-specific callbacks by moving their
data into a newly-introduced container struct capdata01_attr, so that
all remaining attribute callbacks becomes generic and are shared among
different attributes, which shrinks the module size by 42.7%.
To further follow the common practice of sysfs attributes, all attribute
groups are now created and removed at once using sysfs_create_groups()
and sysfs_remove_groups() by providing an is_visible() callback.
Signed-off-by: Rong Zhang <i@xxxxxxxx>
---
Changes in v2:
- Swap device_id and feature_id in tunable_attr_01 (thanks Mark Pearson)
- Rephrase the commit message of PATCH 4 (ditto)
- Link to v1: https://patch.msgid.link/20261119-lwmi-no-singleton-v1-0-6b06fcfb5126@xxxxxxxx
---
Rong Zhang (5):
platform/x86: lenovo-wmi-other: Retrieve private data from firmware_attributes device
platform/x86: lenovo-wmi-other: Eliminate attribute-specific callbacks
platform/x86: lenovo-wmi-other: Factor out tunable_attr_01 definition into a macro
platform/x86: lenovo-wmi-other: Constify tunable_attr_01 variables
platform/x86: lenovo-wmi-other: Hide unsupported attributes using is_visible() callback
drivers/platform/x86/lenovo/wmi-other.c | 566 +++++++++++++++-----------------
1 file changed, 259 insertions(+), 307 deletions(-)
---
base-commit: 8d7fe9885c62fc9a95bf55d9db244d9672a8aadc
change-id: 2c0ec814-lwmi-no-singleton-a3f945179a50
Thanks,
Rong