Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935091AbcKPAN5 (ORCPT ); Tue, 15 Nov 2016 19:13:57 -0500 Received: from regular1.263xmail.com ([211.150.99.135]:35098 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932822AbcKPANz (ORCPT ); Tue, 15 Nov 2016 19:13:55 -0500 X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-RL-SENDER: jay.xu@rock-chips.com X-FST-TO: mturquette@baylibre.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: jay.xu@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 From: Jianqun Xu To: mturquette@baylibre.com, sboyd@codeaurora.org, heiko@sntech.de, tomeu.vizoso@collabora.com, seanpaul@chromium.org, airlied@linux.ie, yamada.masahiro@socionext.com Cc: linux-clk@vger.kernel.org, huangtao@rock-chips.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, zhengxing@rock-chips.com, zhangqing@rock-chips.com, wzz@rock-chips.com, Jianqun Xu Subject: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte Date: Wed, 16 Nov 2016 08:13:39 +0800 Message-Id: <1479255219-7243-1-git-send-email-jay.xu@rock-chips.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1535 Lines: 42 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 Reviewed-by: Sean Paul Signed-off-by: Jianqun Xu --- 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