Skip to content

Commit 51f8137

Browse files
Shen LichuanUwe Kleine-König
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Uwe Kleine-König <[email protected]>
1 parent 517fb4d commit 51f8137

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/pwm/pwm-atmel-tcb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ static int atmel_tcb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
342342
return 0;
343343
}
344344

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);
347347

348348
ret = atmel_tcb_pwm_config(chip, pwm, duty_cycle, period);
349349
if (ret)

0 commit comments

Comments
 (0)