lkml.org 
[lkml]   [2020]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v11 06/12] pwm: imx27: Use 64-bit division macro and function
On Mon, Mar 30, 2020 at 10:44 PM Guru Das Srinagesh
<gurus@codeaurora.org> wrote:
>
> On Fri, Mar 20, 2020 at 06:09:39PM +0100, Arnd Bergmann wrote:
> > On Fri, Mar 20, 2020 at 2:42 AM Guru Das Srinagesh <gurus@codeaurora.org> wrote:
> >
> > > @@ -240,8 +240,7 @@ static int pwm_imx27_apply(struct pwm_chip *chip, struct pwm_device *pwm,
> > >
> > > period_cycles /= prescale;
> > > c = (unsigned long long)period_cycles * state->duty_cycle;
> > > - do_div(c, state->period);
> > > - duty_cycles = c;
> > > + duty_cycles = div64_u64(c, state->period);
> > >
> >
> > This change looks fine, but I wonder if the code directly above it
> >
> > c = clk_get_rate(imx->clk_per);
> > c *= state->period;
> > do_div(c, 1000000000);
> > period_cycles = c;
> >
> > might run into an overflow when both the clock rate and the period
> > are large numbers.
>
> Hmm. Seems to me like addressing this would be outside the scope of this
> patch series.

I think it should be part of the same series, addressing bugs that
were introduced
by the change to 64-bit period. If it's not getting fixed along with
the other regressions,
I fear nobody is going to go back and fix it later.

Arnd

\
 
 \ /
  Last update: 2020-03-31 17:26    [W:0.098 / U:0.600 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site