Re: [PATCH 0/5] platform/x86: lenovo-wmi-other: Refine firmware_attributes interface
From: Mark Pearson
Date: Wed Nov 18 2026 - 17:19:36 EST
Hi Rong,
On Wed, Nov 18, 2026, at 1:58 PM, Rong Zhang wrote:
> The driver declares `.no_singleton = true' but stores device-specific
> data to statically allocated tunable_attr_01 variables. This makes the
> driver depend on the frigile fact that no device in wild has more than
minor typo: frigile/fragile
> one LENOVO_OTHER_MODE WMI devices.
>
> The series moves tunable_attr_01.device to the firmware_attributes
> device's drvdata and introcdces a tunable_attr_01_ctx array to struct
minor typo: introcdeces/introduces
> 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>
> ---
> 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: Properly implement no_singleton
> driver
> 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: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca
> change-id: 2c0ec814-lwmi-no-singleton-a3f945179a50
>
> Thanks,
> Rong