From: "oUwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
David Wu <david.wu@rock-chips.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Heiko Stuebner <heiko@sntech.de>,
linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pwm: rockchip: simplify rockchip_pwm_get_state()
Date: Thu, 19 Sep 2019 13:11:15 +0200 [thread overview]
Message-ID: <20190919111115.5oraof2bdl4627xv@pengutronix.de> (raw)
In-Reply-To: <20190919091728.24756-1-linux@rasmusvillemoes.dk>
On Thu, Sep 19, 2019 at 11:17:27AM +0200, Rasmus Villemoes wrote:
> The way state->enabled is computed is rather convoluted and hard to
> read - both branches of the if() actually do the exact same thing. So
> remove the if(), and further simplify "<boolean condition> ? true :
> false" to "<boolean condition>".
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> I stumbled on this while trying to understand how the pwm subsystem
> works. This patch is a semantic no-op, but it's also possible that,
> say, the first branch simply contains a "double negative" so either
> the != should be == or the "false : true" should be "true : false".
The change looks obviously right, it's a noop.
I share your doubts however. The construct was introduced in commit
831b2790507b ("pwm: rockchip: Use same PWM ops for each IP") by David
Wu.
Before there were rockchip_pwm_get_state_v1 for the supports_polarity =
false case and rockchip_pwm_get_state_v2 for supports_polarity = true.
In both state->enabled was assigned true if ((val & enable_conf) ==
enable_conf). So I assume everything is fine.
A confirmation by David would be great though.
As a side note: Is there publicly available documentation for this IP?
If a link were added to the driver's header we could check easily
ourselves.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2019-09-19 11:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-19 9:17 Rasmus Villemoes
2019-09-19 11:11 ` oUwe Kleine-König [this message]
2020-05-23 20:01 ` Uwe Kleine-König
2020-06-02 12:39 ` Thierry Reding
2020-06-03 3:10 ` David Wu
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=20190919111115.5oraof2bdl4627xv@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--cc=david.wu@rock-chips.com \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@rasmusvillemoes.dk \
--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
all inboxes | Powered by JetHome®