lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 31 Aug 2020 11:10:12 -0700
From:   Alex Qiu <xqiu@...gle.com>
To:     Joel Stanley <joel@....id.au>
Cc:     Tali Perry <tali.perry1@...il.com>, Kun Yi <kunyi@...gle.com>,
        Benjamin Fair <benjaminfair@...gle.com>,
        Avi Fishman <avifishman70@...il.com>,
        Tomer Maimon <tmaimon77@...il.com>,
        Wolfram Sang <wsa@...-dreams.de>, linux-i2c@...r.kernel.org,
        OpenBMC Maillist <openbmc@...ts.ozlabs.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3] i2c: npcm7xx: Fix timeout calculation

On Sun, Aug 30, 2020 at 8:35 PM Joel Stanley <joel@....id.au> wrote:
>
> On Sun, 30 Aug 2020 at 21:31, Tali Perry <tali.perry1@...il.com> wrote:
> >
> > timeout_usec value calculation was wrong, the calculated value
> > was in msec instead of usec.
> >
> > Signed-off-by: Tali Perry <tali.perry1@...il.com>
> > Reviewed-by: Avi Fishman <avifishman70@...il.com>
>
> Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
> Reviewed-by: Joel Stanley <joel@....id.au>
Reviewed-by: Alex Qiu <xqiu@...gle.com>
>
> Cheers,
>
> Joel
>
> > ---
> >  drivers/i2c/busses/i2c-npcm7xx.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
> > index 75f07138a6fa..dfcf04e1967f 100644
> > --- a/drivers/i2c/busses/i2c-npcm7xx.c
> > +++ b/drivers/i2c/busses/i2c-npcm7xx.c
> > @@ -2093,8 +2093,12 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> >                 }
> >         }
> >
> > -       /* 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)
> > +        */
> > +       timeout_usec = (2 * 9 * USEC_PER_SEC / bus->bus_freq) * (2 + nread + nwrite);
> >         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);
> >
> > base-commit: d012a7190fc1fd72ed48911e77ca97ba4521bccd
> > --
> > 2.22.0
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ