Skip to content

Commit

Permalink
pwm: meson: remove not needed check in meson_pwm_calc
Browse files Browse the repository at this point in the history
period >= duty implies that cnt >= duty_cnt. We verified before
that cnt <= 0xffff, therefore we can omit the check here.

Suggested-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Heiner Kallweit <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
  • Loading branch information
hkallweit authored and thierryreding committed Jun 23, 2023
1 parent 87a2cbf commit bafa23b
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions drivers/pwm/pwm-meson.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,7 @@ static int meson_pwm_calc(struct meson_pwm *meson, struct pwm_device *pwm,
channel->hi = 0;
channel->lo = cnt;
} else {
/* Then check is we can have the duty with the same pre_div */
duty_cnt = div64_u64(fin_freq * duty, NSEC_PER_SEC * (pre_div + 1));
if (duty_cnt > 0xffff) {
dev_err(meson->chip.dev, "unable to get duty cycle\n");
return -EINVAL;
}

dev_dbg(meson->chip.dev, "duty=%llu pre_div=%u duty_cnt=%u\n",
duty, pre_div, duty_cnt);
Expand Down

0 comments on commit bafa23b

Please sign in to comment.