[PATCH v1] pwm: atmel-tcb: Use min() macro
Shen Lichuan
shenlichuan at vivo.com
Tue Aug 27 00:57:49 PDT 2024
Use the min() macro to simplify the atmel_tcb_pwm_apply() function
and improve its readability.
Signed-off-by: Shen Lichuan <shenlichuan at vivo.com>
---
drivers/pwm/pwm-atmel-tcb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c
index f9a9c12cbcdd..386259eba9b3 100644
--- a/drivers/pwm/pwm-atmel-tcb.c
+++ b/drivers/pwm/pwm-atmel-tcb.c
@@ -342,8 +342,8 @@ static int atmel_tcb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
return 0;
}
- period = state->period < INT_MAX ? state->period : INT_MAX;
- duty_cycle = state->duty_cycle < INT_MAX ? state->duty_cycle : INT_MAX;
+ period = min(state->period, INT_MAX);
+ duty_cycle = min(state->duty_cycle, INT_MAX);
ret = atmel_tcb_pwm_config(chip, pwm, duty_cycle, period);
if (ret)
--
2.17.1
More information about the linux-arm-kernel
mailing list