Re: [RESEND LEDs] leds: remove led_brightness

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

 



Please do not top-post (moving your comments down to the bottom).

On Mon, 29 Jul 2024, Guilherme Giácomo Simões wrote:
> Em qui., 25 de jul. de 2024 às 10:07, Guilherme Giácomo Simões
> <trintaeoitogc@xxxxxxxxx> escreveu:
> 
> >
> > Pavel Machek <pavel@xxxxxx> writes:
> > >
> > > Hi!
> > >
> > > > > > The includes/linux/leds.h diff:
> > > > > > -/* 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,
> > > > > > -};
> > > > > > +// default values for leds brightness
> > > > > > +#define LED_OFF  0
> > > > > > +#define LED_ON   1
> > > > > > +#define LED_HALF 127
> > > > > > +#define LED_FULL 255
> > > > > >
> > > > > I'm not aware of the history of this, however I'm even less sure how
> > > > > converting these from an enum to #defines makes this any better.
> > > > >
> > > >
> > > > Yeah. The TODO says:
> > > > -* On/off LEDs should have max_brightness of 1
> > > > -* Get rid of enum led_brightness
> > > > -
> > > > -It is really an integer, as maximum is configurable. Get rid of it, or
> > > > -make it into typedef or something.
> > > >
> > > > I could only remove enum led_brightness, but in some places, the
> > > > LED_FULL, LED_HALF...
> > > > are used. This is why I created this #defines.
> > > > I don't know what we can do in these cases that LED_FULL, FULL_HALF is used.
> > > > For example, in the drivers/leds/leds-ss4200.c on line 223 have this code
> > > >
> > > > u32 setting = 0;
> > > > if (brightness >= LED_HALF)
> > > >     setting = 1;
> > >
> > > Yep. Such drivers should be modified to set max_brightness to real
> > > number of steps hardware can do... then we can remove LED_HALF,
> > > LED_FULL and such defines.
> > >
> > > Best regards,
> > >                                                                 Pavel
> >
> > but this will require the effort of everyone who has already written drivers
> > for some LED hardware. Because only the driver author himself will know
> > all the steps for that specific LED.
> >
> > or, maybe we can adapt this drivers for understand the brightness as a 0 or 1.
> > 0 for OFF and 1 for HALF and FULL. This is possble ?

> In the drivers/leds/leds-clevo-mail.c for example, the LED_HALF is
> used on line 102.
> In drivers/leds/leds-pca955x.c the LED_HALF is used in line 260.
> 
> How can I remove these keywords if manufacturers still use them?

And now you see why no one has removed them before now.

Once all uses have been converted, we can remove the enum.

-- 
Lee Jones [李琼斯]




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux