Re: [PATCH] pwm_backlight: pass correct brightness to callback

From: Alex Courbot
Date: Mon Jul 09 2012 - 01:25:37 EST


On 07/09/2012 02:10 PM, Thierry Reding wrote:
I had to actually read this patch a number of times and then realized I
was completely missing the context. Looking at the whole function makes
it more obvious what you mean.

However I think it'd be much clearer if we just passed the value of
bl->props.brightness into the callbacks, that way we can avoid the
additional variable.

This won't work I'm afraid, as brightness can be modified prior to being passed to the callback function:

if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;

if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;

if (pb->notify)
brightness = pb->notify(pb->dev, brightness);

Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/