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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210719120832.GB20484@duo.ucw.cz>
Date:   Mon, 19 Jul 2021 14:08:32 +0200
From:   Pavel Machek <pavel@....cz>
To:     Amy Parker <apark0006@...dent.cerritos.edu>
Cc:     linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] swap led_brightness from enum to typedef

Hi!

> This commit changes how led_brightness, declared in header file
> include/linux/leds.h, works throughout the kernel, and updates other
> files in accordance.
> 
> The TODO located at drivers/leds/TODO requests:
> 
> * Get rid of led_brightness
> 
> It is really an integer, as maximum is configurable. Get rid of it, or
> make it into typedef or something.
> 
> This patch changes the declaration of led_brightness from an enum to a
> typedef. In order to hold the currently existing enum values, macro
> definitions are provided. Files which use led_brightness are updated to
> conform to the new types.

Hmm... thanks.

But I can't really pull this through the LED tree as it touches other
people's code.


> index bfa60fa1d812..e1d771513b98 100644
> --- a/drivers/leds/TODO
> +++ b/drivers/leds/TODO
> @@ -1,7 +1,7 @@
>  -*- org -*-
>  
>  * On/off LEDs should have max_brightness of 1
> -* Get rid of enum led_brightness
> +* Get rid of led_brightness
>  
>  It is really an integer, as maximum is configurable. Get rid of it, or
>  make it into typedef or something.

You can delete this.

Probably new type should be called led_brightness_t. And probably it
should be typedef for the enum _for now_, so that we can switch users
gradually.

It should also be more than u8, I believe someone has more than 255
levels at this point.

> +++ b/include/linux/leds.h
> @@ -26,12 +26,11 @@ struct device_node;
>   */
>  
>  /* This is obsolete/useless. We now support variable maximum brightness. */
> -enum led_brightness {
> -	LED_OFF		= 0,
> -	LED_ON		= 1,
> -	LED_HALF	= 127,
> -	LED_FULL	= 255,
> -};
> +typedef u8 led_brightness;
> +#define LED_OFF 0
> +#define LED_ON 1
> +#define LED_HALF 127
> +#define LED_FULL 255
>

Best regards,
									Pavel

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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ