diff mbox

[1/3] drm/i915: Pass the correct msgs to gmbus_is_index_read()

Message ID 20171123194157.25367-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä Nov. 23, 2017, 7:41 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

We're supposed to examine msgs[i] and msgs[i+1] to see if they
form a pair suitable for an indexed transfer. But in reality
we're examining msgs[0] and msgs[1]. Fix this.

Cc: stable@vger.kernel.org
Cc: Daniel Kurtz <djkurtz@chromium.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <seanpaul@chromium.org>
Fixes: 56f9eac05489 ("drm/i915/intel_i2c: use INDEX cycles for i2c read transactions")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Chris Wilson Nov. 23, 2017, 8:50 p.m. UTC | #1
Quoting Ville Syrjala (2017-11-23 19:41:55)
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> We're supposed to examine msgs[i] and msgs[i+1] to see if they
> form a pair suitable for an indexed transfer. But in reality
> we're examining msgs[0] and msgs[1]. Fix this.
> 
> Cc: stable@vger.kernel.org
> Cc: Daniel Kurtz <djkurtz@chromium.org>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <seanpaul@chromium.org>
> Fixes: 56f9eac05489 ("drm/i915/intel_i2c: use INDEX cycles for i2c read transactions")
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index eb5827110d8f..165375cbef2f 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -484,7 +484,7 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
>  
>         for (; i < num; i += inc) {
>                 inc = 1;
> -               if (gmbus_is_index_read(msgs, i, num)) {
> +               if (gmbus_is_index_read(&msgs[i], i, num)) {

i is passed to gmbus_is_index_read() and used as an index into msgs. So
this should be accounted for right?
-Chris
Ville Syrjälä Nov. 24, 2017, 12:55 p.m. UTC | #2
On Thu, Nov 23, 2017 at 08:50:41PM +0000, Chris Wilson wrote:
> Quoting Ville Syrjala (2017-11-23 19:41:55)
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > We're supposed to examine msgs[i] and msgs[i+1] to see if they
> > form a pair suitable for an indexed transfer. But in reality
> > we're examining msgs[0] and msgs[1]. Fix this.
> > 
> > Cc: stable@vger.kernel.org
> > Cc: Daniel Kurtz <djkurtz@chromium.org>
> > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Sean Paul <seanpaul@chromium.org>
> > Fixes: 56f9eac05489 ("drm/i915/intel_i2c: use INDEX cycles for i2c read transactions")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_i2c.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> > index eb5827110d8f..165375cbef2f 100644
> > --- a/drivers/gpu/drm/i915/intel_i2c.c
> > +++ b/drivers/gpu/drm/i915/intel_i2c.c
> > @@ -484,7 +484,7 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
> >  
> >         for (; i < num; i += inc) {
> >                 inc = 1;
> > -               if (gmbus_is_index_read(msgs, i, num)) {
> > +               if (gmbus_is_index_read(&msgs[i], i, num)) {
> 
> i is passed to gmbus_is_index_read() and used as an index into msgs. So
> this should be accounted for right?

Doh. Yep, this patch is nonsense.
Ville Syrjälä Nov. 24, 2017, 4:06 p.m. UTC | #3
On Fri, Nov 24, 2017 at 02:55:28PM +0200, Ville Syrjälä wrote:
> On Thu, Nov 23, 2017 at 08:50:41PM +0000, Chris Wilson wrote:
> > Quoting Ville Syrjala (2017-11-23 19:41:55)
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > We're supposed to examine msgs[i] and msgs[i+1] to see if they
> > > form a pair suitable for an indexed transfer. But in reality
> > > we're examining msgs[0] and msgs[1]. Fix this.
> > > 
> > > Cc: stable@vger.kernel.org
> > > Cc: Daniel Kurtz <djkurtz@chromium.org>
> > > Cc: Chris Wilson <chris@chris-wilson.co.uk>
> > > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > Cc: Sean Paul <seanpaul@chromium.org>
> > > Fixes: 56f9eac05489 ("drm/i915/intel_i2c: use INDEX cycles for i2c read transactions")
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/i915/intel_i2c.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> > > index eb5827110d8f..165375cbef2f 100644
> > > --- a/drivers/gpu/drm/i915/intel_i2c.c
> > > +++ b/drivers/gpu/drm/i915/intel_i2c.c
> > > @@ -484,7 +484,7 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
> > >  
> > >         for (; i < num; i += inc) {
> > >                 inc = 1;
> > > -               if (gmbus_is_index_read(msgs, i, num)) {
> > > +               if (gmbus_is_index_read(&msgs[i], i, num)) {
> > 
> > i is passed to gmbus_is_index_read() and used as an index into msgs. So
> > this should be accounted for right?
> 
> Doh. Yep, this patch is nonsense.

The two other patches pushed to dinq. Thanks catching my mistake with
this one.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index eb5827110d8f..165375cbef2f 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -484,7 +484,7 @@  do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
 
 	for (; i < num; i += inc) {
 		inc = 1;
-		if (gmbus_is_index_read(msgs, i, num)) {
+		if (gmbus_is_index_read(&msgs[i], i, num)) {
 			ret = gmbus_xfer_index_read(dev_priv, &msgs[i]);
 			inc = 2; /* an index read is two msgs */
 		} else if (msgs[i].flags & I2C_M_RD) {