Re: [PATCH v7 04/11] pwm: max7360: Add MAX7360 PWM support
From: Mathieu Dubois-Briand
Date: Fri May 02 2025 - 08:14:12 EST
On Fri May 2, 2025 at 12:19 PM CEST, Andy Shevchenko wrote:
> On Mon, Apr 28, 2025 at 01:57:22PM +0200, mathieu.dubois-briand@xxxxxxxxxxx wrote:
>> From: Kamel Bouhara <kamel.bouhara@xxxxxxxxxxx>
>>
>> +static int max7360_pwm_round_waveform_fromhw(struct pwm_chip *chip, struct pwm_device *pwm,
>> + const void *_wfhw, struct pwm_waveform *wf)
>> +{
>> + const struct max7360_pwm_waveform *wfhw = _wfhw;
>> +
>> + wf->period_length_ns = wfhw->enabled ? MAX7360_PWM_PERIOD_NS : 0;
>> + wf->duty_offset_ns = 0;
>> + wf->duty_length_ns = DIV64_U64_ROUND_UP(wfhw->duty_steps * MAX7360_PWM_PERIOD_NS,
>
> Does the numerator have already 64-bit type? Otherwise (u)int*(u)int will be
> just an (u)int.
>
Err no, this section has been modified back and forth, but today we have
u8 * 2 * 1000000L, so we will always fit in a u32.
I will use DIV_ROUND_UP() instead.
> ...
OK with all other comments.
Thanks for your review.
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com