From patchwork Wed Jun 20 05:18:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Rosin X-Patchwork-Id: 10476033 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 E579D60210 for ; Wed, 20 Jun 2018 05:20:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5FF828C88 for ; Wed, 20 Jun 2018 05:20:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA89128DD0; Wed, 20 Jun 2018 05:20:38 +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 5869928C88 for ; Wed, 20 Jun 2018 05:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932436AbeFTFUW (ORCPT ); Wed, 20 Jun 2018 01:20:22 -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 S932154AbeFTFS7 (ORCPT ); Wed, 20 Jun 2018 01:18:59 -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=nVCaTmUVpSu0VohK01KJoBZsRDS5hWscDr1aaUS8BEo=; b=fMvD2pBZ6BihPXY5Y1KHOd8qaiw70v37okHoPtvR2BzePl5mZy4v2sJCFXtjTZXCmUW2O4sj0M75b2nQ5SMIYgFCeEbFz4FgUOUJKOlrFg68RD31eo7Lkrh+L9WJBRKMjxHdMgqlgTyh4uGcS7Qbp2yfTW7sAfZVDRpRcJLXZRs= 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:52 +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 08/10] media: tda18271: switch to i2c_lock_bus(..., I2C_LOCK_SEGMENT) Date: Wed, 20 Jun 2018 07:18:01 +0200 Message-Id: <20180620051803.12206-9-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: 0652a9c4-a8b1-4526-b969-08d5d66d5128 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:NBokvFBBeEjHTtFUFnAHLc/VXj2HKvIPg7ziInUSLNOubP1aiD55H442vhYdj0+PcEwpG3u0hDjozjfnsnrue6KIFvgrxFkcRz60ENiQ5/3UDludl8qE23tGcFm0ymAan8ZBOs3aT5Saq03MCYQ/V+4JGBuPuEG3yhG3RgIIHDBjDjG34WH1J+XjStM3eo/iDEjXdgsLtN1nfXaY8PNPHXohk3ATrs5/vsRdrFoVxt/L5sQ5vYNAaXZn/daSF7fa; 25:49T3zb/Jm3VkVxk76x952hJXEvotWgV6dsFd58P27sDSr/FfiZ1dhgwbV/w50cKjIc6b+KKWyP7tBb9O0wc15NyZ30yiT/BvK6csY3D20AC/kgM0rYtNNqCN0HlLYlDgDqUghpE6G3BKXujM8JMl5XiqxJhfyNk2XJFWPLGscZt5xUYklglvZhOfbRtkef9m8vZ5QAf7kmWUK5NwYe0roJSiEsn051dbCiOZdjFy8KiAv3VgLMdpkKyDRN7hJPKJCJmWROBd6lPn/kwwZRmmaq/kdAd1D3KU0dJjB1MiLYGvdOXPk0crfAnLilL0PAPEssRweGfWn91yfchKWZK2Bw==; 31:szMvBagUHVp0jpRwTV4ZyEmT7aU02jYxLh821k4pQ+wvFEX00WA4VEVBO9djoMK/prt03JmXBZFiDMQFoD/LKWXWGGxiAaatQLGFJreLbILMoxFbfklPbpU738A73qeapMLo88zbArEYz7psppNSFWfp/Y0YEmybwdHF8Oc/hAJV4sClwox26kKbPxn31o0uHVTeiw5nDcFpFJDUkZz/IGeDD2jM6DDUELYXVyt+r+s= 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:iYQG2rmT6UDBy8pqGsufKK6ernxWVtnrlZMU8EqgeEYdrIepWsF1S8DVebHrGg5MVLiVk9n1WtUsRQ1AIy37PwUN3JbC9D1NRo2CXqVBmhR9TySHoirvy6b0WcY/6lhozpvJDSQW+FxIDD4w0mm+D0RLjz3HznjJdZzVwHk9BAHBerkSDoBXbviFqnIStSB72oKAINlOhx/rhWwAXY/BUBrt9Ncygjr7sD5OatOVn0Lp2JcS47tf7Bj2Btb5M7tB+uNT120Rhmfm6nZNypPWIQ== X-Forefront-PRVS: 070912876F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(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)(969003)(989001)(999001)(1009001)(1019001); 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:0AdpY6RyuVBvyXLpJin2nURgfNBa5cyqiDhV+jv?= =?us-ascii?Q?yWPozx1Gnqb/hSPFZdKuthAl2G9hgwT2zYxil6gewrHhtwgpzSMp1P/tp0eY?= =?us-ascii?Q?N1rZKHMoUKjdf2JfRTH3w33bOoXVrBGwqV0nV6QQmXJSuzWb+BJ6JvYgWh12?= =?us-ascii?Q?+/NOn3ffKg1qeFxQUsuHKnZ5EyAJ3ZMIGe2Ajd8SHQkW9SKFd/DJXpIu8OCP?= =?us-ascii?Q?oEHRFHuF5La7xAY0zaj+cvSpnffUdJaJBOIAsdCDdKC7Tf1bf3rarKYm8Is0?= =?us-ascii?Q?Hv+xGZtm6oTUX4yzgyLU1FjR4DDlV3nuMQNz7WQqzmY/X368lkxMGsWXejgq?= =?us-ascii?Q?Oay0YMoWO97JD6U3ZlfYUv5PJYNd2hakPsYJmMJtKUpUX33iYMIdSKDkBdKF?= =?us-ascii?Q?66Ug6cL6eFZJlGn5NbP9N2ltmdehW2FsZBiyHcjCwTJYBfGsD3zjzKj9VAQF?= =?us-ascii?Q?6OxfE7OKrqK2Dbmxh4xqFLtBzMJo6Iu7UrP1XZDrWECT+NKnKbyqDzt14nR8?= =?us-ascii?Q?c0zeOtw0c6UqhDKwBlOqnvXAOPygdf2fyh1KQgtmp83Z+wESABE3nkLCbShb?= =?us-ascii?Q?u5Gx66l63lLzd9Jbt652DNDtQUZoqgjsCUxjPEzXknsc9Kd7GZB1nWhH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pWL95TotECLK5vJ8U6KfUvxpOT7RSPUazq3jnqs4EYksmG2gLXtn2oq15TqDUU=; 24:sVARYiukGqxwAq4u1tNt0H06PK5vSYsaIsEdME6nvPjOah23hsN/3M0FTiimqJL891rGtizjreo+EXACL1DuZHnvBi6MkFcKxdbgUWM7LHQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0201MB2452; 7:MJNm7HSEH47+JuZOmR3HWpdgONtSrliG/4pZNOvbZQpSiC+YRO062v+0gtIJ4QKPuQvSHSGRVs4L9lejOczoSTZ97rwZCJOIjNu6Pt2uCTNKepl8hxmz64CQO1vGm3YPbfOows9mwZpY5n3xaV8ZYerR7tDdDGO3c+S0QbzC1eDXGbrmyYpAo5+02/tvcY+2oDegL7bFI5ReRuNk3D/3H6ecsY0xTO05TR1HmEKrmSFQZcZQGC29dAeTsqloHjmr X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2018 05:18:52.3259 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0652a9c4-a8b1-4526-b969-08d5d66d5128 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 --- drivers/media/tuners/tda18271-common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/tuners/tda18271-common.c b/drivers/media/tuners/tda18271-common.c index 7e81cd887c13..054b3b747dae 100644 --- a/drivers/media/tuners/tda18271-common.c +++ b/drivers/media/tuners/tda18271-common.c @@ -225,7 +225,7 @@ static int __tda18271_write_regs(struct dvb_frontend *fe, int idx, int len, */ if (lock_i2c) { tda18271_i2c_gate_ctrl(fe, 1); - i2c_lock_adapter(priv->i2c_props.adap); + i2c_lock_bus(priv->i2c_props.adap, I2C_LOCK_SEGMENT); } while (len) { if (max > len) @@ -246,7 +246,7 @@ static int __tda18271_write_regs(struct dvb_frontend *fe, int idx, int len, len -= max; } if (lock_i2c) { - i2c_unlock_adapter(priv->i2c_props.adap); + i2c_unlock_bus(priv->i2c_props.adap, I2C_LOCK_SEGMENT); tda18271_i2c_gate_ctrl(fe, 0); } @@ -300,7 +300,7 @@ int tda18271_init_regs(struct dvb_frontend *fe) * as those could cause bad things */ tda18271_i2c_gate_ctrl(fe, 1); - i2c_lock_adapter(priv->i2c_props.adap); + i2c_lock_bus(priv->i2c_props.adap, I2C_LOCK_SEGMENT); /* initialize registers */ switch (priv->id) { @@ -516,7 +516,7 @@ int tda18271_init_regs(struct dvb_frontend *fe) /* synchronize */ __tda18271_write_regs(fe, R_EP1, 1, false); - i2c_unlock_adapter(priv->i2c_props.adap); + i2c_unlock_bus(priv->i2c_props.adap, I2C_LOCK_SEGMENT); tda18271_i2c_gate_ctrl(fe, 0); return 0;