Hi Miquèl On Mon, Dec 16, 2019 at 10:14:16AM +0100, Miquel Raynal wrote: > Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote on Mon, 16 Dec > 2019 09:54:24 +0100: > > intensity = DIV_ROUND_DOWN_ULL((unsigned long long)state->duty_cycle * PWM_DC_STATES, state->period); > > > > should be both more exact and cheaper to calculate. (But this is > > somewhat moot given that state->period shouldn't be there.) > > (And in general you have to care for overflowing, but I think that's not > > a problem in practise here as struct pwm_state::duty_cycle is an int > > (still), and PWM_DC_STATES is small.) > > Do you plan to change duty_cycle type? I don't, but https://patchwork.ozlabs.org/patch/1195481/ Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |