From patchwork Mon Sep 24 14:49:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 147357 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp819775lji; Mon, 24 Sep 2018 07:56:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV63G9wqAr1/CoN9Z5Vjl9lt4KT1jmUqNhj07kzSlb1JaRe86B5sRZH9TcJC8+AOXjF/pU+Eg X-Received: by 2002:a17:902:aa05:: with SMTP id be5-v6mr11046012plb.313.1537800982832; Mon, 24 Sep 2018 07:56:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537800982; cv=none; d=google.com; s=arc-20160816; b=ZTD314gHYYO9gZnPGW+/J+rtMeP+o+Y7kc37X6EscUhyuJwMuns7VLBHW2uvUKQkfo +v9vBKBEhSXDrP135ptvzZ9V/oVYICpJav/p66JoFPsIHMZ7AGhD1BNIBjSWfhB13qUC axRAfrFzR1vOrc3AJ3nyliJEOADrttDsNfb1RABh3Xj7PxExJGKJTwo/x1Px4WnOURHa iMKdsFU2D97SHspLn0z6cjLAA6RRBOoOZT1NF5UGrfhYTqnyKKXwJ4eELyLzzzxd8H/8 SJ95Y2gjHcgKvmXXhv7+hYC2nwuezTSDPuef/VPISm7lYSRAp2HMwtbDbUYymUPxwXjR GxHw== 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=38ePBoYt0LmN1jhM9rv26rIrhCKdt3Ibrx2fumzgZUY=; b=fqIUwwjWXCDPiL5JsmhutoOIntUiz65K0gQIl9G3zWINKsXz5pELPz1nuAjUJ0FhHA zEW2W9EC3ZQm0k3FYk7xyP8L21sEfCWLQ4bT15ZmTt1GQDHEwP/finPfkDxLkFDbSMLw Rck8/0QDgMyOh/FgDgzEjdS0vAY+rkyvlgUduBGRz0jo0ccqP/pLKFknJGofvxDZ7sC7 45rWK8PTezqXxUKERaDd7JsY+rJ8WHbCeNxAyPIYW8DwC6K2/0pVzi6xGrfnMC5x5STb 4JkerNnCsj0rPArR2OMi43xXmnF8vfcEKgGXqE6IH0Lu1F0ZtuFy+xr2MYOUJ4B+GnlG xQJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gRDyYe29; 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 r20-v6si2356868pls.485.2018.09.24.07.56.22; Mon, 24 Sep 2018 07:56:22 -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=gRDyYe29; 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 S2388584AbeIXUxA (ORCPT + 32 others); Mon, 24 Sep 2018 16:53:00 -0400 Received: from mail-bl2nam02on0111.outbound.protection.outlook.com ([104.47.38.111]:27262 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388427AbeIXUw4 (ORCPT ); Mon, 24 Sep 2018 16:52:56 -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=38ePBoYt0LmN1jhM9rv26rIrhCKdt3Ibrx2fumzgZUY=; b=gRDyYe29Azg5tKz8UoYrLYU62LlN/AtNLKenvjNwI+7Jw1BM8L6LEK6pDDK85BVIMBuBFA+U3iitkOAroDtble/c1R3VwYhh1phTjzgXG+fUUdcDV50BW6EnhvXDKpVhivRukw0Ver1KE0VZygT/JkjpcYjACeo3Lo76l6lMQb4= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0470.namprd21.prod.outlook.com (10.172.121.148) 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:50:19 +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:50:19 +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.14 26/36] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Topic: [PATCH AUTOSEL 4.14 26/36] i2c: uniphier-f: issue STOP only for last message or I2C_M_STOP Thread-Index: AQHUVBW/Oi+dM1nG5k2669MJxNfvjw== Date: Mon, 24 Sep 2018 14:49:08 +0000 Message-ID: <20180924144851.164533-26-alexander.levin@microsoft.com> References: <20180924144851.164533-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144851.164533-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; CY4PR21MB0470; 6:ii7a/3AG6t1PEDE0FmQmOZKdz9CsMJXTqLqUmMP/YHlkdTpOn6EU9iZqD1VuJO2Pc1LACVXijxHGClUGIGkAIf2SNUTOzuFfOEfefQZsK9t3GXxhYe+vL545RBTCd0U3BCR2u0bsSB8XAi8P6oNWYorq8ohHnTYgEAVFdo2ylKAd5KiLxmzHw+NgFEqLmKtoWzbGYrqOSwn+B9syUZB6SVVSCzMauphND+4HzanxEeoLBpvFpeh1S6zrJ4etxqXct1BqCqlwqs3qsP2dotr075tG8wq8eNWmC37cLgxQrX5QX5aEHpWgDcGqPg8TYeW24TVLEQJIMg1CuQNHIOaygx+XtmewmendMOefozFWf8/SAKFc8bAl5VdVsUagLoBuQViNyHEKPektD21f+gHvP1OKcm/mThq44v2RTLXmB1eWKCVAoo7WUUpy01Q5IggmLXyQ5FOcyUEb25ZbNtLMsw==; 5:5DbDcMUedYD/FlYGXUmQxEZKFblpV0HknfI9FzDJK99COMY3RcmL8dPuWjh2gRImuNSgqzNBKq78H+xIfrE79ofOKlb5XRRITfwC7glxJklgq6Z2yanJCrrICHFPdPGeDmCXes7gE3FXLE1Ar5ZbzckpdWCZSWUgQ12Wu7PB+Uw=; 7:PW4cxiQqY5RLhWTXgL1qGui/wrJGld4IRFHJmaJZBzwfBpKVOVQPipmyYh6MJeW1vnvHhWi+d8nVlnRJRtKk+wmke3OPiF/1ud69Asz9u23yB048Zq6+J9AAyD8H8Ucai3nE9QERmq6b7hxCE5GdsnQtOxK5fJyO0uTTo04mxAs+xUID83RZO1L7a+D6IK9AGlpHV3qNAkaJ4aC1P88yVNjeUYGk19SVGkyVy8rdsfBPib+31ZeGYp0q+YK847sn x-ms-office365-filtering-correlation-id: e707fcc2-2ede-438a-b4b8-08d6222d0c3a 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:CY4PR21MB0470; x-ms-traffictypediagnostic: CY4PR21MB0470: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; 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)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149066)(150027)(6041310)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(201708071742011)(7699051)(76991041); SRVR:CY4PR21MB0470; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0470; x-forefront-prvs: 0805EC9467 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(396003)(39860400002)(346002)(366004)(136003)(189003)(199004)(26005)(97736004)(53936002)(25786009)(1076002)(76176011)(99286004)(102836004)(186003)(6666003)(4326008)(3846002)(15650500001)(110136005)(107886003)(86362001)(5660300001)(6116002)(72206003)(575784001)(54906003)(478600001)(8676002)(217873002)(86612001)(256004)(14454004)(10290500003)(316002)(6486002)(6436002)(106356001)(486006)(105586002)(446003)(6506007)(11346002)(476003)(10090500001)(2616005)(2501003)(5250100002)(71190400001)(68736007)(66066001)(81156014)(71200400001)(22452003)(7736002)(305945005)(2900100001)(8936002)(6512007)(81166006)(36756003)(2906002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0470; H:CY4PR21MB0776.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 22Vfu9z6xM/s0NCFkFXk6Ugm+Zy9oVznVpwn8JuexK9s5VqXXwtP639rhX+nJd+DxhKYEQiy60Mh7Y9RcbGkj50SvdrPPXldikpeauzEfxxcDA/hODHjSL4Bv5hZZG9OpJnLtAo1G1kLOHf5W9jAKjD8QypacbICJjLSpPtMYqLfq0ThlNwKm0Ho9J5qP2PGauyWdAy3UW3v8Zj3tulv/QGQ3B6pSaH5gaUjfDCBDFdLQK472FTksfu0vqpr8I3ASklX/08kE3FulQdyryqXdm8ggBZTUHqSBEwUAOYy72fLI0CzkQ5Yw0EaG/ArpiCNziSyGC3031Y+NZh9gPmLq+vwsqSTaW3/svpKxD3nuUg= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e707fcc2-2ede-438a-b4b8-08d6222d0c3a X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Sep 2018 14:49:08.4226 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0470 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 9918bdd81619..a403e8579b65 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)