From patchwork Wed Jun 20 05:18:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10476005 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 E9D9260210 for ; Wed, 20 Jun 2018 05:19:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8A1728D82 for ; Wed, 20 Jun 2018 05:19:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCD2A28DC2; Wed, 20 Jun 2018 05:19: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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 5DD3928D82 for ; Wed, 20 Jun 2018 05:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754183AbeFTFTS (ORCPT ); Wed, 20 Jun 2018 01:19:18 -0400 Received: from mail-he1eur01on0104.outbound.protection.outlook.com ([104.47.0.104]:19840 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932269AbeFTFTD (ORCPT ); Wed, 20 Jun 2018 01:19:03 -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=BX1dAagkdD46misdvh5EQdvq/8pn1MypUM1zV0EW6c4=; b=Kh9AYE7SgX/i8ZK17hXnCq7pP/IIjUCHcDU+YBOkF+kxrjPfUvEs+nJsWl6yIqIWV8V4LMv6k87HNXsvAs0HkCGgNVImClM4ZNlIyoMwK0VhvACxXkltGHX8RAac6K1MiqBHk4blWN8VwlWxxhY9U4+EdaBm7SV9LFvfBNuHAIc= 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:56 +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 09/10] mfd: 88pm860x-i2c: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) Date: Wed, 20 Jun 2018 07:18:02 +0200 Message-Id: <20180620051803.12206-10-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: 7dcba474-87c1-4806-83bd-08d5d66d53a0 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:UwFeoAoBbqHytWX8XTEHFk3xgkIjcgHGOHNZ7lSrTWxwOv6XST5ompfRVnWkJITLAbUxsA6vB1IKO8oPLyjSXJycJ0fyiu+kIBcR98XSjb6V1q8DXV+qlIA6xO+IxSk2tBY3Stn8XHq5vLFWhDKZqMFFrTl6gvIlEeDYV63azZ/ZsBv45d5vaFPTx3134LaJisUaEc54UlJFaWdY1eM1dXaX2vQKWew5f/+DXtyipinRJ6Os1YeIP2uDCHEfAcr1; 25:6J0JJgPUTCRIDVF1UIy8/WXyVxSr5J6QOR3h5HELfvAJNYdWotU+BkY2aWiVmHRlETeVDMSK50mZ1psHTOsY8iV/hdMvsUoCkEn0BOFgHMFZY7VuFKSZra4/8sTwTlKOygIb7xPlhCZCa8mBHJeAdzZgvQ4Cd5qTcHuHjhW3HifQLTNsA1teOq+szNcaUkscNu75nbF8NkZb7L8R6s6CqqsaYOXWahP40mdQ10nyOgrJEzrttrdYhenUi0+MSGKb0FOK6HBFhQ+6TOhOaBCDCMZumhGddhFI/w4yl8pBtxw8NhSC9c6XADCslj5Iv/qheXAtoG1+pH8H9o2IzalmNQ==; 31:Y08s/UfoyjbLY2PMd5BzB9Aa2S1xqc7caZEhwTV1X0ZIkLLGd4lfsIxUHDRDhwt2aF8qWSLw//6/3kYJIDsGBM9HJCUDMB8HW0Hp3NnQHjnICn2QSoogguHmCBxYCgPsZKJ64IGttseRGpoi2LJk5FG2TCIBaCoEi0+wvbKT15OSmzcERj7702bObO3a5e10q5ihzx9/hSdERVJ1PJoPTcrQcywWFV9RSU8a5pumeBc= 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:tvg2bZ4fX+rCQteh/lDIFX7nUhn3TxOy3fNc88MkRggz1FpT+np6SDOrx4h1fcXKDtxqLYT64AMDf966hX9W2QCenDoRTTkIPxyygOiYrFl7ue9r5UqvujCgNdhPOx/zg6KqzjXmuqdDK3x5jSmD6CeGUsmbD3v9YDUjsx83cAAeQ1KCkfIKvWGRLmlz3aPwxT7QQwr6A31e2KAKF8CTB49nfbXQUIHfMH3ne03nPIn2HFd5xEQoA82yM+SezcjFu78PcI409znlqDNu2TA4/g== X-Forefront-PRVS: 070912876F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(1496009)(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:/s4jjCN8ZfYqQASXP+b7wj+qRN7d5WblXBp02wd?= =?us-ascii?Q?+uhRlrPfH9WvuQ9Lk/8cpMLrk8xKGZKERgdsvqihiqw09d+tjH4m71DVGKIU?= =?us-ascii?Q?JZTgZE/FNAMedVE71VphRyX9zdixASieADZI0UmO0QHZxh6n3EUt3EARaIzK?= =?us-ascii?Q?W1vZ6o6GyiVjIaYXCOK51+58VGuPT5IzIn0AwW2ymY5uFFbkW8l7T9uwiVHH?= =?us-ascii?Q?McjJXtwSUi3llvPgRBpVlKsL7dADgErgCJ7xdGlJkwYwWG2poD4W4eQr5ygo?= =?us-ascii?Q?eRFWY1B/bF+amH81BEVC6rk+fVGE8AhC4ATu73xjOve49eXpsefxeDFU9UbX?= =?us-ascii?Q?PjTZXfD1rEF5xswTDVVNJhIk/RptX15cNBNot9amK1lbBHt4RO0QCRS+RPJX?= =?us-ascii?Q?h1oiThR/dPijQkKY1KuePew2fbrmD+WDseyWbM/rNpyuXwpcgH2YSCWsHnoE?= =?us-ascii?Q?E0GPGJHRrqYx2EF4c8B9UjaNpzJfs9T/kwE8KOZtDi6XZdSofyLtFPhXlAhF?= =?us-ascii?Q?2hlzJeFtUfMh9lJdC1v3x4S+00GmwrJBZrc1FtaDwk4WHsFuvP9f630Wukep?= =?us-ascii?Q?BgpGmdXHCc5xAOzAzscGzdypBCRbHpDcuIuiIBG6RjJ9yeumuEiKTtpaYgEr?= =?us-ascii?Q?6Ihg4Yg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MB58PqsFs9BBd+Ex/3iErK2mfc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2452; 7:Zzj0HQe8Vf+CHp3VKV2fInk30VcbURqwqU7k44E5aIz57pD3wA8lJNg31lumaPJARb3i5vXko32gLfLyKMKejlbDtOOXaAi0SoejA0oHlUHnDglQP2m8Hb9ljpTWhutHQoUzaiyovC5nX6eBLJ2Dh8RUdJFqvrGwQvKwnAtmblVnqRKoVf8omiUIN1bbEqg7fPM0CSOYfn5UCkCTik4ACR1VjzIDO/X/8tIX0ft4lTctugeqGvoGxE1SLIdG2zfQ X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2018 05:18:56.4664 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7dcba474-87c1-4806-83bd-08d5d66d53a0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4ee68585-03e1-4785-942a-df9c1871a234 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0201MB2452 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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 Acked-by: Lee Jones --- drivers/mfd/88pm860x-i2c.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c index 84e313107233..7b9052ea7413 100644 --- a/drivers/mfd/88pm860x-i2c.c +++ b/drivers/mfd/88pm860x-i2c.c @@ -146,14 +146,14 @@ int pm860x_page_reg_write(struct i2c_client *i2c, int reg, unsigned char zero; int ret; - i2c_lock_adapter(i2c->adapter); + i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); read_device(i2c, 0xFA, 0, &zero); read_device(i2c, 0xFB, 0, &zero); read_device(i2c, 0xFF, 0, &zero); ret = write_device(i2c, reg, 1, &data); read_device(i2c, 0xFE, 0, &zero); read_device(i2c, 0xFC, 0, &zero); - i2c_unlock_adapter(i2c->adapter); + i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); return ret; } EXPORT_SYMBOL(pm860x_page_reg_write); @@ -164,14 +164,14 @@ int pm860x_page_bulk_read(struct i2c_client *i2c, int reg, unsigned char zero = 0; int ret; - i2c_lock_adapter(i2c->adapter); + i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT); read_device(i2c, 0xfa, 0, &zero); read_device(i2c, 0xfb, 0, &zero); read_device(i2c, 0xff, 0, &zero); ret = read_device(i2c, reg, count, buf); read_device(i2c, 0xFE, 0, &zero); read_device(i2c, 0xFC, 0, &zero); - i2c_unlock_adapter(i2c->adapter); + i2c_unlock_bus(i2c->adapter, I2C_LOCK_SEGMENT); return ret; } EXPORT_SYMBOL(pm860x_page_bulk_read);