Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Shen Lichuan and committed by
Uwe Kleine-König
51f81370 517fb4d7

+2 -2
+2 -2
drivers/pwm/pwm-atmel-tcb.c
··· 342 342 return 0; 343 343 } 344 344 345 - period = state->period < INT_MAX ? state->period : INT_MAX; 346 - duty_cycle = state->duty_cycle < INT_MAX ? state->duty_cycle : INT_MAX; 345 + period = min(state->period, INT_MAX); 346 + duty_cycle = min(state->duty_cycle, INT_MAX); 347 347 348 348 ret = atmel_tcb_pwm_config(chip, pwm, duty_cycle, period); 349 349 if (ret)