mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: kr494167@gmail.com
Cc: pavel@kernel.org, s.trumtrar@pengutronix.de,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] leds: lp5860: Fix LED teardown ordering using devm_add_action_or_reset()
Date: Thu, 27 Aug 2026 17:20:08 +0100	[thread overview]
Message-ID: <20260827162008.GF2943942@google.com> (raw)
In-Reply-To: <20260812135001.48949-1-kr494167@gmail.com>

On Wed, 12 Aug 2026, kr494167@gmail.com wrote:

> From: Surendra Singh Chouhan <kr494167@gmail.com>
> 
> The driver previously disabled the chip in its remove callback before
> devres unregistered the LEDs. LED unregistration turns the LEDs off
> through the driver brightness callback, which accessed disabled hardware.
> 
> Fix this by registering a devm action via devm_add_action_or_reset()
> immediately after enabling the chip in lp5860_device_init(). Due to devm
> LIFO (Last-In, First-Out) teardown ordering, devm will automatically
> unregister all multicolor LEDs before the devm action disables the chip.
> 
> In addition, use scoped_guard(mutex, &lp->lock) to restrict the initial
> mode setting lock scope, avoiding holding the mutex across
> lp5860_init_dt(), which would cause a self-deadlock when registering
> subleds.
> 
> Finally, convert mutex_init() to devm_mutex_init() and declare the local
> variable ret in lp5860_probe(), allowing lp5860_device_remove() and
> lp5860_remove() to be removed completely.
> 
> Fixes: f0a66563aa2d ("leds: Add support for TI LP5860 LED driver chip")
> Signed-off-by: Surendra Singh Chouhan <kr494167@gmail.com>
> ---
> v3:
>  - Use scoped_guard(mutex, &lp->lock) in lp5860_device_init() so the lock is released before calling lp5860_init_dt(), preventing a self-deadlock during subled registration.
>  - Declare missing local variable 'ret' in lp5860_probe().
>  - Capitalize patch title per LED subsystem guidelines.
> 
> v2:
>  - Use full name "Surendra Singh Chouhan" in From header and Signed-off-by.
>  - Convert chip disable sequence to devm_add_action_or_reset() as suggested by Lee Jones.
>  - Use devm_mutex_init() for lock initialization.
> 
>  drivers/leds/rgb/leds-lp5860-core.c | 42 +++++++++++++----------------
>  drivers/leds/rgb/leds-lp5860-spi.c  | 15 +++--------
>  drivers/leds/rgb/leds-lp5860.h      |  1 -
>  3 files changed, 22 insertions(+), 36 deletions(-)

This no longer applies.

Please rebase onto -next or my LEDs tree and resubmit with my:

Acked-by: Lee Jones <lee@kernel.org>

-- 
Lee Jones

      reply	other threads:[~2026-08-27 16:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 13:50 kr494167
2026-08-27 16:20 ` Lee Jones [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=20260827162008.GF2943942@google.com \
    --to=lee@kernel.org \
    --cc=kr494167@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=s.trumtrar@pengutronix.de \
    /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

all inboxes | Powered by JetHome®