lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 9 Jul 2012 08:30:06 +0200
From:	Thierry Reding <thierry.reding@...onic-design.de>
To:	Alexandre Courbot <acourbot@...dia.com>
Cc:	linux-kernel@...r.kernel.org, linux-fbdev@...r.kernel.org
Subject: Re: [PATCHv3] pwm_backlight: pass correct brightness to callback

On Mon, Jul 09, 2012 at 03:04:23PM +0900, Alexandre Courbot wrote:
> pwm_backlight_update_status calls the notify() and notify_after()
> callbacks before and after applying the new PWM settings. However, if
> brightness levels are used, the brightness value will be changed from
> the index into the levels array to the PWM duty cycle length before
> being passed to notify_after(), which results in inconsistent behavior.
> 
> Signed-off-by: Alexandre Courbot <acourbot@...dia.com>
> ---
>  drivers/video/backlight/pwm_bl.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

Applied, with a minor stylistic fixup adding a blank line after the
duty_cycle variable declaration. Thanks.

Thierry

> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 057389d..be48517 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -54,14 +54,17 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
>  		pwm_config(pb->pwm, 0, pb->period);
>  		pwm_disable(pb->pwm);
>  	} else {
> +		int duty_cycle;
>  		if (pb->levels) {
> -			brightness = pb->levels[brightness];
> +			duty_cycle = pb->levels[brightness];
>  			max = pb->levels[max];
> +		} else {
> +			duty_cycle = brightness;
>  		}
>  
> -		brightness = pb->lth_brightness +
> -			(brightness * (pb->period - pb->lth_brightness) / max);
> -		pwm_config(pb->pwm, brightness, pb->period);
> +		duty_cycle = pb->lth_brightness +
> +		     (duty_cycle * (pb->period - pb->lth_brightness) / max);
> +		pwm_config(pb->pwm, duty_cycle, pb->period);
>  		pwm_enable(pb->pwm);
>  	}
>  
> -- 
> 1.7.11.1
> 
> 
> 

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ