[PATCH] Revert "pwm: jz4740: Enhance precision in calculation of duty cycle"
From: H. Nikolaus Schaller
Date: Fri Jul 10 2020 - 03:25:09 EST
This reverts commit a6030d71e62d3e0e270bf3b7fb48d32a636732db.
which was applied to v5.4.49. This ends in a compile issue:
CC drivers/pwm/pwm-jz4740.o - due to target missing
drivers/pwm/pwm-jz4740.c: In function 'jz4740_pwm_apply':
drivers/pwm/pwm-jz4740.c:111:28: error: 'rate' undeclared (first use in this function)
tmp = (unsigned long long)rate * state->duty_cycle;
^
drivers/pwm/pwm-jz4740.c:111:28: note: each undeclared identifier is reported only once for each function it appears in
make[4]: *** [drivers/pwm/pwm-jz4740.o] Error 1
v5.5 and later include the required additional patches to define
the rate variable.
Fixes: a6030d71e62d ("pwm: jz4740: Enhance precision in calculation of duty cycle")
Cc: stable@xxxxxxxxxxxxxxx # v5.4.49
Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
drivers/pwm/pwm-jz4740.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c
index d0f5c69930d0d9..9d78cc21cb1279 100644
--- a/drivers/pwm/pwm-jz4740.c
+++ b/drivers/pwm/pwm-jz4740.c
@@ -108,8 +108,8 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
if (prescaler == 6)
return -EINVAL;
- tmp = (unsigned long long)rate * state->duty_cycle;
- do_div(tmp, NSEC_PER_SEC);
+ tmp = (unsigned long long)period * state->duty_cycle;
+ do_div(tmp, state->period);
duty = period - tmp;
if (duty >= period)
--
2.26.2