All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: "Guilherme Giácomo Simões" <trintaeoitogc@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>, linux-leds@vger.kernel.org
Subject: Re: [RESEND LEDs] leds: remove led_brightness
Date: Thu, 1 Aug 2024 13:36:35 +0100	[thread overview]
Message-ID: <20240801123635.GB6756@google.com> (raw)
In-Reply-To: <CAM_RzfY4GR1Jkym4mpGUVtsew3T--nqKWJD_sb_0tc5hDFBiSw@mail.gmail.com>

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@gmail.com> escreveu:
> 
> >
> > Pavel Machek <pavel@ucw.cz> 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 [李琼斯]

  reply	other threads:[~2024-08-01 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-21 14:22 [RESEND LEDs] leds: remove led_brightness Guilherme Giácomo Simões
2024-07-25 10:26 ` Lee Jones
2024-07-25 12:34   ` Guilherme Giácomo Simões
2024-07-25 12:37     ` Pavel Machek
2024-07-25 13:07       ` Guilherme Giácomo Simões
2024-07-29 20:00         ` Guilherme Giácomo Simões
2024-08-01 12:36           ` Lee Jones [this message]
2024-07-29 20:37         ` Guilherme Giácomo Simões

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240801123635.GB6756@google.com \
    --to=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=trintaeoitogc@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.