diff mbox

drm/dp_helper: don't return EPROTO for defers

Message ID 1396575332-26898-1-git-send-email-airlied@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dave Airlie April 4, 2014, 1:35 a.m. UTC
From: Dave Airlie <airlied@redhat.com>

If we get a msg.reply of REPLY_DEFER, we also get an err of 0
so we fail reads with 0 < size and return -EPROTO instead of trying
again.

Found writing MST support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jani Nikula April 4, 2014, 5:50 a.m. UTC | #1
On Fri, 04 Apr 2014, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> If we get a msg.reply of REPLY_DEFER, we also get an err of 0
> so we fail reads with 0 < size and return -EPROTO instead of trying
> again.
>
> Found writing MST support.
>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index f4babed..725354f 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -386,11 +386,11 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
>  			return err;
>  		}
>  
> -		if (err < size)
> -			return -EPROTO;
>  
>  		switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) {
>  		case DP_AUX_NATIVE_REPLY_ACK:
> +			if (err < size)
> +				return -EPROTO;
>  			return err;
>  
>  		case DP_AUX_NATIVE_REPLY_NACK:
> -- 
> 1.8.5.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Jani Nikula April 4, 2014, 6 a.m. UTC | #2
On Fri, 04 Apr 2014, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Fri, 04 Apr 2014, Dave Airlie <airlied@gmail.com> wrote:
>> From: Dave Airlie <airlied@redhat.com>
>>
>> If we get a msg.reply of REPLY_DEFER, we also get an err of 0
>> so we fail reads with 0 < size and return -EPROTO instead of trying
>> again.
>>
>> Found writing MST support.
>>
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

On second thought, I think you'll need the same for drm_dp_i2c_do_msg()
as well.

Cheers,
Jani.


>
>
>> Signed-off-by: Dave Airlie <airlied@redhat.com>
>> ---
>>  drivers/gpu/drm/drm_dp_helper.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
>> index f4babed..725354f 100644
>> --- a/drivers/gpu/drm/drm_dp_helper.c
>> +++ b/drivers/gpu/drm/drm_dp_helper.c
>> @@ -386,11 +386,11 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
>>  			return err;
>>  		}
>>  
>> -		if (err < size)
>> -			return -EPROTO;
>>  
>>  		switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) {
>>  		case DP_AUX_NATIVE_REPLY_ACK:
>> +			if (err < size)
>> +				return -EPROTO;
>>  			return err;
>>  
>>  		case DP_AUX_NATIVE_REPLY_NACK:
>> -- 
>> 1.8.5.3
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
> -- 
> Jani Nikula, Intel Open Source Technology Center
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Thierry Reding April 4, 2014, 6:33 a.m. UTC | #3
On Fri, Apr 04, 2014 at 09:00:31AM +0300, Jani Nikula wrote:
> On Fri, 04 Apr 2014, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> > On Fri, 04 Apr 2014, Dave Airlie <airlied@gmail.com> wrote:
> >> From: Dave Airlie <airlied@redhat.com>
> >>
> >> If we get a msg.reply of REPLY_DEFER, we also get an err of 0
> >> so we fail reads with 0 < size and return -EPROTO instead of trying
> >> again.
> >>
> >> Found writing MST support.
> >>
> >
> > Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> On second thought, I think you'll need the same for drm_dp_i2c_do_msg()
> as well.

I agree. drm_dp_i2c_do_msg() should have the same change. With that:

Reviewed-by: Thierry Reding <treding@nvidia.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index f4babed..725354f 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -386,11 +386,11 @@  static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
 			return err;
 		}
 
-		if (err < size)
-			return -EPROTO;
 
 		switch (msg.reply & DP_AUX_NATIVE_REPLY_MASK) {
 		case DP_AUX_NATIVE_REPLY_ACK:
+			if (err < size)
+				return -EPROTO;
 			return err;
 
 		case DP_AUX_NATIVE_REPLY_NACK: