[PATCH v2] i2c: npcm7xx: bug fix timeout (usec instead of msec)

Avi Fishman avifishman70 at gmail.com
Mon Aug 31 22:03:34 AEST 2020


Please ignore my last mail, Tali already sent v3.

On Mon, Aug 31, 2020 at 10:57 AM Avi Fishman <avifishman70 at gmail.com> wrote:
>
> On Sun, Aug 30, 2020 at 9:01 PM Andy Shevchenko
> <andy.shevchenko at gmail.com> wrote:
> >
> > On Sun, Aug 30, 2020 at 3:23 PM Tali Perry <tali.perry1 at gmail.com> wrote:
> >
> > >
> > > i2c: npcm7xx: bug fix timeout (usec instead of msec)
> >
> > This commit message is awful. Please read [1] as a tutorial how to
> > write a commit messages.
> >
>
> Would this be better:
> i2c: npcm7xx: Fix microsecond timeout calculation
>
> Inside npcm_i2c_master_xfer() we calculate a timeout for the entire
> transaction in microseconds, the calculation was wrong so big i2c
> massages would timeout before they ended.
> This commit fix that.
>
> > [1]: https://chris.beams.io/posts/git-commit/
> >
> > ...
> >
> > > -       /* Adaptive TimeOut: astimated time in usec + 100% margin */
> > > -       timeout_usec = (2 * 10000 / bus->bus_freq) * (2 + nread + nwrite);
> > > +       /*
> > > +        * Adaptive TimeOut: estimated time in usec + 100% margin:
> > > +        * 2: double the timeout for clock stretching case
> > > +        * 9: bits per transaction (including the ack/nack)
> >
> > > +        * 1000000: micro second in a second
> >
> > No need. See below.
> >
> > > +        */
> >
> > > +       timeout_usec = (2 * 9 * 1000000 / bus->bus_freq) * (2 + nread + nwrite);
> >
> > USEC_PER_SEC
>
> OK
>
> >
> > >         timeout = max(msecs_to_jiffies(35), usecs_to_jiffies(timeout_usec));
> > >         if (nwrite >= 32 * 1024 || nread >= 32 * 1024) {
> > >                 dev_err(bus->dev, "i2c%d buffer too big\n", bus->num);
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
>
>
>
> --
> Regards,
> Avi



-- 
Regards,
Avi


More information about the openbmc mailing list