From patchwork Fri May 11 09:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 10393731 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 A7D6760153 for ; Fri, 11 May 2018 09:33:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 943692859E for ; Fri, 11 May 2018 09:33:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86B45286FE; Fri, 11 May 2018 09:33:21 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8C2EA2859E for ; Fri, 11 May 2018 09:33:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbeEKJdT (ORCPT ); Fri, 11 May 2018 05:33:19 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:41574 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752232AbeEKJdS (ORCPT ); Fri, 11 May 2018 05:33:18 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180511093315euoutp011fff53e3e6979ca77c548523ee852b91~tjUlxfXtV3078030780euoutp01v; Fri, 11 May 2018 09:33:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180511093315euoutp011fff53e3e6979ca77c548523ee852b91~tjUlxfXtV3078030780euoutp01v DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1526031195; bh=3YzpofuX5llinOovzaJN4e2Xf3En2ppQruYHPAQ1NxE=; h=From:To:Cc:Subject:Date:References:From; b=grQ+lyritsepR/zyplglbrYhhacd/DxL6/WKdTjHQ7+XX8y05/EOCB9NNvtBsv+IJ IzGhHIfG0K62ELvs4/elvTwkoCS7prJW+YaBd58hXOtzedTAc0904YexSBh0RDBKK6 HaxjheQstL+fWv8wf9hkHh5VUD85Kcwrdx4BbmVg= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180511093314eucas1p281c511881aef1cd2698c6fe648b8d6d7~tjUlDd79Q0126901269eucas1p2a; Fri, 11 May 2018 09:33:14 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 82.24.10409.A5365FA5; Fri, 11 May 2018 10:33:14 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180511093313eucas1p2c720347af4cdb42d796ee1bcd7c04b0c~tjUkO9xqv0345103451eucas1p2C; Fri, 11 May 2018 09:33:13 +0000 (GMT) X-AuditID: cbfec7f5-b5fff700000028a9-17-5af5635a915d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 69.FB.04178.95365FA5; Fri, 11 May 2018 10:33:13 +0100 (BST) Received: from AMDC2768.DIGITAL.local ([106.120.43.17]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P8K000BH57DQO00@eusync3.samsung.com>; Fri, 11 May 2018 10:33:13 +0100 (BST) From: Andrzej Hajda To: Wolfram Sang Cc: Andrzej Hajda , Bartlomiej Zolnierkiewicz , Marek Szyprowski , linux-i2c@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Peter Rosin , Andi Shyti Subject: [PATCH] i2c: exynos5: simplify transfer function Date: Fri, 11 May 2018 11:33:07 +0200 Message-id: <20180511093307.10362-1-a.hajda@samsung.com> X-Mailer: git-send-email 2.17.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRmVeSWpSXmKPExsWy7djPc7pRyV+jDP7P47W4te4cq8XiH8+Z LDbOWM9q0fH3C6PFjPP7mCzWHrnLbrH30HxGi5UnZjE7cHhMOzCb3eP6kk/MHn1bVjF6nDz1 hMXj8ya5ANYoLpuU1JzMstQifbsErow/jzULLvFUXN+f3sD4nrOLkZNDQsBE4vXWBYxdjFwc QgIrGCVufe9khnA+M0rMbHvACFO16d18FojEMkaJQxd2sUM4/xklGn5eYwWpYhPQlPi7+SYb iC0ioCLRuf4/WAezQA+TRNv3Z2CjhAUsJTqu7mIGsVkEVCWenF7GDmLzClhI/Dn8kR1inbzE s+nzwDZICLxllVjz6zvUHS4Sf1bsYYGwhSVeHd8C1SAj0dlxkAnCrpa4+aKJBaK5g1Hi/u92 NoiEtcTh4xfBTmUW4JOYtG060BUcQHFeiY42IQjTQ+JfYzREtaPEmrvNYOOFBGIl1mxdyziB UXIBI8MqRvHU0uLc9NRi47zUcr3ixNzi0rx0veT83E2MwDg8/e/41x2M+/4kHWIU4GBU4uEt iPsSJcSaWFZcmXuIUYKDWUmEd98KoBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHeOI26KCGB9MSS 1OzU1ILUIpgsEwenVANjfOuavdHfU14YcDzm1J/cPrf42t4rHsbyW+OLsqqq6gsspzJztx+Z 9JrVT5vvm/1JxbLXYQt0vyXdvby/6J5ZXVSbm152tMwNJYXyp9Oij28W2rFFlGX271cTavhE 3vxe+T141sX1C6osNiyVPNR2rcp0Q0nc65UrL58L7f6/xzxnyh7VlYsWKLEUZyQaajEXFScC AHcofxO/AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMJMWRmVeSWpSXmKPExsVy+t/xq7qRyV+jDNoaVSxurTvHarH4x3Mm i40z1rNadPz9wmgx4/w+Jou1R+6yW+w9NJ/RYuWJWcwOHB7TDsxm97i+5BOzR9+WVYweJ089 YfH4vEkugDWKyyYlNSezLLVI3y6BK+PPY82CSzwV1/enNzC+5+xi5OSQEDCR2PRuPksXIxeH kMASRomj07awQziNTBJ/u7+zglSxCWhK/N18kw3EFhFQkehc/x+sg1mgj0ni7N4mZpCEsICl RMfVXWA2i4CqxJPTy9hBbF4BC4k/hz+yQ6yTl3g2fR77BEauBYwMqxhFUkuLc9Nziw31ihNz i0vz0vWS83M3MQKDYtuxn5t3MF7aGHyIUYCDUYmHtyDuS5QQa2JZcWXuIUYJDmYlEd59K4BC vCmJlVWpRfnxRaU5qcWHGKU5WJTEec8bVEYJCaQnlqRmp6YWpBbBZJk4OKUaGMN28vOfvLPA 5SzHvOvvvE+zt992tEt6ezrpY6mybrPADs32DWV9NwUE/7om1D+fdTGj9fZz5pO2YvzzTmmn WTZWumVn/ys4U7S7hnWqlKNp0rNXco5J71kVfl//m9Xgbc5z7Vl825TgsrY6jcYH35WfGFhz dwXoHsxyz7/mweJ68034sbf2SizFGYmGWsxFxYkAGfb2jgYCAAA= X-CMS-MailID: 20180511093313eucas1p2c720347af4cdb42d796ee1bcd7c04b0c X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180511093313eucas1p2c720347af4cdb42d796ee1bcd7c04b0c X-RootMTR: 20180511093313eucas1p2c720347af4cdb42d796ee1bcd7c04b0c References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP exynos5_i2c_xfer contains lots of dead code, let's remove it and simplify the rest. The patch should not introduce functional changes. Signed-off-by: Andrzej Hajda Suggested-by: Peter Rosin Reviewed-by: Andi Shyti Reviewed-by: Peter Rosin --- drivers/i2c/busses/i2c-exynos5.c | 29 +++++++---------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/drivers/i2c/busses/i2c-exynos5.c b/drivers/i2c/busses/i2c-exynos5.c index 12ec8484e653..de82ad8ff534 100644 --- a/drivers/i2c/busses/i2c-exynos5.c +++ b/drivers/i2c/busses/i2c-exynos5.c @@ -707,7 +707,7 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) { struct exynos5_i2c *i2c = adap->algo_data; - int i = 0, ret = 0, stop = 0; + int i, ret; if (i2c->suspended) { dev_err(i2c->dev, "HS-I2C is not initialized.\n"); @@ -718,30 +718,15 @@ static int exynos5_i2c_xfer(struct i2c_adapter *adap, if (ret) return ret; - for (i = 0; i < num; i++, msgs++) { - stop = (i == num - 1); - - ret = exynos5_i2c_xfer_msg(i2c, msgs, stop); - - if (ret < 0) - goto out; - } - - if (i == num) { - ret = num; - } else { - /* Only one message, cannot access the device */ - if (i == 1) - ret = -EREMOTEIO; - else - ret = i; - - dev_warn(i2c->dev, "xfer message failed\n"); + for (i = 0; i < num; ++i) { + ret = exynos5_i2c_xfer_msg(i2c, msgs + i, i + 1 == num); + if (ret) + break; } - out: clk_disable(i2c->clk); - return ret; + + return ret ?: num; } static u32 exynos5_i2c_func(struct i2c_adapter *adap)