Re: [PATCH v3 3/3] leds: add new LED driver for TI LP5812
From: Nam Tran
Date: Thu Mar 27 2025 - 11:49:47 EST
> …
> > +++ b/drivers/leds/leds-lp5812.c
> > @@ -0,0 +1,2190 @@
> …
> > +static ssize_t device_enable_show(struct device *dev,
> > + struct device_attribute *attr,
> > + char *buf)
> > +{
> …
> > + mutex_lock(&chip->lock);
> > + if (lp5812_read(chip, chip->regs->enable_reg, &enable)) {
> > + mutex_unlock(&chip->lock);
> > + return -EIO;
> > + }
> > + mutex_unlock(&chip->lock);
> > +
> > + return sprintf(buf, "%d\n", enable);
> > +}
> …
>
> Under which circumstances would you become interested to apply a statement
> like “guard(mutex)(&chip->lock);”?
> https://elixir.bootlin.com/linux/v6.14-rc6/source/include/linux/mutex.h#L201
Thank you for your suggestion regarding the use of guard(mutex)(&chip->lock).
While we understand the impacts of this approach, we are currently not planning to change the source code in this version.
We will consider incorporating this improvement in the next TI LED version.
Best regards,
Nam Tran