Re: [PATCH v7 01/11] leds: add support for hardware driven LEDs

Russell King (Oracle)
2022-12-16T16:52:31Z

On Fri, Dec 16, 2022 at 05:45:25PM +0100, Christian Marangi wrote:
> On Thu, Dec 15, 2022 at 04:13:03PM +0000, Russell King (Oracle) wrote:
> > Hi Christian,
> >
> > Thanks for the patch.
> >
> > I think Andrew's email is offline at the moment.
> >
>
> Notice by gmail spamming me "I CAN'T SEND IT AHHHHH"
> Holidy times I guess?

Sadly, Andrew's email has done this a number of times - and Andrew
used to be on IRC so I could prod him about it, but it seems he
doesn't hang out on IRC anymore. It's been like it a few days now.

> > On Thu, Dec 15, 2022 at 12:54:28AM +0100, Christian Marangi wrote:
> > > @@ -188,6 +213,10 @@ int led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trig)
> > > led_set_brightness(led_cdev, LED_OFF);
> > > }
> > > if (trig) {
> > > + /* Make sure the trigger support the LED blink mode */
> > > + if (!led_trigger_is_supported(led_cdev, trig))
> > > + return -EINVAL;
> >
> > Shouldn't validation happen before we start taking any actions? In other
> > words, before we remove the previous trigger?
> >
>
> trigger_set first remove any trigger and set the led off. Then apply the
> new trigger. So the validation is done only when a trigger is actually
> applied. Think we should understand the best case here.

I think this is a question that needs to be answered by the LEDs folk,
as it's an interface behaviour / quality of implementation issue.

> > > @@ -350,12 +381,26 @@ static inline bool led_sysfs_is_disabled(struct led_classdev *led_cdev)
> > >
> > > #define TRIG_NAME_MAX 50
> > >
> > > +enum led_trigger_blink_supported_modes {
> > > + SOFTWARE_ONLY = SOFTWARE_CONTROLLED,
> > > + HARDWARE_ONLY = HARDWARE_CONTROLLED,
> > > + SOFTWARE_HARDWARE = SOFTWARE_HARDWARE_CONTROLLED,
> >
> > I suspect all these generic names are asking for eventual namespace
> > clashes. Maybe prefix them with LED_ ?
>
> Agree they are pretty generic so I can see why... My only concern was
> making them too long... Maybe reduce them to SW or HW? LEDS_SW_ONLY...
> LEDS_SW_CONTROLLED?

Seems sensible to me - and as a bonus they get shorter than the above!

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!