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: 145658 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp853557ljw; Fri, 31 Aug 2018 07:31:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdadRlDYmap+YYlCdS2qgDe0goSVwEX0XbMr6MjJr8tWR3inT1BHW5vTrvRgAIT4StiFjr5n X-Received: by 2002:a17:902:68:: with SMTP id 95-v6mr15533931pla.248.1535725899925; Fri, 31 Aug 2018 07:31:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535725899; cv=none; d=google.com; s=arc-20160816; b=b3HGWF9/QPFouDv3DLynOC2fIXuy3khQH4mujb1kIWs4xkM/Kt1w23JAV0a7UVXat8 /MFvx3YOFX4YoH+D3jF3VT31C4Qf8I4CePfzg3WEHxWIZ9ONIs1JBExQIMlc+MJ1/D6c M5JsXs3NqolYRCF408WdfqkyU1qw2Vqac7Ux5RoVipxdkOaIOpLLwpbTjwB6sUiendke 5+H2Hcz7EbNRCkwY53BgcdDn+QN9auIHOI4fGtdTosnJdRH6htSW5tLyQg+tyVfCElPf Le8PBIoUa5C6uIBH2ymBGv4270YTuiSb3eCWahkkfqoTZhWTJLrBe8+kC/6hhoHRC0hC B8aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=jBo3wS4BA/zEKJYcB1wVpZfBl26y6JDoM9tDdtPZ9Uk=; b=Fxnp6zZAneFl97lm2UrZ2Wq4drlKvd/AP/PCW/EV+NJx6opYbkbSxvzyYsYC6NH6os 3zGvBOBGdXpHlbGNT3DscQs/YJBfuvQmSNnF3oC2JtmgF5nlRpWju0jXMLD5FpyUj4EV OvWEQWavHMi81CoS/MoUu8mu0yehXGhgzLBY5TOffDv84X4/Ci+E2lwyrEQiEVw8g7+w ArRzmfXv7UHHyOcvEeACKEndti/yUCHjgB/qUqfBkxx9rHtwV+E3BlqD3/DWAd9++spe /MkqrxEQ/2gOSeiW9MOYsPBc7xXtPA5lhezSV9U88br3eJ3XTskKfuaqCe8eZHJOcDwC vDoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=xsL5jW22; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 m3-v6si9674592plt.71.2018.08.31.07.31.39; Fri, 31 Aug 2018 07:31:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=xsL5jW22; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728663AbeHaSjW (ORCPT + 32 others); Fri, 31 Aug 2018 14:39:22 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:52188 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbeHaSjV (ORCPT ); Fri, 31 Aug 2018 14:39:21 -0400 X-Greylist: delayed 24953 seconds by postgrey-1.27 at vger.kernel.org; Fri, 31 Aug 2018 14:39:20 EDT 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 Cc: Wolfram Sang , Masahiro Yamada , linux-arm-kernel@lists.infradead.org, linux-kernel@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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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: 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(-) -- 2.7.4 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)