mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
leds: Use assign_bit() where applicable
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> Link: https://patch.msgid.link/20260918141728.3022983-1-peng.fan@oss.nxp.com Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
4893d51ed4
commit
52931e38d7
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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) ||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user