From patchwork Wed Nov 16 00:13:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 9430769 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A75F760469 for ; Wed, 16 Nov 2016 01:31:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9767928C95 for ; Wed, 16 Nov 2016 01:31:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8BFF328D1C; Wed, 16 Nov 2016 01:31:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1396B28C95 for ; Wed, 16 Nov 2016 01:31:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9D8EA6E626; Wed, 16 Nov 2016 01:30:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtphy.263.net (irl-smtp01.263.net [54.76.167.174]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F5636E28A for ; Wed, 16 Nov 2016 00:14:06 +0000 (UTC) Received: from transport.263xmail.com (transportfm.263xmail.com [211.150.65.123]) by smtphy.263.net (Postfix) with ESMTPS id 0345FE01B0 for ; Wed, 16 Nov 2016 08:14:05 +0800 (CST) Received: from regular2.263xmail.com (unknown [192.168.165.160]) by transport.263xmail.com (Postfix) with ESMTP id CB6CD2005 for ; Wed, 16 Nov 2016 08:13:59 +0800 (CST) Received: from regular1.263xmail.com (unknown [192.168.165.235]) by regular2.263xmail.com (Postfix) with ESMTP id 0F7AC1E8E1 for ; Wed, 16 Nov 2016 08:13:47 +0800 (CST) Received: from jay.xu?rock-chips.com (unknown [192.168.167.204]) by regular1.263xmail.com (Postfix) with ESMTP id 742321DB9A; Wed, 16 Nov 2016 08:13:44 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 2483D3AB; Wed, 16 Nov 2016 08:13:41 +0800 (CST) 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-SENDER: xjq@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith ESMTP id 24612I1BX0L; Wed, 16 Nov 2016 08:13:44 +0800 (CST) 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 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 X-Mailman-Approved-At: Wed, 16 Nov 2016 01:30:52 +0000 Cc: huangtao@rock-chips.com, wzz@rock-chips.com, zhengxing@rock-chips.com, zhangqing@rock-chips.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, Jianqun Xu , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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; }