Skip to content

Commit cad0f29

Browse files
Villemoesthierryreding
authored andcommitted
pwm: rockchip: Simplify rockchip_pwm_get_state()
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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent ca162ce commit cad0f29

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

drivers/pwm/pwm-rockchip.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,7 @@ static void rockchip_pwm_get_state(struct pwm_chip *chip,
8383
state->duty_cycle = DIV_ROUND_CLOSEST_ULL(tmp, clk_rate);
8484

8585
val = readl_relaxed(pc->base + pc->data->regs.ctrl);
86-
if (pc->data->supports_polarity)
87-
state->enabled = ((val & enable_conf) != enable_conf) ?
88-
false : true;
89-
else
90-
state->enabled = ((val & enable_conf) == enable_conf) ?
91-
true : false;
86+
state->enabled = (val & enable_conf) == enable_conf;
9287

9388
if (pc->data->supports_polarity && !(val & PWM_DUTY_POSITIVE))
9489
state->polarity = PWM_POLARITY_INVERSED;

0 commit comments

Comments
 (0)