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)