Re: [PATCH 04/13] platform/x86: lenovo: think-lmi: store attributes as linked list

From: Mark Pearson

Date: Fri Dec 04 2026 - 10:22:10 EST




On Fri, Dec 4, 2026, at 8:30 AM, Rong Zhang wrote:
> Hi Mark,
>
> On Thu, 2026-12-03 at 21:20 -0500, Mark Pearson wrote:
>> Use a linked list for storing attributes instead of a fixed array.
>>
>> Signed-off-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
>> ---
>> drivers/platform/x86/lenovo/think-lmi.c | 55 +++++++++++--------------
>> drivers/platform/x86/lenovo/think-lmi.h | 3 +-
>> 2 files changed, 25 insertions(+), 33 deletions(-)
>>
>> diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c
>> index 6580b1401f01..7a24985882ea 100644
>> --- a/drivers/platform/x86/lenovo/think-lmi.c
>> +++ b/drivers/platform/x86/lenovo/think-lmi.c
>> @@ -1249,6 +1249,7 @@ static void tlmi_attr_setting_release(struct kobject *kobj)
>> {
>> struct tlmi_attr_setting *setting = to_tlmi_attr_setting(kobj);
>>
>> + list_del(&setting->node);
>
> I guess you need a scoped_guard() or lockdep_assert_held() for it, but is
> it useful to keep the list in the first place? It seems that no one
> touches it once probe finishes.
>

Let me know if you mean something different than the below

The only reason for the list is because I use it in tlmi - and then I can keep the same structure for both drivers. It's a weak reason.

In tlmi I need it as there are settings, platform settings and functions - and a list works out quite nicely there, instead of maintaining three arrays. I thought I could use it here too, but it's not a requirement and admittedly not really beneficial. If I should just leave it unchanged I'm fine with that.

Mark