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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 29 Dec 2020 17:04:50 +0100
From:   Pavel Machek <pavel@....cz>
To:     Dylan Van Assche <me@...anvanassche.be>
Cc:     dmurphy@...com, linux-leds@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] leds: gpio: Set max brightness to 1

Hi!

> GPIO LEDs only know 2 states: ON or OFF and do not have PWM capabilities.
> However, the max brightness is reported as 255.
> 
> This patch sets the max brightness value of a GPIO controlled LED to 1.
> 
> Tested on my PinePhone 1.2.
> 
> Signed-off-by: Dylan Van Assche <me@...anvanassche.be>
> ---
> v2 drops an obsolete change in include/linux/leds.h

I thought that one looked odd.

> +++ b/drivers/leds/leds-gpio.c
> @@ -96,7 +96,8 @@ static int create_gpio_led(const struct gpio_led *template,
>  	} else {
>  		state = (template->default_state == LEDS_GPIO_DEFSTATE_ON);
>  	}
> -	led_dat->cdev.brightness = state ? LED_FULL : LED_OFF;
> +	led_dat->cdev.brightness = state ? LED_ON : LED_OFF;
> +	led_dat->cdev.max_brightness = LED_ON;

Would simpler version work:

> +	led_dat->cdev.brightness = state;
> +	led_dat->cdev.max_brightness = 1;

? Easier to understand... I'd prefer that version unless it causes
warnings or something.

								Pavel
-- 
http://www.livejournal.com/~pavelmachek

Download attachment "signature.asc" of type "application/pgp-signature" (196 bytes)

Powered by blists - more mailing lists