public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lee Jones <lee@kernel.org>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pavel Machek <pavel@kernel.org>
Subject: Re: [PATCH v2 2/2] leds: class: Reinitialise list after dropping from lookup table
Date: Thu, 9 Apr 2026 19:00:52 +0300	[thread overview]
Message-ID: <adfNNGYVXjnJOwPh@ashevche-desk.local> (raw)
In-Reply-To: <20260409155232.GA3439476@google.com>

On Thu, Apr 09, 2026 at 04:52:32PM +0100, Lee Jones wrote:
> On Tue, 31 Mar 2026, Andy Shevchenko wrote:
> 
> > Currently the lookup table just removes the list entry and leaves
> > the stale pointers in it. If the lookup is embedded in some data
> > structure, the pointer to the lookup entry can't be NULL (always
> > valid), but calling led_remove_lookup() on it twice will lead to
> > the wrong behaviour. To avoid that the user has to track the state
> > itself. With this change in place, the user may drop that approach
> > and use something like
> > 
> >   probe:
> > 	INIT_LIST_HEAD(&lookup.list);
> > 	if (LED lookup is required)
> > 		led_add_lookup(&lookup);
> > 
> >   remove:
> > 	led_remove_lookup(&lookup);
> 
> How do we feel about a devm_led_add_lookup()?

No strong opinion. If we have that already, great! This patch won't be needed.
If not yet, we may add one, but briefly looking at the kernel I have not found
any other framework doing that.

In any case the user that would need this patch has been already modified the
way that lookup is always there, effectively means we may postpone or even drop
this patch for now.

> > without any additional tracking kept over the device lifetime.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-04-09 16:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 18:28 [PATCH v2 0/2] leds: class: improve led_remove_lookup() Andy Shevchenko
2026-03-31 18:28 ` [PATCH v2 1/2] leds: class: Make led_remove_lookup() NULL-aware Andy Shevchenko
2026-03-31 18:28 ` [PATCH v2 2/2] leds: class: Reinitialise list after dropping from lookup table Andy Shevchenko
2026-04-09 15:52   ` Lee Jones
2026-04-09 16:00     ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adfNNGYVXjnJOwPh@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox