From patchwork Wed Jun 20 05:17:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10475959 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8ED8A600F6 for ; Wed, 20 Jun 2018 05:18:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 751322855E for ; Wed, 20 Jun 2018 05:18:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69A9C2856F; Wed, 20 Jun 2018 05:18:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B0CB2855E for ; Wed, 20 Jun 2018 05:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbeFTFSp (ORCPT ); Wed, 20 Jun 2018 01:18:45 -0400 Received: from mail-ve1eur01on0090.outbound.protection.outlook.com ([104.47.1.90]:31456 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754023AbeFTFSa (ORCPT ); Wed, 20 Jun 2018 01:18:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axentia.se; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CyZboMt43gUFY4eNfJH8QgYFSDZEZ30zrGMpA3uUjZ0=; b=t4svasv+adIyYps4PhjBDMIgOejXo+U+ldwa8D+fdrCLAkhtuECy8vBmV3jdnTfSzcbgqiTP67fDCeVJ+FrIDNJhWDR8W/HRmpqqwivnz+LeCoOuTFQNv1Vum2aDAylMr869hSucO2iC+gGxRcGPP+v0UptqayPI/I0OLtIOrTA= Received: from orc.pedanet (85.226.244.23) by AM5PR0201MB2452.eurprd02.prod.outlook.com (2603:10a6:203:35::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.863.20; Wed, 20 Jun 2018 05:18:23 +0000 From: Peter Rosin To: linux-kernel@vger.kernel.org Cc: Peter Rosin , Peter Huewe , Jarkko Sakkinen , Jason Gunthorpe , Arnd Bergmann , Greg Kroah-Hartman , Brian Norris , Gregory Fong , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Sekhar Nori , Kevin Hilman , Haavard Skinnemoen , Kukjin Kim , Krzysztof Kozlowski , Orson Zhai , Baolin Wang , Chunyan Zhang , Wolfram Sang , Guenter Roeck , Crt Mori , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Dmitry Torokhov , Antti Palosaari , Mauro Carvalho Chehab , Michael Krufky , Lee Jones , linux-integrity@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-iio@vger.kernel.org, linux-input@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH v2 02/10] i2c: mux: pca9541: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) Date: Wed, 20 Jun 2018 07:17:55 +0200 Message-Id: <20180620051803.12206-3-peda@axentia.se> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180620051803.12206-1-peda@axentia.se> References: <20180620051803.12206-1-peda@axentia.se> MIME-Version: 1.0 X-Originating-IP: [85.226.244.23] X-ClientProxiedBy: HE1PR05CA0127.eurprd05.prod.outlook.com (2603:10a6:7:28::14) To AM5PR0201MB2452.eurprd02.prod.outlook.com (2603:10a6:203:35::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d6cd1574-88fc-4bed-311d-08d5d66d3fe2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(7021125)(4534165)(7022125)(4603075)(4627221)(201702281549075)(7048125)(7024125)(7027125)(7028125)(7023125)(5600026)(711020)(2017052603328)(7153060)(7193020); SRVR:AM5PR0201MB2452; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2452; 3:p6ewIGJr3VShg1xB+nh1n97j69EO2GDOXZq9oiHZxD0dzDh7EAPrAcSKCsWhorJV0JaI+bhLa1QrCoALGQT6uBk/dVTmhO7UqTnXwHFE+IfNTTY+GRiimHz1Lo/qkCiJFJHmP643JSzFX6EdfUdBppgKY31rKRcpbrhw28KsdZFr3HNCGCQzvMhytCvoPGIb8dvt1ugR9xZf20zYFe8/4Nec1zhmIrRPH8OFc0Fe3l3dOa0VRvcG44Gg94q2gySa; 25:rd1oxfUccYYDgN5QhL5EOe0OE4W6Y5jjlowk6bLzvKVBQhB196vTiP47jv81V2CcgFrTe1bYo6Xg9QceSxKAvE9FoH1Sd4+4pzRJvqN1V/JB4cjmIPRWKL6iwey90IGIIpSMMT0xwVLT5UFi4Ga86d7cGfuGIKoRotrzfWCBNF+HlgpxqNf7voKIw4iGfzK+Tv7mleD/GYhyrd+bB0Owd+4bRyakdHznHL/2h5rWdr3zy1nkoBGw1dQyh4MixUW92yhf29sr4HXzgworHP/6vX5dsjZw6I2xnILQzT3sgGtm3VNgs0F+iXQf7ryM5H1ttaBNe3npH4pR2nHiDlu5jQ==; 31:pnk7SnHOC3QKKIDO0pr1UtLTktNzvcVRAXvs5ABA7+rYqlDqKUyVbAsL9yyVOSReYjupyZkcUDfClAuaWfQcKlwGk7Tq1oZrbFiFGRFZqCCtuOtrR+orHNFatFfCrQMz9CoQ/eYI44Qbw9OHeKmAGy1SI7aoEjQuSTHMfQnQmQ6YtpJNVmorS+DkXRODDTgSocRxfJ5dDuakdUoqi937MfU0Ne8oU383bUBFDdxY+ss= X-MS-TrafficTypeDiagnostic: AM5PR0201MB2452: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(2016111802025)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(6072148)(6043046)(201708071742011)(7699016); SRVR:AM5PR0201MB2452; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0201MB2452; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2452; 4:67eid3So/8r/Z4V59B8oHtOeB17ygUK9Ri4w35wj4Amgp+WmINQd9LESiSZPkLyKu70fJSyFNpyje9iFwOZTh7xMmIsFUnvo1+zIgyNrMom++i919nRmBZqGg7LSLpw1w0rvxvJlCVFo/ERCxT+PQg9PBTOctSZw6gL2F6PkLlgO5uY24zkU2jWrqCGNosPmp/w1vauIaIg9/u65MFRsuuakr0D/8SmKXNhUWxNfCNWLyA66aq0/fsifFwyBM+T+UEtene7gxtE0ET/q0P33RA== X-Forefront-PRVS: 070912876F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(366004)(396003)(39380400002)(346002)(376002)(39840400004)(189003)(199004)(51416003)(50466002)(7416002)(6116002)(186003)(59450400001)(48376002)(3846002)(26005)(6916009)(53936002)(6666003)(1076002)(7406005)(6512007)(76176011)(15760500003)(2906002)(316002)(386003)(36756003)(478600001)(6506007)(68736007)(86362001)(5660300001)(16586007)(50226002)(52116002)(54906003)(16526019)(2361001)(4326008)(2351001)(47776003)(25786009)(39060400002)(66066001)(8666007)(305945005)(486006)(8676002)(7736002)(97736004)(81166006)(956004)(106356001)(476003)(105586002)(81156014)(6486002)(2616005)(8936002)(74482002)(446003)(11346002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0201MB2452; H:orc.pedanet; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: axentia.se does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0201MB2452; 23:1VSUca+xPUvU7tP2b8jBaKBurtmnQAAZKX8YAyI?= =?us-ascii?Q?QRWyhMGfv00zZU1yU/2alNHWjOefGSg5HH7wafPOAux82aM0Rp03bcGLxoc4?= =?us-ascii?Q?H7jjFnnU0RIl8ARO9MFzkoR2h2/Y60PaKZHn2v35gBmMqRAH8MKtoHgQzs0z?= =?us-ascii?Q?EMEor3V7W58I9fi+TMsbxuQ+PibJ9/h62vjy0VR3vaq485Fc3T7oHHUjybd5?= =?us-ascii?Q?Iq/6n1pAgJLc92e4KqdkgslQLJZp1klNemrqO2jRoNks+75Ev2HvTowGPPHA?= =?us-ascii?Q?u7sst7STGltUT7m1/nkpDujYWdY6jp5jQtXaZFzhzAOQ2cQW2VLXrVD/PSgg?= =?us-ascii?Q?JRQ26vyhdVHHJKltGdRmHwXBkiAqJadRk2wW18Pjj/2IdNx8JOdCPSILP7SG?= =?us-ascii?Q?To+R3VPndCE8gFr74wbfTDjsLehL4ybtOMr39RPlCpGqWPTnzh3/p+CKN63B?= =?us-ascii?Q?wvvfuNtg4AHA2zm9hDHuMW75GWTaqgh5XmxNgVXFcWmTU8L06O0iaB8qxdyg?= =?us-ascii?Q?TG59lqoswYweNpEQQLeSRlCWDu+KFagmY0B61PoC3kRNO2zU/MrjeIELbEQp?= =?us-ascii?Q?8ZkiDfNwv9DHYqguxbXi5IYUOQ82FMGdTLJXcsUn+Rg6WZqB7hO1/YMcM3X/?= =?us-ascii?Q?CXTtSck4Oqw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-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2452; 7:5snsFAPX2N1YuOE0b/a4d/LuElyGGvzOcwWYxcD4AeJlY4mHONQ8WGwMlM1x6u1MpenY1Qe3RJUunSklCScLZh577Ow0321hBYnU+BZU3zw39vUuqC22mzo9hDU87D912tWXlU97COB3bAS55qu+zM0Xo0DzgXGxz0CksrszyRBVSQNe0jXdjyETEHG5O8Jvpvg3OgJo4B3HUi9dPZTenzrYecrcDRlRcWd/S0DDtGpV5JBJYXaHDph1ErEB9Iww X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2018 05:18:23.3423 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d6cd1574-88fc-4bed-311d-08d5d66d3fe2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0201MB2452 Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Locking the root adapter for __i2c_transfer will deadlock if the device sits behind a mux-locked I2C mux. Switch to the finer-grained i2c_lock_bus with the I2C_LOCK_SEGMENT flag. If the device does not sit behind a mux-locked mux, the two locking variants are equivalent. Signed-off-by: Peter Rosin --- drivers/i2c/muxes/i2c-mux-pca9541.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca9541.c b/drivers/i2c/muxes/i2c-mux-pca9541.c index 6a39adaf433f..bc7c8cee5a8c 100644 --- a/drivers/i2c/muxes/i2c-mux-pca9541.c +++ b/drivers/i2c/muxes/i2c-mux-pca9541.c @@ -345,11 +345,11 @@ static int pca9541_probe(struct i2c_client *client, /* * I2C accesses are unprotected here. - * We have to lock the adapter before releasing the bus. + * We have to lock the I2C segment before releasing the bus. */ - i2c_lock_adapter(adap); + i2c_lock_bus(adap, I2C_LOCK_SEGMENT); pca9541_release_bus(client); - i2c_unlock_adapter(adap); + i2c_unlock_bus(adap, I2C_LOCK_SEGMENT); /* Create mux adapter */