Re: [PATCH 2/2 v2] pwm_bl: Add mandatory backlight enable regulator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 13, 2013 at 02:10:16PM -0700, Andrew Chew wrote:
> > > +static void pwm_backlight_enable(struct backlight_device *bl) {
> > > +	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
> > > +
> > > +	/* Bail if we are already enabled. */
> > > +	if (pb->enabled)
> > > +		return;
> > > +
> > > +	pwm_enable(pb->pwm);
> > > +
> > > +	if (regulator_enable(pb->enable_supply) != 0)
> > 
> > I would loose the '!= 0'
> 
> I think I prefer the '!= 0'.  Without it, it looks at first glance
> like regulator_enable() is following boolean semantics,
> so it reads kind of weird.  But I'll defer to Thierry on this
> one.  Thierry, what's your preference?

Why not assign the return value of regulator_enable() to a variable, for
instance "err", and make that part of the warning message so that people
will have a better chance to diagnose what's going wrong?

Thierry

Attachment: pgp42sxMcJ4Bf.pgp
Description: PGP signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux