mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-28 16:56:26 +00:00
pwm: atmel-tcb: Use min() macro
Use the min() macro to simplify the atmel_tcb_pwm_apply() function and improve its readability. Signed-off-by: Shen Lichuan <shenlichuan@vivo.com> Link: https://lore.kernel.org/r/20240827075749.67583-1-shenlichuan@vivo.com Signed-off-by: Uwe Kleine-König <ukleinek@kernel.org>
This commit is contained in:
parent
517fb4d77c
commit
51f8137022
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user