Skip to content

Commit 2f372a5

Browse files
Pei Xiaolag-linaro
authored andcommitted
leds: st1202: Refactor st1202_led_set() to use !! operator for boolean conversion
st1202_led_set function now uses the !! operator to convert the enum led_brightness() value to a boolean active state, which is then passed to the st1202_channel_set() function. This change maintains the existing functionality. cocci warnings: drivers/leds/leds-st1202.c:194:66-71: WARNING: conversion to bool not needed here. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Pei Xiao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 9ec336b commit 2f372a5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/leds/leds-st1202.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,8 @@ static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool active
189189
static int st1202_led_set(struct led_classdev *ldev, enum led_brightness value)
190190
{
191191
struct st1202_led *led = cdev_to_st1202_led(ldev);
192-
struct st1202_chip *chip = led->chip;
193192

194-
return st1202_channel_set(chip, led->led_num, value == LED_OFF ? false : true);
193+
return st1202_channel_set(led->chip, led->led_num, !!value);
195194
}
196195

197196
static int st1202_led_pattern_clear(struct led_classdev *ldev)

0 commit comments

Comments
 (0)