linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <uwe@kleine-koenig.org>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Pavel Machek <pavel@ucw.cz>
Cc: Jeff LaBundy <jeff@labundy.com>, Dan Murphy <dmurphy@ti.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	linux-leds@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: [PATCH 1/3] leds: pwm: simplify if condition
Date: Fri, 24 Jan 2020 17:54:07 +0100	[thread overview]
Message-ID: <20200124165409.12422-2-uwe@kleine-koenig.org> (raw)
In-Reply-To: <20200124165409.12422-1-uwe@kleine-koenig.org>

.pwm_period_ns is an unsigned integer. So when led->pwm_period_ns > 0
is false, we now assign 0 to a value that is already 0, so it doesn't
hurt and we can skip checking the actual value.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
---
 drivers/leds/leds-pwm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
index 8b6965a563e9..b72fd89ff390 100644
--- a/drivers/leds/leds-pwm.c
+++ b/drivers/leds/leds-pwm.c
@@ -102,7 +102,7 @@ static int led_pwm_add(struct device *dev, struct led_pwm_priv *priv,
 	pwm_get_args(led_data->pwm, &pargs);
 
 	led_data->period = pargs.period;
-	if (!led_data->period && (led->pwm_period_ns > 0))
+	if (!led_data->period)
 		led_data->period = led->pwm_period_ns;
 
 	ret = devm_led_classdev_register(dev, &led_data->cdev);
-- 
2.24.0


  reply	other threads:[~2020-01-24 17:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 16:54 [PATCH 0/3] leds: pwm: some cleanups Uwe Kleine-König
2020-01-24 16:54 ` Uwe Kleine-König [this message]
2020-01-26 18:55   ` [PATCH 1/3] leds: pwm: simplify if condition Jeff LaBundy
2020-01-24 16:54 ` [PATCH 2/3] leds: pwm: convert to atomic PWM API Uwe Kleine-König
2020-01-26 19:15   ` Jeff LaBundy
2020-02-26 14:35     ` Pavel Machek
2020-02-26 14:55       ` Uwe Kleine-König
2020-01-24 16:54 ` [PATCH 3/3] leds: pwm: don't set the brightness during .probe Uwe Kleine-König
2020-01-26 19:42   ` Jeff LaBundy
2020-01-27  7:41     ` Uwe Kleine-König

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=20200124165409.12422-2-uwe@kleine-koenig.org \
    --to=uwe@kleine-koenig.org \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=jeff@labundy.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=thierry.reding@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).