Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1584312

Re: [PATCH] drm/bridge: analogix_dp: Don't return -EBUSY when msg->size is 0 in aux transaction

From Tomasz Figa <tfiga@chromium.org>
Newsgroups linux.kernel
Subject Re: [PATCH] drm/bridge: analogix_dp: Don't return -EBUSY when msg->size is 0 in aux transaction
Date 2017-02-20 03:50 +0100
Message-ID <tcMd3-78N-3@gated-at.bofh.it> (permalink)
References <tal7j-1Oy-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Zain,

On Mon, Feb 13, 2017 at 6:27 PM, zain wang <wzz@rock-chips.com> wrote:
>
> The analogix_dp_transfer() will return -EBUSY if num_transferred is zero.
> But sometimes we will send a bare address packet to start the transaction,
> like drm_dp_i2c_xfer() show:
>         ......
>         /* Send a bare address packet to start the transaction.
>          * Zero sized messages specify an address only (bare
>          * address) transaction.
>          */
>         msg.buffer = NULL;
>         msg.size = 0;
>         err = drm_dp_i2c_do_msg(aux, &msg);
>         ......
>
> In this case, the msg->size is zero, so the num_transferred will be zero too.
> We can't return -EBUSY here, let's we return num_transferred if num_transferred
> equals msg->size.
>

Please see my question inline.

> Signed-off-by: zain wang <wzz@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 303083a..5384aca 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 > 0 ? num_transferred : -EBUSY;
> +       return (num_transferred == msg->size) ? num_transferred : -EBUSY;

I might be missing something but, looking at the code, I don't see any
possibility of num_transferred ever being different than msg->size. To
be honest, it doesn't seem to even make any sense keeping the local
variable there, because msg->size can be simply always returned, as
errors are handled by jumping to aux_error label.

Best regards,
Tomasz

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH] drm/bridge: analogix_dp: Don't return -EBUSY when  msg->size is 0 in aux transaction Tomasz Figa <tfiga@chromium.org> - 2017-02-20 03:50 +0100
  Re: [PATCH] drm/bridge: analogix_dp: Don't return -EBUSY when  msg->size is 0 in aux transaction Zain Wang <wzz@rock-chips.com> - 2017-02-20 05:10 +0100
    Re: [PATCH] drm/bridge: analogix_dp: Don't return -EBUSY when  msg->size is 0 in aux transaction Tomasz Figa <tfiga@chromium.org> - 2017-02-20 05:30 +0100

csiph-web