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: 145657 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp853486ljw; Fri, 31 Aug 2018 07:31:37 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYhBZ5/c5TpSyONXdmaI54squK79IGHyVITQmzu4hFCLsHpF7FJ2+43GvnB+DjOIJF8oTVx X-Received: by 2002:a17:902:110b:: with SMTP id d11-v6mr15463416pla.171.1535725897069; Fri, 31 Aug 2018 07:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535725897; cv=none; d=google.com; s=arc-20160816; b=qQ14WTagFX36HcAPBDd1WkyJejhI5ocXOzkKrtsjRnaMcPa3fbsLkOggVb0HEVHOI7 MdrCt3Fw0lu0wvCo7rgBOjHuUgiLb5Ylo38xbNon4SosH+FfFZFVPRJGEtqeMXc74adF TRqZzp3d6puZ2aF5Pg4l9kgzoTsBXYitwmrDBqsjmTsgv2eURGzEK1IRAJacxTtlRfoG 1DkUKvYf2vBtjkAZn8VDnevP414qV7i/rR3saWRNcA6gUBLn9ut75H3I931U55W5nvCX 3zJoMzfR37Zvms7+w9SKocWAGLeSxxbFro5nssndEXd4FumU78jk1gwuOAQ/W5WoKKG0 ioTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:arc-authentication-results; bh=Ky6qwotd80ihjx5nlKTuOrYtigeiIdPoY6NspfMkiMg=; b=LIBO6XGAS2eBwzQqrqsroUfCl9IsRrZ80PnIojpBII1bNKp6hxqc08+tGQAybR3U9b bW5RpmDKaQv3bTn2HnYOiM6PNmZ/vSk/O3+vINvFniwCDSzy+NApiqH0wMB0O73/AGHR lZVPZWp2UwPCuyWbpwExu94PJG/dsWEuKxN0ojagURwMbkWATkdRQxMufxPgU7Q3a1q1 mjj1KFN32CbGRrO4tspcdowrZRF28iPAelDFMCyE7r2HkXVb6FnME2PF5B6Q2rTtdZ1T 2j5V6OT3VDWFY4OzMgfRjfvuQ8EhwmNmOpOVI6ZxLf5B77+840wi4oWa9JeAPx/AxbDG BBaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l44D8bHU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si9904406plg.390.2018.08.31.07.31.36; Fri, 31 Aug 2018 07:31:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=l44D8bHU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727599AbeHaSjU (ORCPT + 2 others); Fri, 31 Aug 2018 14:39:20 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:52189 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727591AbeHaSjU (ORCPT ); Fri, 31 Aug 2018 14:39:20 -0400 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 Cc: Wolfram Sang , Masahiro Yamada , linux-arm-kernel@lists.infradead.org, linux-kernel@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 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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(-) -- 2.7.4 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)