Thread (53 messages) 53 messages, 9 authors, 2023-01-30

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

From: "Russell King (Oracle)" <linux@armlinux.org.uk>
Date: 2022-12-16 16:52:31
Also in: linux-devicetree, linux-doc, linux-leds, lkml

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:
quoted
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.
quoted
On Thu, Dec 15, 2022 at 12:54:28AM +0100, Christian Marangi wrote:
quoted
@@ -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.
quoted
quoted
@@ -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!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help