On Wed, Mar 13, 2013 at 09:56:57AM +0100, Peter Ujfalusi wrote:
> On 03/12/2013 11:22 PM, Andrew Chew wrote:
[...]
> > +static void pwm_backlight_disable(struct backlight_device *bl)
> > +{
> > +   struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
> > +
> > +   /* Bail if we are already disabled. */
> > +   if (!pb->enabled)
> > +           return;
> > +
> > +   if (regulator_disable(pb->enable_supply) != 0)
> > +           dev_warn(&bl->dev, "Failed to disable regulator");
> > +
> > +   pwm_disable(pb->pwm);
> > +
> > +   pb->enabled = false;
> > +}
> 
> Would it not be better to have some locking here since the code started to use
> flag for state tracking?

I don't think that's necessary. The backlight core already uses the
ops_lock mutex to serial accesses. I just noticed that the documentation
mentions that update_lock is used for this purpose, but the code doesn't
use it after it is initialized. Still, the ops_lock should be enough.

Thierry

Attachment: pgp0kA3PVkoTc.pgp
Description: PGP signature

Reply via email to