From: Pavel Machek <pavel@ucw.cz>
To: "Guilherme Giácomo Simões" <trintaeoitogc@gmail.com>
Cc: Lee Jones <lee@kernel.org>, linux-leds@vger.kernel.org
Subject: Re: [RESEND LEDs] leds: remove led_brightness
Date: Thu, 25 Jul 2024 14:37:37 +0200 [thread overview]
Message-ID: <ZqJHEdxwEpr5W605@duo.ucw.cz> (raw)
In-Reply-To: <CAM_RzfZhySkzDZF-RV=+8rtx0yTs-+qmsRNwwa31nsWRAc40-g@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]
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
--
People of Russia, stop Putin before his war on Ukraine escalates.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2024-07-25 12:37 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 [this message]
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
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=ZqJHEdxwEpr5W605@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=lee@kernel.org \
--cc=linux-leds@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox