Re: [PATCH v4 1/1] pwm: Convert period and duty cycle to u64

From: Guru Das Srinagesh
Date: Wed Jan 15 2020 - 19:55:06 EST


Hi Uwe,

On Tue, Jan 14, 2020 at 08:47:10AM +0100, Uwe Kleine-KÃnig wrote:
> I didn't thought about that much, but it would be great if we could
> prepare the affected drivers to work with both, int and u64 and switch
> in a separate commit. Reverting would then become cheaper.
> The conversion to 64-bit division macros could be done even without
> actually converting period and duty cycle, couldn't it?

I do agree that with such a two-step process the reverting (should the
need arise) would be much cheaper. I tried out your suggestion and saw
that this is not possible as the patch stands currently due to
compilation warning and errors that arise for various architectures:

warning: comparison of distinct pointer types lacks a cast
warning: right shift count >= width of type [-Wshift-count-overflow]
error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types]
note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'unsigned int *'
warning: format '%llu' expects argument of type 'long long unsigned int', but argument 4 has type 'unsigned int' [-Wformat=]

Could you please indicate how we should proceed further?

> This Reported-by: looks wrong. It gave some hints about what had to be
> improved in an earlier revision of this patch, but usually this means
> that the patch is a fix for an earlier commit. So I would put this in
> the text, something like:
>
> The kbuild test robot helped to improve this patch series to
> (hopefully) catch all code sites having to be adapted.

Noted, will make this change.

> In ir-rx51.c you used DIV_ROUND_CLOSEST_ULL to replace
> DIV_ROUND_CLOSEST, here it is DIV64_U64_ROUND_CLOSEST. Maybe it is worth
> to describe the relevant difference shortly in the commit log.

Sure, will make a note of this in the commit log. In short, one is used
when only the numerator is 64-bit while the other is meant for the case
when both numerator and denominator are 64-bit.

Thank you.

Guru Das.