linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/bridge: analogix_dp: return error if transfer none byte
@ 2016-11-03 10:17 Jianqun Xu
  2016-11-15 17:09 ` Sean Paul
  0 siblings, 1 reply; 4+ messages in thread
From: Jianqun Xu @ 2016-11-03 10:17 UTC (permalink / raw)
  To: airlied, seanpaul, wzz, tomeu.vizoso
  Cc: heiko, huangtao, yamada.masahiro, dri-devel, linux-kernel,
	linux-rockchip, Jianqun Xu

Reference from drm_dp_aux description (about transfer):
Upon success, the implementation should return the number of payload bytes
that were transferred, or a negative error-code on failure. Helpers
propagate errors from the .transfer() function, with the exception of
the -EBUSY error, which causes a transaction to be retried. On a short,
helpers will return -EPROTO to make it simpler to check for failure.

The analogix_dp_transfer will return num_transferred, but if there is none
byte been transferred, the return value will be 0, which means success, we
should return error-code if transfer none byte.

for (retry = 0; retry < 32; retry++) {
	err = aux->transfer(aux, &msg);
	if (err < 0) {
		if (err == -EBUSY)
			continue;

		goto unlock;
	}
}

Cc: zain wang <wzz@rock-chips.com>
Cc: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index cd37ac0..303083a 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -1162,5 +1162,5 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
 		 (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ)
 		msg->reply = DP_AUX_NATIVE_REPLY_ACK;
 
-	return num_transferred;
+	return num_transferred > 0 ? num_transferred : -EBUSY;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte
  2016-11-03 10:17 [PATCH] drm/bridge: analogix_dp: return error if transfer none byte Jianqun Xu
@ 2016-11-15 17:09 ` Sean Paul
  2016-11-16  6:08   ` Archit Taneja
  0 siblings, 1 reply; 4+ messages in thread
From: Sean Paul @ 2016-11-15 17:09 UTC (permalink / raw)
  To: Jianqun Xu
  Cc: Dave Airlie, 王征增,
	Tomeu Vizoso, Heiko Stuebner, huangtao, Masahiro Yamada,
	dri-devel, Linux Kernel Mailing List, linux-rockchip, Archit

On Thu, Nov 3, 2016 at 3:17 AM, Jianqun Xu <jay.xu@rock-chips.com> wrote:
> Reference from drm_dp_aux description (about transfer):
> Upon success, the implementation should return the number of payload bytes
> that were transferred, or a negative error-code on failure. Helpers
> propagate errors from the .transfer() function, with the exception of
> the -EBUSY error, which causes a transaction to be retried. On a short,
> helpers will return -EPROTO to make it simpler to check for failure.
>
> The analogix_dp_transfer will return num_transferred, but if there is none
> byte been transferred, the return value will be 0, which means success, we
> should return error-code if transfer none byte.
>
> for (retry = 0; retry < 32; retry++) {
>         err = aux->transfer(aux, &msg);
>         if (err < 0) {
>                 if (err == -EBUSY)
>                         continue;
>
>                 goto unlock;
>         }
> }
>
> Cc: zain wang <wzz@rock-chips.com>
> Cc: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> index cd37ac0..303083a 100644
> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
> @@ -1162,5 +1162,5 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
>                  (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ)
>                 msg->reply = DP_AUX_NATIVE_REPLY_ACK;
>
> -       return num_transferred;
> +       return num_transferred > 0 ? num_transferred : -EBUSY;
>  }
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte
  2016-11-15 17:09 ` Sean Paul
@ 2016-11-16  6:08   ` Archit Taneja
  0 siblings, 0 replies; 4+ messages in thread
From: Archit Taneja @ 2016-11-16  6:08 UTC (permalink / raw)
  To: Sean Paul, Jianqun Xu
  Cc: Dave Airlie, 王征增,
	Tomeu Vizoso, Heiko Stuebner, huangtao, Masahiro Yamada,
	dri-devel, Linux Kernel Mailing List, linux-rockchip



On 11/15/2016 10:39 PM, Sean Paul wrote:
> On Thu, Nov 3, 2016 at 3:17 AM, Jianqun Xu <jay.xu@rock-chips.com> wrote:
>> Reference from drm_dp_aux description (about transfer):
>> Upon success, the implementation should return the number of payload bytes
>> that were transferred, or a negative error-code on failure. Helpers
>> propagate errors from the .transfer() function, with the exception of
>> the -EBUSY error, which causes a transaction to be retried. On a short,
>> helpers will return -EPROTO to make it simpler to check for failure.
>>
>> The analogix_dp_transfer will return num_transferred, but if there is none
>> byte been transferred, the return value will be 0, which means success, we
>> should return error-code if transfer none byte.
>>
>> for (retry = 0; retry < 32; retry++) {
>>         err = aux->transfer(aux, &msg);
>>         if (err < 0) {
>>                 if (err == -EBUSY)
>>                         continue;
>>
>>                 goto unlock;
>>         }
>> }
>>
>> Cc: zain wang <wzz@rock-chips.com>
>> Cc: Sean Paul <seanpaul@chromium.org>
>> Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
>
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

queued to drm-misc.

>
>> ---
>>  drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> index cd37ac0..303083a 100644
>> --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
>> @@ -1162,5 +1162,5 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
>>                  (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ)
>>                 msg->reply = DP_AUX_NATIVE_REPLY_ACK;
>>
>> -       return num_transferred;
>> +       return num_transferred > 0 ? num_transferred : -EBUSY;
>>  }
>> --
>> 1.9.1
>>
>>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] drm/bridge: analogix_dp: return error if transfer none byte
@ 2016-11-16  0:13 Jianqun Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Jianqun Xu @ 2016-11-16  0:13 UTC (permalink / raw)
  To: mturquette, sboyd, heiko, tomeu.vizoso, seanpaul, airlied,
	yamada.masahiro
  Cc: linux-clk, huangtao, linux-arm-kernel, dri-devel, linux-rockchip,
	linux-kernel, zhengxing, zhangqing, wzz, Jianqun Xu

Reference from drm_dp_aux description (about transfer):
Upon success, the implementation should return the number of payload bytes
that were transferred, or a negative error-code on failure. Helpers
propagate errors from the .transfer() function, with the exception of
the -EBUSY error, which causes a transaction to be retried. On a short,
helpers will return -EPROTO to make it simpler to check for failure.

The analogix_dp_transfer will return num_transferred, but if there is none
byte been transferred, the return value will be 0, which means success, we
should return error-code if transfer none byte.

for (retry = 0; retry < 32; retry++) {
	err = aux->transfer(aux, &msg);
	if (err < 0) {
		if (err == -EBUSY)
			continue;

		goto unlock;
	}
}

Cc: zain wang <wzz@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index cd37ac0..303083a 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -1162,5 +1162,5 @@ ssize_t analogix_dp_transfer(struct analogix_dp_device *dp,
 		 (msg->request & ~DP_AUX_I2C_MOT) == DP_AUX_NATIVE_READ)
 		msg->reply = DP_AUX_NATIVE_REPLY_ACK;
 
-	return num_transferred;
+	return num_transferred > 0 ? num_transferred : -EBUSY;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-16  6:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-03 10:17 [PATCH] drm/bridge: analogix_dp: return error if transfer none byte Jianqun Xu
2016-11-15 17:09 ` Sean Paul
2016-11-16  6:08   ` Archit Taneja
2016-11-16  0:13 Jianqun Xu

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).