public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: ChiYuan Huang <cy_huang@richtek.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Bryan Wu <cooloney@gmail.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Jacek Anaszewski <j.anaszewski@samsung.com>,
	<roger-hy.wang@mediatek.com>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: Re: [PATCH v3] media: v4l2-flash: Enter LED off state after file handle closed
Date: Mon, 23 Feb 2026 09:02:13 +0800	[thread overview]
Message-ID: <aZunFW77oOGrhNn1@git-send.richtek.com> (raw)
In-Reply-To: <aZuc6jUrdu6qQ0Rr@git-send.richtek.com>

On Mon, Feb 23, 2026 at 08:18:50AM +0800, ChiYuan Huang wrote:
> On Sat, Feb 21, 2026 at 04:48:48PM +0100, Jacek Anaszewski wrote:
> Hi, Jacek:
> 
> > Hi ChiYuan,
> > 
> ...
> > On 1/12/26 10:20, cy_huang@richtek.com wrote:
> > >   drivers/media/v4l2-core/v4l2-flash-led-class.c | 6 ++++++
> > >   1 file changed, 6 insertions(+)
> > > 
> > > diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> > > index 355595a0fefa..46606f5cc192 100644
> > > --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c
> > > +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c
> > > @@ -623,6 +623,12 @@ static int v4l2_flash_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
> > >   		return 0;
> > >   	if (led_cdev) {
> > > +		/* If file handle is released, make sure LED enter off state */
> > > +		ret = v4l2_ctrl_s_ctrl(v4l2_flash->ctrls[LED_MODE],
> > > +				       V4L2_FLASH_LED_MODE_NONE);
> > > +		if (ret)
> > > +			return ret;
> > > +
> > >   		mutex_lock(&led_cdev->led_access);
> > >   		if (v4l2_flash->ctrls[STROBE_SOURCE])
> > > 
> > > base-commit: 8ac28a6642d1cc8bac0632222e66add800b027fa
> > 
> > The patch itself looks good, but while at it I started wondering
> > if we shouldn't move below STROBE_SOURCE access before the lock.
> > I don't see now, why we placed it there.
> > 
> My assumption is LED should already be called 'led_sysfs_enable(false)',
> no other APIs except V4L2 singular handle. But your guess is right. If we
> put the change after the lock, should be more safe.
> 
> Thanks for the reviewing, if the common is to put after the lock, then
> I can send v4 patch to fix it.

Aha, I remember the another thing is the 'return'.

To put after the lock, the lock problem need to be handled.
Should rewrite the lock using 'scoped_guard' and move all into the scope.

> > Adding Sakari.
> > 
> > -- 
> > Best regards,
> > Jacek Anaszewski
> > 

  reply	other threads:[~2026-02-23  1:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12  9:20 [PATCH v3] media: v4l2-flash: Enter LED off state after file handle closed cy_huang
2026-02-21 15:48 ` Jacek Anaszewski
2026-02-23  0:18   ` ChiYuan Huang
2026-02-23  1:02     ` ChiYuan Huang [this message]
2026-02-23  9:43   ` Sakari Ailus
2026-02-23 18:32     ` Jacek Anaszewski
2026-03-02  9:22       ` Sakari Ailus

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=aZunFW77oOGrhNn1@git-send.richtek.com \
    --to=cy_huang@richtek.com \
    --cc=cooloney@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=roger-hy.wang@mediatek.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@vger.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