From patchwork Mon Sep 24 14:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147356 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp817251lji; Mon, 24 Sep 2018 07:54:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV63vC96dF6SYCwrakoFh1Lci7rRwGZL1iB9G9a6T64Zal1g7VRnwTOvkBvDC+1XQEwYIRn2t X-Received: by 2002:a17:902:101:: with SMTP id 1-v6mr8419511plb.15.1537800843938; Mon, 24 Sep 2018 07:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537800843; cv=none; d=google.com; s=arc-20160816; b=wWma3+oYGow/OhZPDHvM85i0jOvi/27KGAxo2oPW7XuJEAMVp6iVKDX+hd7cJjmMSF t4QgC2t36C+yOAk6EreiOecagAtasifDtc0V38n1D3vwZjTUKGLJcFSgQWItSB4afMn5 FxlwITxK4IG4E816kuLyXFVEryuNYAxvlKgPKO4ebIWa+L/xYk0pM6hKZmlm3YITIu2+ FY3EzXeGzN5Z/TLwmR3HwPGHx3G3PTSTugqFr4s6g39n2AkUTmk3oO9EKDGzMq1A1kQb H1dFKiaf7a3LUEg2MOl+Bl8S8GgMIhTmhwnD0Zc1snfcgps7GnGbFST6LXz6hudG66VK IjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=JabxhZx4zYpK9NOq523+ugIOzC+qZKM9Q5NA6kHsL/k=; b=y/cWg7OYYlpJ69Emh88wdD7O9GVEaFyBC+gONMByoSIbzOboq5VlvBMo0eVR2LS7JQ c7e2ntGvNTrrt+3qNJ+0DodamqvVjfhYldQDnm4L/H/3p+hZ70/TL8gKxVC7rqXliGle tbJ7l3MKVORJwSeZaF+J+KuBseGMmqi/OcoUZCs+Igb2dEjAICjadYq8CP2imcE0rKFK TI9YsvlLz3AWKcpzgelZOdfTUcPEIgw314sjMR7+WY5r6uHX2V5yoTieF917oVIkDfZu WyxqWn7PMZZqAHigGnqMaL44mP6yWHr7g7Sz9YZpCXnftFxOvA/R7INd8VUL8X+SI4Oi zSCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=n9FRslMU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si8139263pla.475.2018.09.24.07.54.03; Mon, 24 Sep 2018 07:54:03 -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=@microsoft.com header.s=selector1 header.b=n9FRslMU; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732463AbeIXU4d (ORCPT + 32 others); Mon, 24 Sep 2018 16:56:33 -0400 Received: from mail-eopbgr720135.outbound.protection.outlook.com ([40.107.72.135]:34196 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730562AbeIXUyA (ORCPT ); Mon, 24 Sep 2018 16:54:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JabxhZx4zYpK9NOq523+ugIOzC+qZKM9Q5NA6kHsL/k=; b=n9FRslMUGUqtmzS2bwinK89UuJKfbaPBAW6mOmukaNp4ozctif+1Uf8c4wwCQ80bwypAmTXkczQxevhJwSPxtUXSNX1QcEZ40vXRI7iJe3BO5FYf4rxUqC956rQCc8imp4/EIOSlFsIZ1MOvUADQfovlglrVOfupqDMZwQ/mH9E= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0821.namprd21.prod.outlook.com (10.173.192.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.3; Mon, 24 Sep 2018 14:51:08 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:51:08 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH AUTOSEL 4.4 09/18] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Thread-Topic: [PATCH AUTOSEL 4.4 09/18] i2c: uniphier: issue STOP only for last message or I2C_M_STOP Thread-Index: AQHUVBXY4XdFe6HyYEuBr3XQgbgyUA== Date: Mon, 24 Sep 2018 14:49:50 +0000 Message-ID: <20180924144942.164688-9-alexander.levin@microsoft.com> References: <20180924144942.164688-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144942.164688-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0821; 6:P81Xc7O83Ge3Z/Y4ey+76FiNoPSISGsH55/C4mkO1J/PqhWmSmr5TtOtmgJrJlYXsfKAgZbZxhCmVeORjshfbfJqEovTVNSov8PVpkwp2eeDxkmRMGDNXWPb2lKqS5SlYUWXg8VHdtyds7p2anKaYsUnH+kfitwBsPHWkyG/jMqdL8qisrhN6vaeYZ1AouPru/addgaQv7v0ZHPNc+gEyxAb6bejmOZTyIfYwRECofymETn+v/djrPtvJxSSMZp4TVkQqWl8slW/W9pYXx7IvlRCk1+P0pAqrXniIEOlXmUfmgJvZrPUAbAh6NuSiUzmWWJkzkHxhECeZ/b07Abv4jjbvC6BvN+wqvSnHD/wlPW3uRALZcsEMBvOuK1uza4MMq1xJm0AKLZKYPS8zm85JwAs0raTwmKMdhJr6IeT/dajCj3JZ1BstiArboHhJAfTwkx4CSjxDMP9LelbrRXJdg==; 5:NtK2DA9PHy1NVcZMVVXwE19cFAEqxqYpC7h/2n7uZXeTo5OYvo3kBbENDnIaj5q0d3Ulx5IvrXVl4Yp96bBdy98S6LRMrPqBEY97vsAiCO14WNYPsJhZ3yhHkjuS/cbAiiKxfJ+0Q1Y6XKHuwwJsDhNQZ2g6cpvvzf+1706DJ84=; 7:Oqf2mYY3vT03lJbTyITocb8phtVsO0jwWa0laiRDg65oDTrKmlfpW3XU9WWmQ5WWEJ4Eq0Izt5rLHdD9pX/a4soN93YNp/4kU2v/vcP8YO6W+vzhY9hXBSQaE+Mur3FXZ7d0mp3QSvZezfd/9ZJbZc1MH4uewpess3MpWiLWKC5M4sJdIIFYlzFqUUxp9xGAUceJzgLqsg2ZnUFfwm/hu0ibWg/1yOJDmOQO16cK46rUBrKqH04xBd1+hU5OpNp0 x-ms-office365-filtering-correlation-id: d8ca4ede-8faf-4501-a4b6-08d6222d29a3 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0821; x-ms-traffictypediagnostic: CY4PR21MB0821: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149066)(150027)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0821; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0821; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(346002)(376002)(136003)(396003)(366004)(199004)(189003)(102836004)(5660300001)(53936002)(6512007)(6436002)(256004)(217873002)(6666003)(6486002)(2501003)(15650500001)(10090500001)(2906002)(68736007)(5250100002)(97736004)(107886003)(66066001)(36756003)(4326008)(25786009)(1076002)(3846002)(6116002)(2900100001)(8936002)(81166006)(81156014)(8676002)(86612001)(86362001)(7736002)(305945005)(72206003)(186003)(26005)(10290500003)(6506007)(6346003)(478600001)(14454004)(110136005)(2616005)(446003)(11346002)(476003)(76176011)(486006)(54906003)(99286004)(105586002)(106356001)(71190400001)(71200400001)(22452003)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0821; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: +o/TF6dJWwJGfCiLVcrvgXn4F6ZtybHDMRovFeXBSpkM5/6BTp77V2LTUo9vO7m34jMQ5CEEDcwZszPfsEW/q6kU+/SvYSqUTsjtcFVfKOZXdZsN4jUMR8Mw165B0Mxg1qvFZ6AiuIH/Pqxh7ezfZYa9TCniYCUUGqzDsqKkRogWLWYAG2By0KmsxO9hrA5Ap5GKXGoeafzKyk/oWtt/pOfnMNEj8wdZ9XfA0qYjwS9nxCjHXWF+vevHY4YALq7YJDP/kxPsYfNt8lWOdrO+OeyNSCT2XZ+Z5W8tGD2AZz5nqNLAcIEU7iwFw2DyOAomHxVCaXZEASNhL76naM76yvX6jDX79eko/sJ0N1D/o7I= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: d8ca4ede-8faf-4501-a4b6-08d6222d29a3 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:49:50.0979 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0821 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/i2c/busses/i2c-uniphier.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c index e3c3861c3325..ad5eb8bacc6d 100644 --- a/drivers/i2c/busses/i2c-uniphier.c +++ b/drivers/i2c/busses/i2c-uniphier.c @@ -247,11 +247,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 Mon Sep 24 14:49:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147354 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp814868lji; Mon, 24 Sep 2018 07:51:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZUiGW2CHVj6oCmcvofuu79Ky4f7LDojH8PzhxchLu0LNF42ILXo2nGP+5hIw4Ob3pvWs/M X-Received: by 2002:aa7:8319:: with SMTP id t25-v6mr10737044pfm.81.1537800695114; Mon, 24 Sep 2018 07:51:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537800695; cv=none; d=google.com; s=arc-20160816; b=oxFF8KI/DoOMTntDuvE/isuMMgjd+7j2IBjKMLnb3oLnkUln6iSvx70Vgv3+tUg+qm YVAMnk+BUhk/i0zBqrjI34i4yqmqsBhUgOGs5pzIFo3xq2HdOc/JpWU4Y4/Sj+XVXAg+ N7ocOJzz3DO40RSa1iDJDCskBLzceZ3yM2ZcY7WeRnMGC5Bv8ncshiEGp0Xwqz0HJTCf KUQQh9YRELfEKJRLNRAZoxk49fKjEA8fu8jntLrCh4DMUVC/f3GSqVDFFslBreExW1Cb 1L2xgCDHpxq+9fIYxzb1X9XE0WNknJUX8IODa7zfC8gK+ZhwnmST22/Gq7tt61kc54q4 RIVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=HJ6sn+z5qvsmCfexbSg5NFMgNNTL97LyyrRlptzSmhE=; b=XbDKYctsO57aU1XaAWCO2RdVaaEDsnbe8k4+eJtyyyUmPaExUZ7KMQwkKKaIc/xw2f yunDb8GUE3G7AirKSoCENRlFeoaC7L6oyPlLmBgJa/VRe4rsPRlAtfw2RD0fYk/drxUO 3npl6s6evXgXzgJZOMkLWIlIdGsTQms1nikq55WpoTXKfs+vKG+BzdRQDJXc5lRqV7KP QEYcBJ+O5MvyU8Rw9/qOpIzyiuHAde54zzZ1Osb+CWdYoo/X33Rojeq+YRmurK+uxRwd vHbG71RZ9iyztoYffO94KEe+BT7yqfOgO+6HPLV3iCOlVNQws0t33ZXTg4nLHrhgD7f2 YgQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=DCtVXD3f; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k3-v6si34346055pld.6.2018.09.24.07.51.34; Mon, 24 Sep 2018 07:51:35 -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=@microsoft.com header.s=selector1 header.b=DCtVXD3f; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389139AbeIXUyD (ORCPT + 32 others); Mon, 24 Sep 2018 16:54:03 -0400 Received: from mail-eopbgr720095.outbound.protection.outlook.com ([40.107.72.95]:35088 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731770AbeIXUyA (ORCPT ); Mon, 24 Sep 2018 16:54:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HJ6sn+z5qvsmCfexbSg5NFMgNNTL97LyyrRlptzSmhE=; b=DCtVXD3f3rg88CKkZ2fZ0JYspTGinHfh/dtPQ3F7Vas5kUwqXbetkAZThBj6zSVAuZiLl8ioMPdvFv3x+E6Coomq6Rp3QX0ah0jdNsUuN/YB6c2u4VmKn7hxYXzvFD89Ld9DNEbusw3TKvpEWFI/D556ccud12iWiWs38wwckC4= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0821.namprd21.prod.outlook.com (10.173.192.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1207.3; Mon, 24 Sep 2018 14:51:09 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1207.003; Mon, 24 Sep 2018 14:51:09 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Masahiro Yamada , Wolfram Sang , Sasha Levin Subject: [PATCH AUTOSEL 4.4 10/18] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Topic: [PATCH AUTOSEL 4.4 10/18] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Index: AQHUVBXYbA+9vef5DUC8taMx6Pnnuw== Date: Mon, 24 Sep 2018 14:49:50 +0000 Message-ID: <20180924144942.164688-10-alexander.levin@microsoft.com> References: <20180924144942.164688-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144942.164688-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; CY4PR21MB0821; 6:hnxdpJQo7SvIR4m7TO4NrACxidsjEX4TRNmgeHynpgscAgcX+1+x6zxA4DkmSCvcA9usbIv5KBK6u6g7/pno/CJjeBRk7PmXwBaUT2wvWt2JfkFKD78KpnvIQkio0lo/d7bYBhseCBnbcdb9XEGv/bjWjvKUwm710byu6hLaCL4/xaCXqLpf9zzzdu96H1sxDEQFM91qgUhKfiaZDnOuJEA4FdwZSPQVwSeermBSyxytAnVkJjKg2oHh9FG/aOOkftdMyHyT3bo6TVisXXvVAcMnkKNr4VLZ2d/dij9VgafjucLj2OaIuRka+N5olNNsZ4aX0RZKj82TWrXUGqq+TNR1WvHVkxt0Bw+DsxEXf2HkN0Qp57BqA74KLz5FkTYLgx4u5lxC7g4jCO6yEyEHm1XmsPfLNi02772X0lGe3bDIg4OlSZzH82zygpgAQN+jOlICy7wHtn2QnDSScuhvZg==; 5:Qc5nJGO+tO6BYjp7+tQNK9UG7czL1+YWyYbrgxILJtdK4ApSlh0NLiSGNjkg7kMDqGM/Q9GH2pOCV2iaxTzvcIxbESml5AY9Wteti5PjrjKJ/0Ys23TItYIsVq9C6V9/7OuO0LZ933i5EOuR1Io/0yt1LnD5qRRetylq45D6Wjg=; 7:CUsyMZr84VfO+dW8QpCkipzBM1mTx9I5zNZwWuSX3XzFKmWUISQquts1snyuG/pGgerLq0oiZYvBtiu2pmpWWZ2PH+SV0ycHMRdYXmoxodLji8xO9qEGrjSkrjUnbw99Zu3FghaQNPAIRgtKlNYCdz/XpCHzynSWNagiJkJGU7lqKiPW7wmyShS2lrxfd5/I3H4zs9MPyYiIid0wcs+jj3YYghfYHyEvP+QXSE8xxtiDAaJ0SjUpz1kROWDJYaoc x-ms-office365-filtering-correlation-id: 9e59fea6-4986-4731-509e-08d6222d29da x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7193020); SRVR:CY4PR21MB0821; x-ms-traffictypediagnostic: CY4PR21MB0821: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149066)(150027)(6041310)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0821; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0821; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(39860400002)(346002)(376002)(136003)(396003)(366004)(199004)(189003)(102836004)(5660300001)(53936002)(6512007)(6436002)(256004)(217873002)(6666003)(6486002)(2501003)(15650500001)(10090500001)(2906002)(68736007)(5250100002)(97736004)(107886003)(66066001)(36756003)(4326008)(25786009)(1076002)(3846002)(6116002)(2900100001)(8936002)(81166006)(81156014)(8676002)(86612001)(575784001)(86362001)(7736002)(305945005)(72206003)(186003)(26005)(10290500003)(6506007)(6346003)(478600001)(14454004)(110136005)(2616005)(446003)(11346002)(476003)(76176011)(486006)(54906003)(99286004)(105586002)(106356001)(71190400001)(71200400001)(22452003)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0821; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: jgew6Nq5wbml0TJSFwDZXb9nQDfokQ8Y9D61m1Jb8DUEmZ9FLRguW/JqDUB+ZHaM6i+SDGeeZo10NBcYbZbRq4iVOOaAhvsOwDyr0xM5TubMd/si3SyHwEZw39kp//s81cf58anwleDZvuPMFIQ4zm92+pq58HyszEy9MikSg2nGHr5yUyFU86D4A2U5G1Dar0fM+MjgGRTD7GiKA5U9kYS2V4wI7nyQB6s+uU7y7wmT58/OFR6ZXHBZThKsh0BWivSuT9Di7u5cK2mru4BRooX/faAGmz2aqUgnXQS2/CsJbUlfj3Giam0NkoRNgh71fX2NCP1fSGtpK4EY4s6o2Jh1uTan5g4L40Jj+zyablY= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9e59fea6-4986-4731-509e-08d6222d29da X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:49:50.5663 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0821 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 4c85609b08c4761eca0a40fd7beb06bc650f252d ] 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 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-uniphier-f.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c index e8d03bcfe3e0..3f6b43fe4d5d 100644 --- a/drivers/i2c/busses/i2c-uniphier-f.c +++ b/drivers/i2c/busses/i2c-uniphier-f.c @@ -394,11 +394,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)