From patchwork Fri Aug 31 14:30:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10583899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92E9F112B for ; Fri, 31 Aug 2018 14:31:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 817812BFB1 for ; Fri, 31 Aug 2018 14:31:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7585F2C0C1; Fri, 31 Aug 2018 14:31:37 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 582702C0EC for ; Fri, 31 Aug 2018 14:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=rcMh7WVggj95+GcXqt2jV111wS8r7VntxENzky6es8U=; b=Dz5 qgDtoZcMaXXJv3Cs32ZF7u7q98VAj1QRMR6L+imJKW4BIikx/+c9WmYmXpWtyqs5WO71ivFShFrGj 3ltGgExV704SYnzPorPH16MXPDZOxoob6Bh4qfimez1AiM++44qV2qicGOCkgVefw58Ap/vz6WeHB EXmRKWzwRKjDtChgBGDZr6BLiZgPv07PWsmc5y+BmnqsUCGhx1TLr4WtFdBn2XophEd/bU3brjhaf pA3DNb12eLE+vllAyVY2xmkolkEVy2f1rQg+qs2qKjehgCc/5SLJdFYZSl9CERIZaVylWBMha3iVr /c8Veio4gj1iqf5ix1QC07fEQ8nMTKQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvkSR-000545-LP; Fri, 31 Aug 2018 14:31:31 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvkSN-00051g-Pe for linux-arm-kernel@lists.infradead.org; Fri, 31 Aug 2018 14:31:29 +0000 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id w7VEUp9g030172; Fri, 31 Aug 2018 23:30:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w7VEUp9g030172 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1535725852; bh=Ky6qwotd80ihjx5nlKTuOrYtigeiIdPoY6NspfMkiMg=; h=From:To:Cc:Subject:Date:From; b=l44D8bHUOIcL6W8aVWZQiXGcoD8p6PeFhyPxmPELgON7PCWlSd7icR2iMmUruedrn eyglEoUj929aFXvTh4lyv7CZZV+F+sONsb2m6+SHwlNCeyQny0XJB82SHcYKf21EcK vog4DONJx9MTd1AV1QdprRCw7qVxClT1qOigT6fLjRjWbvGOPav8flYg0950r3b9NI /jLOe/onRTFftWB1GWS4K4VLjCmpi8nc/XRBkkPbU5hbwcTAlsuooISnclbq0sAXe6 hiqsg9v0N35/IIUaOOlF9smql4bnqyAYQkaGSBV2jf3c1ZDAUOTqtpjfQBoPIrwdpw PVPWDG2E5XwDQ== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-i2c@vger.kernel.org Subject: [PATCH 1/2] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Date: Fri, 31 Aug 2018 23:30:47 +0900 Message-Id: <1535725848-4076-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180831_073128_147789_A9879076 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wolfram Sang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This driver currently emits a STOP if the next message is not I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR ioctl, where read/write transactions are combined without STOP between. Issue STOP only when the message is the last one _or_ flagged with I2C_M_STOP. Fixes: dd6fd4a32793 ("i2c: uniphier: add UniPhier FIFO-less I2C driver") Signed-off-by: Masahiro Yamada --- drivers/i2c/busses/i2c-uniphier.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index bb181b0..454f914 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(struct i2c_adapter *adap, return ret; for (msg = msgs; msg < emsg; msg++) { - /* If next message is read, skip the stop condition */ - bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); - /* but, force it if I2C_M_STOP is set */ - if (msg->flags & I2C_M_STOP) - stop = true; + /* Emit STOP if it is the last message or I2C_M_STOP is set. */ + bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); ret = uniphier_i2c_master_xfer_one(adap, msg, stop); if (ret) From patchwork Fri Aug 31 14:30:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 10583901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8AF4112B for ; Fri, 31 Aug 2018 14:32:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 962FB28685 for ; Fri, 31 Aug 2018 14:32:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88D1A2BFB1; Fri, 31 Aug 2018 14:32:14 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6576828685 for ; Fri, 31 Aug 2018 14:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=DdOp4NIqHRbsHZi35jvDLs1K3DPhvm5gWl5Dg5IYrVA=; b=Ab3bABcvA/9OB7tVhHSF8gURgT II+IKb71cT6cM+V8otNPLUF2e2reHlLlmGnC3DHUlNoOLQoDHSmaSNG//jhLJO0OmJCB8LZ/ceRIX UOdNAsbu1hBJRZdx7RP1Af2q8vBP4nH6mxpOnhSmQ4TkjxEkM68DDdJnBpTzUxxMRkODcYoHxBTmz 1OPq/j7YjMLu2MX3Dk4QassqKJH9oy9gLj1XWhXhlRpChWrtIfbgpyTjHV+zAWFJI+7qAUH2C+Tyh WVTXyamwv1QmyC0NV1aenJWjqDmZmGz9eh8xnlb2ETkwpH96AuSvG04nn1149k5rN2EUvcj0TqjkC ME4CExCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvkSu-0005H6-3P; Fri, 31 Aug 2018 14:32:00 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fvkSN-00051f-Nq for linux-arm-kernel@lists.infradead.org; Fri, 31 Aug 2018 14:31:29 +0000 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-08.nifty.com with ESMTP id w7VEUp9h030172; Fri, 31 Aug 2018 23:30:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w7VEUp9h030172 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1535725852; bh=jBo3wS4BA/zEKJYcB1wVpZfBl26y6JDoM9tDdtPZ9Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xsL5jW22IxiUCteSf958nAur4ohTscf/fPVZQ7tws28ndKz/2aIgonD0lqzBV31Rm ok3u2z9KUVvd3l3iwIdesBXZseMkxkeJuk80rIZfzkOmt93idua8pr8/SZHWpyrF4U ZWx3fI2wnZ7D9ScHdcssudxoijyFIjsCdUfiIFLdsHKShyhkags+CdxowCFjRD4FX5 UH+KKFOgAOLW0yGxoAU9fF5gk/dbh1C+mBoMdHbU55C/AxlJ43Bxb54QsVdFIJcK0p RPQRXJeRu8I5UGLnGNMC5kzMNKMs8GxhYgbvod16EbKdo9J2/81PACdnqy7suU+KbE zcoDo4StxgVjw== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-i2c@vger.kernel.org Subject: [PATCH 2/2] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Date: Fri, 31 Aug 2018 23:30:48 +0900 Message-Id: <1535725848-4076-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1535725848-4076-1-git-send-email-yamada.masahiro@socionext.com> References: <1535725848-4076-1-git-send-email-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180831_073128_131631_3F2E6504 X-CRM114-Status: GOOD ( 11.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Masahiro Yamada , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Wolfram Sang MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This driver currently emits a STOP if the next message is not I2C_MD_RD. It should not do it because it disturbs the I2C_RDWR ioctl, where read/write transactions are combined without STOP between. Issue STOP only when the message is the last one _or_ flagged with I2C_M_STOP. Fixes: 6a62974b667f ("i2c: uniphier_f: add UniPhier FIFO-builtin I2C driver") Signed-off-by: Masahiro Yamada --- drivers/i2c/busses/i2c-uniphier-f.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index 9918bdd..a403e85 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -401,11 +401,8 @@ static int uniphier_fi2c_master_xfer(struct i2c_adapter *adap, return ret; for (msg = msgs; msg < emsg; msg++) { - /* If next message is read, skip the stop condition */ - bool stop = !(msg + 1 < emsg && msg[1].flags & I2C_M_RD); - /* but, force it if I2C_M_STOP is set */ - if (msg->flags & I2C_M_STOP) - stop = true; + /* Emit STOP if it is the last message or I2C_M_STOP is set. */ + bool stop = (msg + 1 == emsg) || (msg->flags & I2C_M_STOP); ret = uniphier_fi2c_master_xfer_one(adap, msg, stop); if (ret)