mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/5] platform/x86: lenovo-wmi-other: Refine firmware_attributes interface
@ 2026-11-18 18:58 Rong Zhang
  2026-11-18 18:58 ` [PATCH 1/5] platform/x86: lenovo-wmi-other: Retrieve private data from firmware_attributes device Rong Zhang
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Rong Zhang @ 2026-11-18 18:58 UTC (permalink / raw)
  To: Mark Pearson, Derek J. Clark, Hans de Goede, Ilpo Järvinen,
	Alok Tiwari, Armin Wolf
  Cc: platform-driver-x86, linux-kernel, Rong Zhang

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
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
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@rong.moe>
---
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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-18 22:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 18:58 [PATCH 0/5] platform/x86: lenovo-wmi-other: Refine firmware_attributes interface Rong Zhang
2026-11-18 18:58 ` [PATCH 1/5] platform/x86: lenovo-wmi-other: Retrieve private data from firmware_attributes device Rong Zhang
2026-11-18 22:19   ` Mark Pearson
2026-11-18 18:58 ` [PATCH 2/5] platform/x86: lenovo-wmi-other: Eliminate attribute-specific callbacks Rong Zhang
2026-11-18 22:17   ` Mark Pearson
2026-11-18 18:58 ` [PATCH 3/5] platform/x86: lenovo-wmi-other: Factor out tunable_attr_01 definition into a macro Rong Zhang
2026-11-18 22:19   ` Mark Pearson
2026-11-18 18:58 ` [PATCH 4/5] platform/x86: lenovo-wmi-other: Properly implement no_singleton driver Rong Zhang
2026-11-18 22:27   ` Mark Pearson
2026-11-18 18:58 ` [PATCH 5/5] platform/x86: lenovo-wmi-other: Hide unsupported attributes using is_visible() callback Rong Zhang
2026-11-18 22:23   ` Mark Pearson
2026-11-18 22:19 ` [PATCH 0/5] platform/x86: lenovo-wmi-other: Refine firmware_attributes interface Mark Pearson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®