Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3927500imm; Mon, 8 Oct 2018 11:49:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV62fxdR/hb5ls5tGhshYBbz+diwYat0O5g+JeJueptElkX0oIMjH+W6HOm7OTyeDkSzKYgpk X-Received: by 2002:a62:184a:: with SMTP id 71-v6mr26331103pfy.246.1539024578926; Mon, 08 Oct 2018 11:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539024578; cv=none; d=google.com; s=arc-20160816; b=kp6a23HfOPnLRwuPwiH7VJsXduqAqu4Xj2/hv5+Ssx5cu/UzyuJi39lZoe+Ipb9YI6 aAyZrQJwoM+T3/rVMYeXp3AESjGw0zUOBPmxEf82mqmR5KFDqsnyAC7AxmqM/eLoZYOD fHEM0tWSsk8F7X1iaGA+26v3NIEVfVlHwfjaGrg9qpQ0VsDZQRUDj9JWpgBH6pBTGh5u 0radSubuKohQBMAeh2JknuHOGFS09G7j4K9m1G1o/3cxtK8n+fpsQEf2eFO0/0LQVB5x kJ9oJgw6mM2Ug5TZvi/YEGUTtOQFfr0EyRFaNLlB0hVLMwOGE8sUDul5KOPRrbqROpgD JiPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zU43gleU5XDr7Hsq9alWBIVxQZoTgBSaMlHiDblshGU=; b=il8FOS3FsuG9KcPYOGisB+QJ7N4D8UYvauwlbszqe6wbEWaix7spd3Cl+rBQoD19Mi tSjFNjsihJc+frpMjEzwpcfq5spBG/dRWjmuuH543V85E4eQPzoOobxsaBPLrGr5KPHD DnjLWhLr2CRqUX/jxVVkNBS6pGyyIKTN5c60TzbhVcAz1H4mP59Z48TlKaoSAZXExxph ap6j68NOA4a4DsqN08ijrnfSdYn4OaY8T8tM0ide5hkTHE9bTOmTl8mhU2dJg/NO4S9Z /0L1HGx5rCw7UkWi6P0TYiAaH0E08GYCKH/hfYJEhAo2OdYjqxwGN0SZPm4VmF9ygo6j z8hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=sR5ALuu3; 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 k6-v6si18772120pls.174.2018.10.08.11.49.23; Mon, 08 Oct 2018 11:49:38 -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=@kernel.org header.s=default header.b=sR5ALuu3; 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 S1731565AbeJICBG (ORCPT + 99 others); Mon, 8 Oct 2018 22:01:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:50004 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728239AbeJICBF (ORCPT ); Mon, 8 Oct 2018 22:01:05 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E3663214DA; Mon, 8 Oct 2018 18:47:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024478; bh=3bMtu6uAcHbUIDPn1HPb6YT8XSLKbYvXfRHTj0ZC+2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sR5ALuu3tjZpt3qg1/eF8u4mJ4iAXZ0oBU56aFqBEaxZnBDJ1rkA6FCl3PrpQMS0G YGx6s+ShSlkRQzGCuz6aFUDL4NpxS7TxW+SuNRciJKfzfHGIlTQJz+y54L7H+oR6vH T9szP03j4ehYSYRdD0DU4ALk/1UFkFzjbd4zV3So= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH 4.18 053/168] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Date: Mon, 8 Oct 2018 20:30:33 +0200 Message-Id: <20181008175622.064836780@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Masahiro Yamada [ Upstream commit 38f5d8d8cbb2ffa2b54315118185332329ec891c ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-uniphier.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -248,11 +248,8 @@ static int uniphier_i2c_master_xfer(stru 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)