2016-11-03 10:24:11

by Jianqun Xu

[permalink] [raw]
Subject: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte

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 <[email protected]>
Cc: Sean Paul <[email protected]>
Signed-off-by: Jianqun Xu <[email protected]>
---
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



2016-11-15 17:10:09

by Sean Paul

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte

On Thu, Nov 3, 2016 at 3:17 AM, Jianqun Xu <[email protected]> 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 <[email protected]>
> Cc: Sean Paul <[email protected]>
> Signed-off-by: Jianqun Xu <[email protected]>

Reviewed-by: Sean Paul <[email protected]>

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

2016-11-16 06:08:51

by Archit Taneja

[permalink] [raw]
Subject: Re: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte



On 11/15/2016 10:39 PM, Sean Paul wrote:
> On Thu, Nov 3, 2016 at 3:17 AM, Jianqun Xu <[email protected]> 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 <[email protected]>
>> Cc: Sean Paul <[email protected]>
>> Signed-off-by: Jianqun Xu <[email protected]>
>
> Reviewed-by: Sean Paul <[email protected]>

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