From: Sven Schwermer sven.schwermer@disruptive-technologies.com
[ Upstream commit e35ca991a777ef513040cbb36bc8245a031a2633 ]
When writing to the multi_intensity file, don't unconditionally call led_set_brightness. By only doing this if blinking is inactive we prevent blinking from stopping if the blinking is in its off phase while the file is written.
Instead, if blinking is active, the changed intensity values are applied upon the next blink. This is consistent with changing the brightness on monochrome LEDs with active blinking.
Suggested-by: Jacek Anaszewski jacek.anaszewski@gmail.com Acked-by: Jacek Anaszewski jacek.anaszewski@gmail.com Acked-by: Pavel Machek pavel@ucw.cz Reviewed-by: Tobias Deiminger tobias.deiminger@linutronix.de Tested-by: Sven Schuchmann schuchmann@schleissheimer.de Signed-off-by: Sven Schwermer sven.schwermer@disruptive-technologies.com Link: https://lore.kernel.org/r/20250404184043.227116-1-sven@svenschwermer.de Signed-off-by: Lee Jones lee@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
Now I have a complete understanding of the commit. Let me analyze this commit for backport suitability:
**YES**
This commit should be backported to stable kernel trees for the following reasons:
## **Bug Analysis:**
**The Problem:** In the multicolor LED driver, writing to the `multi_intensity` file unconditionally calls `led_set_brightness()` at line 62. When software blinking is active (`LED_BLINK_SW` flag set), this can incorrectly stop the blinking if the LED is currently in its "off" phase during the blink cycle.
**The Fix:** The commit adds a check `if (!test_bit(LED_BLINK_SW, &led_cdev->work_flags))` before calling `led_set_brightness()`. This ensures that when software blinking is active, the intensity changes are deferred and applied on the next blink cycle instead of immediately stopping the blinking.
## **Backport Suitability:**
1. **Bug Impact:** This fixes a clear user-visible regression where adjusting multicolor LED intensity incorrectly stops blinking - a functionality that users would expect to work consistently.
2. **Code Quality:** The fix is minimal, surgical, and follows established patterns in the LED subsystem. Looking at the LED core code (`/home/sasha/linux/drivers/leds/led-core.c`), similar checks for `LED_BLINK_SW` are used in `led_set_brightness()` to handle software blinking properly.
3. **Risk Assessment:** The change is extremely low-risk: - Single line addition with a simple conditional check - No architectural changes - Uses existing, well-tested flag (`LED_BLINK_SW`) - Consistent with established LED core behavior patterns
4. **Subsystem Scope:** The change is confined to the multicolor LED class interface, affecting only multicolor LEDs, not the broader LED subsystem.
5. **Backport Indicators:** The commit has explicit support from maintainers with multiple "Acked-by", "Reviewed-by", and "Tested-by" tags, indicating thorough review and validation.
6. **Consistency:** This aligns with similar commits marked as backport candidates (like Similar Commit #4 which was marked YES for fixing LED core blinking regression).
## **Historical Context:**
From the similar commits analysis, LED blinking fixes that restore expected behavior (like Similar Commit #4) are consistently backported, while new features or documentation-only changes (Similar Commits #1, #2, #3, #5) are not.
This commit clearly falls into the "restore expected behavior" category - multicolor LED intensity adjustment should work consistently regardless of blinking state, just like it does for monochrome LEDs.
The fix ensures behavioral consistency between multicolor and monochrome LEDs during blinking, which is exactly the type of user-facing bug fix that stable trees are designed to address.
drivers/leds/led-class-multicolor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/led-class-multicolor.c b/drivers/leds/led-class-multicolor.c index b2a87c9948165..fd66d2bdeace8 100644 --- a/drivers/leds/led-class-multicolor.c +++ b/drivers/leds/led-class-multicolor.c @@ -59,7 +59,8 @@ static ssize_t multi_intensity_store(struct device *dev, for (i = 0; i < mcled_cdev->num_colors; i++) mcled_cdev->subled_info[i].intensity = intensity_value[i];
- led_set_brightness(led_cdev, led_cdev->brightness); + if (!test_bit(LED_BLINK_SW, &led_cdev->work_flags)) + led_set_brightness(led_cdev, led_cdev->brightness); ret = size; err_out: mutex_unlock(&led_cdev->led_access);