diff mbox series

pwm: max7360: Clean MAX7360 code

Message ID 20250924-mdb-max7360-pwm-optimize-v1-1-5959eeed20d8@bootlin.com
State Accepted
Headers show
Series pwm: max7360: Clean MAX7360 code | expand

Commit Message

Mathieu Dubois-Briand Sept. 24, 2025, 9:06 a.m. UTC
Duty steps computation can never end in values higher than
MAX7360_PWM_MAX: remove useless use of min().

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
This was discussed in the MAX7360 series[1], and I believe we can indeed
remove this check.

[1] https://lore.kernel.org/all/20250824-mdb-max7360-support-v14-0-435cfda2b1ea@bootlin.com/
---
 drivers/pwm/pwm-max7360.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: ce7f1a983b074f6cf8609068088ca3182c569ee4
change-id: 20250924-mdb-max7360-pwm-optimize-bcdae528f579

Best regards,

Comments

Uwe Kleine-König Sept. 24, 2025, 2:36 p.m. UTC | #1
Hello Mathieu,

On Wed, Sep 24, 2025 at 11:06:40AM +0200, Mathieu Dubois-Briand wrote:
> Duty steps computation can never end in values higher than
> MAX7360_PWM_MAX: remove useless use of min().
> 
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

Suggested-by: Uwe Kleine-König <ukleinek@kernel.org>

I'll pick that up once the driver makes it into my tree.

Thanks for caring
Uwe
Uwe Kleine-König Oct. 21, 2025, 10:53 a.m. UTC | #2
On Wed, Sep 24, 2025 at 11:06:40AM +0200, Mathieu Dubois-Briand wrote:
> Duty steps computation can never end in values higher than
> MAX7360_PWM_MAX: remove useless use of min().
> 
> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> ---
> This was discussed in the MAX7360 series[1], and I believe we can indeed
> remove this check.
> 
> [1] https://lore.kernel.org/all/20250824-mdb-max7360-support-v14-0-435cfda2b1ea@bootlin.com/

Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next
as 4.19-rc1 material.

Thanks
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm-max7360.c b/drivers/pwm/pwm-max7360.c
index ebf93a7aee5be4cfdac89601b78e6d20955f4877..16261958ce7ffb261b5a7cc7b1d47f63d6d398c2 100644
--- a/drivers/pwm/pwm-max7360.c
+++ b/drivers/pwm/pwm-max7360.c
@@ -75,7 +75,7 @@  static int max7360_pwm_round_waveform_tohw(struct pwm_chip *chip,
 			duty_steps = MAX7360_PWM_MAX - 1;
 	}
 
-	wfhw->duty_steps = min(MAX7360_PWM_MAX, duty_steps);
+	wfhw->duty_steps = duty_steps;
 	wfhw->enabled = !!wf->period_length_ns;
 
 	if (wf->period_length_ns && wf->period_length_ns < MAX7360_PWM_PERIOD_NS)