From: xiaopeitux@foxmail.com
To: vicentiu.galanopulo@remote-tech.co.uk,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
lee@kernel.org, pavel@kernel.org
Cc: Pei Xiao <xiaopei01@kylinos.cn>, kernel test robot <lkp@intel.com>
Subject: [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion
Date: Wed, 19 Feb 2025 10:42:02 +0800 [thread overview]
Message-ID: <tencent_3DF7518D407679C99C4CCCB1B8E64638700A@qq.com> (raw)
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
next reply other threads:[~2025-02-19 2:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-19 2:42 xiaopeitux [this message]
2025-02-20 15:48 ` (subset) [PATCH] leds: Refactor st1202_led_set to use !! operator for boolean conversion Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_3DF7518D407679C99C4CCCB1B8E64638700A@qq.com \
--to=xiaopeitux@foxmail.com \
--cc=lee@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=lkp@intel.com \
--cc=pavel@kernel.org \
--cc=vicentiu.galanopulo@remote-tech.co.uk \
--cc=xiaopei01@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox