Re: [PATCH v11 04/12] pwm: clps711x: Cast period to u32 before use as divisor

From: Arnd Bergmann
Date: Fri Mar 20 2020 - 13:12:03 EST


On Fri, Mar 20, 2020 at 2:41 AM Guru Das Srinagesh <gurus@xxxxxxxxxxxxxx> wrote:
>
> Since the PWM framework is switching struct pwm_args.period's datatype
> to u64, prepare for this transition by typecasting it to u32.
>
> Also, since the dividend is still a 32-bit number, any divisor greater
> than UINT_MAX will cause the quotient to be zero, so return 0 in that
> case to efficiently skip the division.
>
> Cc: Alexander Shiyan <shc_work@xxxxxxx>
> Cc: Arnd Bergmann <arnd@xxxxxxxx>
>
> Signed-off-by: Guru Das Srinagesh <gurus@xxxxxxxxxxxxxx>

Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>