* [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion
@ 2025-02-19 2:42 xiaopeitux
2025-02-20 15:48 ` (subset) " Lee Jones
0 siblings, 1 reply; 2+ messages in thread
From: xiaopeitux @ 2025-02-19 2:42 UTC (permalink / raw)
To: vicentiu.galanopulo, linux-leds, linux-kernel, lee, pavel
Cc: Pei Xiao, kernel test robot
From: Pei Xiao <xiaopei01@kylinos.cn>
cocci warnings:
drivers/leds/leds-st1202.c:194:66-71: WARNING: conversion to bool not
needed here.
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.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202502181845.xESVrC61-lkp@intel.com/
Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
---
drivers/leds/leds-st1202.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/leds/leds-st1202.c b/drivers/leds/leds-st1202.c
index b691c4886993..361c431a03c5 100644
--- a/drivers/leds/leds-st1202.c
+++ b/drivers/leds/leds-st1202.c
@@ -189,9 +189,8 @@ static int st1202_channel_set(struct st1202_chip *chip, int led_num, bool active
static int st1202_led_set(struct led_classdev *ldev, enum led_brightness value)
{
struct st1202_led *led = cdev_to_st1202_led(ldev);
- struct st1202_chip *chip = led->chip;
- return st1202_channel_set(chip, led->led_num, value == LED_OFF ? false : true);
+ return st1202_channel_set(led->chip, led->led_num, !!value);
}
static int st1202_led_pattern_clear(struct led_classdev *ldev)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: (subset) [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion
2025-02-19 2:42 [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion xiaopeitux
@ 2025-02-20 15:48 ` Lee Jones
0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2025-02-20 15:48 UTC (permalink / raw)
To: vicentiu.galanopulo, linux-leds, linux-kernel, lee, pavel,
xiaopeitux
Cc: Pei Xiao, kernel test robot
On Wed, 19 Feb 2025 10:42:02 +0800, xiaopeitux@foxmail.com wrote:
> cocci warnings:
> drivers/leds/leds-st1202.c:194:66-71: WARNING: conversion to bool not
> needed here.
>
> 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.
>
> [...]
Applied, thanks!
[1/1] leds: Refactor st1202_led_set to use !! operator for boolean conversion
commit: 2f372a5dce6885f1d2647f7add01756bee0fef49
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-20 15:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-19 2:42 [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion xiaopeitux
2025-02-20 15:48 ` (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