diff mbox series

[v1] pwm: atmel-tcb: Use min() macro

Message ID 20240827075749.67583-1-shenlichuan@vivo.com (mailing list archive)
State New, archived
Headers show
Series [v1] pwm: atmel-tcb: Use min() macro | expand

Commit Message

Shen Lichuan Aug. 27, 2024, 7:57 a.m. UTC
Use the min() macro to simplify the atmel_tcb_pwm_apply() function
and improve its readability.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
---
 drivers/pwm/pwm-atmel-tcb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Uwe Kleine-König Sept. 17, 2024, 3:15 p.m. UTC | #1
Hello,

On Tue, Aug 27, 2024 at 03:57:49PM +0800, Shen Lichuan wrote:
> Use the min() macro to simplify the atmel_tcb_pwm_apply() function
> and improve its readability.

applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-nexxt
. As the merge window is currently open this will not go into next yet,
but I'll schedule it for 6.13-rc1.

Best regards and thanks for your contribution,
Uwe
diff mbox series

Patch

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)