Re: [PATCH 04/13] platform/x86: lenovo: think-lmi: store attributes as linked list
From: Rong Zhang
Date: Fri Dec 04 2026 - 11:16:14 EST
Hi Mark,
On Fri, 2026-12-04 at 10:21 -0500, Mark Pearson wrote:
>
> 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.
IMO using a list to arrange the probe sequence is OK as long as it makes
things tidier, but touching it in the kobj's release callback could be
too tricky like what Sashiko has raised.
If you don't need the list at runtime (I assume this is the case as I
didn't notice any runtime path relying on it), removing a node from the
list is quite unnecessary. So I think you can simply drop the list_del()
and add a comment to the list head stating the intentional behavior.
Thanks,
Rong
>
> Mark