* [PATCH] leds: use assign_bit() where applicable
@ 2026-09-18 14:17 Peng Fan (OSS)
2026-09-18 14:26 ` sashiko-bot
2026-09-23 15:17 ` (subset) " Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Peng Fan (OSS) @ 2026-09-18 14:17 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Andrew Lunn, Peng Fan,
Mike Marciniszyn (Meta), Jakub Kicinski, Kees Cook
Cc: linux-kernel, linux-leds
From: Peng Fan <peng.fan@nxp.com>
Convert open-coded if/else with set_bit/clear_bit and their
non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit
API.
Done with Coccinelle semantic patch and manual fixups.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
drivers/leds/led-core.c | 5 +----
drivers/leds/leds-pca963x.c | 5 +----
drivers/leds/trigger/ledtrig-netdev.c | 5 +----
3 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 073c547068cc..80e281dce195 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -267,10 +267,7 @@ void led_blink_set_oneshot(struct led_classdev *led_cdev,
set_bit(LED_BLINK_ONESHOT, &led_cdev->work_flags);
clear_bit(LED_BLINK_ONESHOT_STOP, &led_cdev->work_flags);
- if (invert)
- set_bit(LED_BLINK_INVERT, &led_cdev->work_flags);
- else
- clear_bit(LED_BLINK_INVERT, &led_cdev->work_flags);
+ assign_bit(LED_BLINK_INVERT, &led_cdev->work_flags, invert);
led_blink_setup(led_cdev, delay_on, delay_off);
}
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c
index 605cf7497e4c..5363afbe93ea 100644
--- a/drivers/leds/leds-pca963x.c
+++ b/drivers/leds/leds-pca963x.c
@@ -208,10 +208,7 @@ static void pca963x_track_power_state(struct pca963x_led *led, unsigned int led_
{
unsigned long *leds_on = &led->chip->leds_on;
- if (brightness)
- set_bit(led_num, leds_on);
- else
- clear_bit(led_num, leds_on);
+ assign_bit(led_num, leds_on, brightness);
}
static int pca963x_sync_power_state(struct pca963x_led *led, unsigned long cached_leds)
diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index 5b4e92c14dbb..7e43fa30130c 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -414,10 +414,7 @@ static ssize_t netdev_led_attr_store(struct device *dev, const char *buf,
return -EINVAL;
}
- if (state)
- set_bit(bit, &mode);
- else
- clear_bit(bit, &mode);
+ assign_bit(bit, &mode, state);
if (test_bit(TRIGGER_NETDEV_LINK, &mode) &&
(test_bit(TRIGGER_NETDEV_LINK_10, &mode) ||
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: use assign_bit() where applicable
2026-09-18 14:17 [PATCH] leds: use assign_bit() where applicable Peng Fan (OSS)
@ 2026-09-18 14:26 ` sashiko-bot
2026-09-23 15:17 ` (subset) " Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-18 14:26 UTC (permalink / raw)
To: Peng Fan (OSS); +Cc: linux-leds, lee
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] leds: commit message description is not capitalized
--
commit 4b1968fcc8204102041e265576cd6e2a93a963a3
Author: Peng Fan <peng.fan@nxp.com>
leds: use assign_bit() where applicable
This commit converts open-coded if/else sequences using set_bit and
clear_bit variants to the unified assign_bit API using Coccinelle.
> leds: use assign_bit() where applicable
[Severity: Low]
This isn't a bug, but the commit message description after the
subsystem prefix is not capitalized. According to the LED subsystem
guidelines, it should start with a capital letter.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918141728.3022983-1-peng.fan@oss.nxp.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: (subset) [PATCH] leds: use assign_bit() where applicable
2026-09-18 14:17 [PATCH] leds: use assign_bit() where applicable Peng Fan (OSS)
2026-09-18 14:26 ` sashiko-bot
@ 2026-09-23 15:17 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-09-23 15:17 UTC (permalink / raw)
To: Lee Jones, Pavel Machek, Andrew Lunn, Peng Fan,
Mike Marciniszyn (Meta), Jakub Kicinski, Kees Cook,
Peng Fan (OSS)
Cc: linux-kernel, linux-leds
On Fri, 18 Sep 2026 22:17:23 +0800, Peng Fan (OSS) wrote:
> Convert open-coded if/else with set_bit/clear_bit and their
> non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit
> API.
>
> Done with Coccinelle semantic patch and manual fixups.
>
>
> [...]
Applied, thanks!
[1/1] leds: use assign_bit() where applicable
commit: 52931e38d7eeb28bacc5e7fef2afddd08baa0ecb
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-23 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 14:17 [PATCH] leds: use assign_bit() where applicable Peng Fan (OSS)
2026-09-18 14:26 ` sashiko-bot
2026-09-23 15:17 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox