From patchwork Thu Nov 3 10:17:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jianqun Xu X-Patchwork-Id: 9411711 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 7571860585 for ; Fri, 4 Nov 2016 01:14:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 665742A397 for ; Fri, 4 Nov 2016 01:14:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59E512B035; Fri, 4 Nov 2016 01:14:22 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 1E44C2A397 for ; Fri, 4 Nov 2016 01:14:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86BF76E8A3; Fri, 4 Nov 2016 01:13:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtphy.263.net (va-smtp01.263.net [54.88.144.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id A489B6E69B for ; Thu, 3 Nov 2016 10:17:48 +0000 (UTC) Received: from transport.263xmail.com (transportfm.263xmail.com [211.150.65.235]) by smtphy.263.net (Postfix) with ESMTPS id 2C07312010A for ; Thu, 3 Nov 2016 18:17:48 +0800 (CST) Received: from regular2.263xmail.com (unknown [192.168.165.119]) by transport.263xmail.com (Postfix) with ESMTP id 36274B52 for ; Thu, 3 Nov 2016 18:17:43 +0800 (CST) Received: from regular1.263xmail.com (unknown [192.168.165.111]) by regular2.263xmail.com (Postfix) with ESMTP id CF79980 for ; Thu, 3 Nov 2016 18:17:41 +0800 (CST) Received: from jay.xu?rock-chips.com (unknown [192.168.165.105]) by regular1.263xmail.com (Postfix) with ESMTP id 3CC2FC8; Thu, 3 Nov 2016 18:17:38 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from smtp.263.net (sg-smtp01.263.net [54.255.195.220]) by smtp.263.net (Postfix) with ESMTP id E32C83C3; Thu, 3 Nov 2016 18:17:36 +0800 (CST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id EAC94DF30D; Thu, 3 Nov 2016 18:17:37 +0800 (CST) X-RL-SENDER: jay.xu@rock-chips.com X-FST-TO: airlied@linux.ie X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jay.xu@rock-chips.com X-UNIQUE-TAG: <7b755f76989b81a75420fa88c259a646> X-ATTACHMENT-NUM: 0 X-SENDER: xjq@rock-chips.com X-DNS-TYPE: 0 Received: from localhost.localdomain (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 17895U4LFGQ; Thu, 03 Nov 2016 18:17:39 +0800 (CST) From: Jianqun Xu To: airlied@linux.ie, seanpaul@chromium.org, wzz@rock-chips.com, tomeu.vizoso@collabora.com Subject: [PATCH] drm/bridge: analogix_dp: return error if transfer none byte Date: Thu, 3 Nov 2016 18:17:30 +0800 Message-Id: <1478168250-30858-1-git-send-email-jay.xu@rock-chips.com> X-Mailer: git-send-email 1.9.1 X-Mailman-Approved-At: Fri, 04 Nov 2016 01:13:04 +0000 Cc: huangtao@rock-chips.com, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, yamada.masahiro@socionext.com, Jianqun Xu 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 Cc: Sean Paul Signed-off-by: Jianqun Xu Reviewed-by: Sean Paul --- 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; }