Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: pwm-meson: remove not needed check in meson_pwm_calc
@ 2023-05-04  5:35 Heiner Kallweit
  2023-05-04  6:47 ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2023-05-04  5:35 UTC (permalink / raw)
  To: Jerome Brunet, Martin Blumenstingl, Neil Armstrong, Kevin Hilman,
	Uwe Kleine-König, thierry.reding@gmail.com
  Cc: linux-arm-kernel@lists.infradead.org,
	open list:ARM/Amlogic Meson..., linux-pwm

duty <= period implies that duty_cnt <= cnt. We verified before
that cnt <= 0xffff, therefore we can omit the check here.

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
Note: Applies only after "pwm: pwm-meson: fix handling of period/duty if greater than UINT_MAX"
---
 drivers/pwm/pwm-meson.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c
index 33107204a..aad4a0ed3 100644
--- a/drivers/pwm/pwm-meson.c
+++ b/drivers/pwm/pwm-meson.c
@@ -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);
-- 
2.40.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-04  9:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-04  5:35 [PATCH] pwm: pwm-meson: remove not needed check in meson_pwm_calc Heiner Kallweit
2023-05-04  6:47 ` Uwe Kleine-König
2023-05-04  9:11   ` Thierry Reding
2023-05-04  9:42     ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox