* Re: [PATCH 1/2] i2c: octeon: Fix register access
[not found] <20161107200921.30284-1-paul.burton@imgtec.com>
@ 2016-11-08 7:13 ` Jan Glauber
2016-11-09 14:09 ` Paul Burton
2016-11-10 20:17 ` Wolfram Sang
0 siblings, 2 replies; 4+ messages in thread
From: Jan Glauber @ 2016-11-08 7:13 UTC (permalink / raw)
To: Paul Burton; +Cc: linux-i2c, linux-mips, David Daney, Wolfram Sang, stable
On Mon, Nov 07, 2016 at 08:09:20PM +0000, Paul Burton wrote:
> Commit 70121f7f3725 ("i2c: octeon: thunderx: Limit register access
> retries") attempted to replace potentially infinite loops with ones
> which will time out using readq_poll_timeout, but in doing so it
> inverted the condition for exiting this loop.
>
> Tested on a Rhino Labs UTM-8 with Octeon CN7130.
>
> Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> Cc: Jan Glauber <jglauber@cavium.com>
> Cc: David Daney <david.daney@cavium.com>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: linux-i2c@vger.kernel.org
>
> ---
Acked-by: Jan Glauber <jglauber@cavium.com>
Thanks for spotting this. I think this should go into stable too for
4.8, so adding Cc: stable@vger.kernel.org.
> drivers/i2c/busses/i2c-octeon-core.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-octeon-core.h b/drivers/i2c/busses/i2c-octeon-core.h
> index 1db7c83..d980406 100644
> --- a/drivers/i2c/busses/i2c-octeon-core.h
> +++ b/drivers/i2c/busses/i2c-octeon-core.h
> @@ -146,8 +146,9 @@ static inline void octeon_i2c_reg_write(struct octeon_i2c *i2c, u64 eop_reg, u8
>
> __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base + SW_TWSI(i2c));
>
> - readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp & SW_TWSI_V,
> - I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout);
> + readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> + i2c->adap.timeout);
> }
>
> #define octeon_i2c_ctl_write(i2c, val) \
> @@ -173,7 +174,7 @@ static inline int octeon_i2c_reg_read(struct octeon_i2c *i2c, u64 eop_reg,
> __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base + SW_TWSI(i2c));
>
> ret = readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> - tmp & SW_TWSI_V, I2C_OCTEON_EVENT_WAIT,
> + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> i2c->adap.timeout);
> if (error)
> *error = ret;
> --
> 2.10.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: octeon: Fix register access
2016-11-08 7:13 ` [PATCH 1/2] i2c: octeon: Fix register access Jan Glauber
@ 2016-11-09 14:09 ` Paul Burton
2016-11-09 14:43 ` Jan Glauber
2016-11-10 20:17 ` Wolfram Sang
1 sibling, 1 reply; 4+ messages in thread
From: Paul Burton @ 2016-11-09 14:09 UTC (permalink / raw)
To: Jan Glauber; +Cc: linux-i2c, linux-mips, David Daney, Wolfram Sang, stable
[-- Attachment #1: Type: text/plain, Size: 2275 bytes --]
On Tuesday, 8 November 2016 08:13:37 GMT Jan Glauber wrote:
> On Mon, Nov 07, 2016 at 08:09:20PM +0000, Paul Burton wrote:
> > Commit 70121f7f3725 ("i2c: octeon: thunderx: Limit register access
> > retries") attempted to replace potentially infinite loops with ones
> > which will time out using readq_poll_timeout, but in doing so it
> > inverted the condition for exiting this loop.
> >
> > Tested on a Rhino Labs UTM-8 with Octeon CN7130.
> >
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Jan Glauber <jglauber@cavium.com>
> > Cc: David Daney <david.daney@cavium.com>
> > Cc: Wolfram Sang <wsa@the-dreams.de>
> > Cc: linux-i2c@vger.kernel.org
> >
> > ---
>
> Acked-by: Jan Glauber <jglauber@cavium.com>
>
> Thanks for spotting this. I think this should go into stable too for
> 4.8, so adding Cc: stable@vger.kernel.org.
Hi Jan,
...but the bad patch was only merged for v4.9-rc1?
Thanks,
Paul
>
> > drivers/i2c/busses/i2c-octeon-core.h | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-octeon-core.h
> > b/drivers/i2c/busses/i2c-octeon-core.h index 1db7c83..d980406 100644
> > --- a/drivers/i2c/busses/i2c-octeon-core.h
> > +++ b/drivers/i2c/busses/i2c-octeon-core.h
> > @@ -146,8 +146,9 @@ static inline void octeon_i2c_reg_write(struct
> > octeon_i2c *i2c, u64 eop_reg, u8>
> > __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base +
SW_TWSI(i2c));
> >
> > - readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp &
SW_TWSI_V,
> > - I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout);
> > + readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> > + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> > + i2c->adap.timeout);
> >
> > }
> >
> > #define octeon_i2c_ctl_write(i2c, val) \
> >
> > @@ -173,7 +174,7 @@ static inline int octeon_i2c_reg_read(struct
> > octeon_i2c *i2c, u64 eop_reg,>
> > __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base +
> > SW_TWSI(i2c));
> >
> > ret = readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> >
> > - tmp & SW_TWSI_V, I2C_OCTEON_EVENT_WAIT,
> > + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> >
> > i2c->adap.timeout);
> >
> > if (error)
> >
> > *error = ret;
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: octeon: Fix register access
2016-11-09 14:09 ` Paul Burton
@ 2016-11-09 14:43 ` Jan Glauber
0 siblings, 0 replies; 4+ messages in thread
From: Jan Glauber @ 2016-11-09 14:43 UTC (permalink / raw)
To: Paul Burton; +Cc: linux-i2c, linux-mips, David Daney, Wolfram Sang, stable
On Wed, Nov 09, 2016 at 02:09:38PM +0000, Paul Burton wrote:
> On Tuesday, 8 November 2016 08:13:37 GMT Jan Glauber wrote:
> > On Mon, Nov 07, 2016 at 08:09:20PM +0000, Paul Burton wrote:
> > > Commit 70121f7f3725 ("i2c: octeon: thunderx: Limit register access
> > > retries") attempted to replace potentially infinite loops with ones
> > > which will time out using readq_poll_timeout, but in doing so it
> > > inverted the condition for exiting this loop.
> > >
> > > Tested on a Rhino Labs UTM-8 with Octeon CN7130.
> > >
> > > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > > Cc: Jan Glauber <jglauber@cavium.com>
> > > Cc: David Daney <david.daney@cavium.com>
> > > Cc: Wolfram Sang <wsa@the-dreams.de>
> > > Cc: linux-i2c@vger.kernel.org
> > >
> > > ---
> >
> > Acked-by: Jan Glauber <jglauber@cavium.com>
> >
> > Thanks for spotting this. I think this should go into stable too for
> > 4.8, so adding Cc: stable@vger.kernel.org.
>
> Hi Jan,
>
> ...but the bad patch was only merged for v4.9-rc1?
true, I've misread it.
> Thanks,
> Paul
>
> >
> > > drivers/i2c/busses/i2c-octeon-core.h | 7 ++++---
> > > 1 file changed, 4 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/i2c/busses/i2c-octeon-core.h
> > > b/drivers/i2c/busses/i2c-octeon-core.h index 1db7c83..d980406 100644
> > > --- a/drivers/i2c/busses/i2c-octeon-core.h
> > > +++ b/drivers/i2c/busses/i2c-octeon-core.h
> > > @@ -146,8 +146,9 @@ static inline void octeon_i2c_reg_write(struct
> > > octeon_i2c *i2c, u64 eop_reg, u8>
> > > __raw_writeq(SW_TWSI_V | eop_reg | data, i2c->twsi_base +
> SW_TWSI(i2c));
> > >
> > > - readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp, tmp &
> SW_TWSI_V,
> > > - I2C_OCTEON_EVENT_WAIT, i2c->adap.timeout);
> > > + readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> > > + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> > > + i2c->adap.timeout);
> > >
> > > }
> > >
> > > #define octeon_i2c_ctl_write(i2c, val) \
> > >
> > > @@ -173,7 +174,7 @@ static inline int octeon_i2c_reg_read(struct
> > > octeon_i2c *i2c, u64 eop_reg,>
> > > __raw_writeq(SW_TWSI_V | eop_reg | SW_TWSI_R, i2c->twsi_base +
> > > SW_TWSI(i2c));
> > >
> > > ret = readq_poll_timeout(i2c->twsi_base + SW_TWSI(i2c), tmp,
> > >
> > > - tmp & SW_TWSI_V, I2C_OCTEON_EVENT_WAIT,
> > > + !(tmp & SW_TWSI_V), I2C_OCTEON_EVENT_WAIT,
> > >
> > > i2c->adap.timeout);
> > >
> > > if (error)
> > >
> > > *error = ret;
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] i2c: octeon: Fix register access
2016-11-08 7:13 ` [PATCH 1/2] i2c: octeon: Fix register access Jan Glauber
2016-11-09 14:09 ` Paul Burton
@ 2016-11-10 20:17 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2016-11-10 20:17 UTC (permalink / raw)
To: Jan Glauber; +Cc: Paul Burton, linux-i2c, linux-mips, David Daney, stable
[-- Attachment #1: Type: text/plain, Size: 980 bytes --]
On Tue, Nov 08, 2016 at 08:13:37AM +0100, Jan Glauber wrote:
> On Mon, Nov 07, 2016 at 08:09:20PM +0000, Paul Burton wrote:
> > Commit 70121f7f3725 ("i2c: octeon: thunderx: Limit register access
> > retries") attempted to replace potentially infinite loops with ones
> > which will time out using readq_poll_timeout, but in doing so it
> > inverted the condition for exiting this loop.
> >
> > Tested on a Rhino Labs UTM-8 with Octeon CN7130.
> >
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Jan Glauber <jglauber@cavium.com>
> > Cc: David Daney <david.daney@cavium.com>
> > Cc: Wolfram Sang <wsa@the-dreams.de>
> > Cc: linux-i2c@vger.kernel.org
> >
> > ---
>
> Acked-by: Jan Glauber <jglauber@cavium.com>
>
> Thanks for spotting this. I think this should go into stable too for
> 4.8, so adding Cc: stable@vger.kernel.org.
Shall I still apply this one? Seems to me that 70121f7f3725 is still
under discussion of being reverted?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-10 20:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20161107200921.30284-1-paul.burton@imgtec.com>
2016-11-08 7:13 ` [PATCH 1/2] i2c: octeon: Fix register access Jan Glauber
2016-11-09 14:09 ` Paul Burton
2016-11-09 14:43 ` Jan Glauber
2016-11-10 20:17 ` Wolfram Sang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).