From patchwork Mon Jun 25 08:01:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 10485223 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 24CEF60230 for ; Mon, 25 Jun 2018 08:01:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1B0BF2892B for ; Mon, 25 Jun 2018 08:01:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F7C82895A; Mon, 25 Jun 2018 08:01:35 +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 6B8BB2892C for ; Mon, 25 Jun 2018 08:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752230AbeFYIBd (ORCPT ); Mon, 25 Jun 2018 04:01:33 -0400 Received: from mail-eopbgr710051.outbound.protection.outlook.com ([40.107.71.51]:34266 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752094AbeFYIBd (ORCPT ); Mon, 25 Jun 2018 04:01:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.onmicrosoft.com; s=selector1-analog-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9dcnJM4A2tuUfD+tl3mWA235DBosF3HwSjEG5B3R0+4=; b=genJiDKVCgtIyO3SVyo+Tfzv9gLetD6PebFvEecE0sxIvacfBxZGAZqiT60ocZs5BKLv+rAIzOE7akEckVRmSPqRLN/NwNHhXcYD/Pha9WfV0YyuoD38xjTtSOzEDplYsoK/oNpooWa+gGDdM44Ux44GGQhdGfGplT/szDD4WOA= Received: from DM5PR03CA0058.namprd03.prod.outlook.com (2603:10b6:4:3b::47) by DM5PR03MB3131.namprd03.prod.outlook.com (2603:10b6:4:3c::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.24; Mon, 25 Jun 2018 08:01:31 +0000 Received: from BL2FFO11FD025.protection.gbl (2a01:111:f400:7c09::110) by DM5PR03CA0058.outlook.office365.com (2603:10b6:4:3b::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.884.21 via Frontend Transport; Mon, 25 Jun 2018 08:01:30 +0000 Authentication-Results: spf=pass (sender IP is 137.71.25.57) smtp.mailfrom=analog.com; kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=bestguesspass action=none header.from=analog.com; Received-SPF: Pass (protection.outlook.com: domain of analog.com designates 137.71.25.57 as permitted sender) receiver=protection.outlook.com; client-ip=137.71.25.57; helo=nwd2mta4.analog.com; Received: from nwd2mta4.analog.com (137.71.25.57) by BL2FFO11FD025.mail.protection.outlook.com (10.173.161.104) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.820.5 via Frontend Transport; Mon, 25 Jun 2018 08:01:30 +0000 Received: from NWD2HUBCAS8.ad.analog.com (nwd2hubcas8.ad.analog.com [10.64.69.108]) by nwd2mta4.analog.com (8.13.8/8.13.8) with ESMTP id w5P81Uej002135 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Mon, 25 Jun 2018 01:01:30 -0700 Received: from zeus.spd.analog.com (10.64.82.11) by NWD2HUBCAS8.ad.analog.com (10.64.69.108) with Microsoft SMTP Server id 14.3.301.0; Mon, 25 Jun 2018 04:01:29 -0400 Received: from saturn.analog.com ([10.50.1.244]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id w5P81Svb007547; Mon, 25 Jun 2018 04:01:28 -0400 From: Alexandru Ardelean To: , , , CC: Alexandru Ardelean Subject: [PATCH V2] iio: ad9523: replace core mlock with local lock Date: Mon, 25 Jun 2018 11:01:17 +0300 Message-ID: <20180625080117.13599-1-alexandru.ardelean@analog.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-ADIRoutedOnPrem: True X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:137.71.25.57; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(376002)(346002)(2980300002)(438002)(189003)(199004)(51416003)(186003)(36756003)(2201001)(476003)(1076002)(86362001)(2906002)(305945005)(26005)(50226002)(336012)(47776003)(426003)(16586007)(59450400001)(77096007)(2616005)(44832011)(8936002)(110136005)(316002)(478600001)(246002)(7636002)(8676002)(7696005)(356003)(107886003)(5660300001)(106002)(486006)(50466002)(106466001)(48376002)(126002)(53416004)(4326008)(6666003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB3131; H:nwd2mta4.analog.com; FPR:; SPF:Pass; LANG:en; PTR:nwd2mail11.analog.com; MX:1; A:1; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD025; 1:/RwBKezKcdxQJ3wmlBR8ineUiUJyoLJRiMj7iI5UVlaZdCYG6/pBkI9zXxp5e+7v+donPmp8ynVz1YE887em95qis9QSmNs0LlIuGEhlgy/cJyr+VDE6bkc8s85y5RX0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1a88106-3ee0-435c-a159-08d5da71dc49 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(4608076)(2017052603328)(7153060); SRVR:DM5PR03MB3131; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3131; 3:mIuC3ki4kDZcVtobGDk1Vo/EH/aBPiBjhQzcyiQtaDbc37jQQOHcmsvFO4UPqKKo0ifEdwNfCz5iPQ9bjuPIB8A7jjnMxfDqlNZRPB0rb3uq7oEzzOnbYUiGTI7r1dVkAMTbAk75wluJd4pjwIicpLwLng8qGOupIKzHwWSkaD8yVOngzBpokAJvd6qnj5RghYQ8CPaYo7rvdbkfkqXH5NkGlCwFnN0lWOHHf5SCtzcdyx+HzO/lQei6ZKvJP6BWEXPyEtIpA1BP2LVjtZRlGVJCVfPzoBLGNqCthUnjbEFa69ssfonvZZWqqU4pSz0IwpfLx6ZZYM27VczEHM3sZQUyU4L9guI0HtPcJSS0BNI=; 25:jXEY1Y78UtGfq/TfPHkITtJItJ6U6NDkfUadFx2w6n/gkSBiMgc8iqSMpyqtFie3RHGqTUXdVOnLReteEXL9jI+BzYBvGottgOKXm0UmcYHH19PWh+g/E0rutvrCFALVkjjuLzd1cN3WEh+M0Jk6OeOwpDg2tGPGCLdcbORS1BijgW/qQs0BARU4Fm8OHyV/z0uOOdONPGkK5ZAu8cApbMixxrmtW+DdxcUGqZ6WcrneIS98RAfp76OoHVSB2lOnRE9FLT2hIoS3fiCEj9NJxBeURsugLYViB9GM6xumg0v5Rsdyc4o/Z4qUBp8Gp9RgUsrOE8I9MFYefkSjt7QeVw== X-MS-TrafficTypeDiagnostic: DM5PR03MB3131: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3131; 31:3Lo0zkpN8+xY7gaTacSYJqFE6DGWmeD1QktvVzQ+793WuZvKBzr800mLE5armsJGSu8Wl1DZoM8Zk7RGxRkkL9uzS9p2c4utnY3+V6FHtvWC/mgrIzZ6yPA9yxRwMF6TqfFYnl0HnCxI12SjBXTdZoEyDYlFjf6IfnRVBqkyOo+03BuvJ1e/wJlRaKrDVqtdnkYajEZOmjSY4kPxcOJvFgexcRdCfv4vjsvcLz5KpUQ=; 20:y/wmkcMrjWUjDsASMR4gt3F528Y1SX/MeWuon4jUW4FeTzOpENjvqWZg5YQ7WEGmP1w1ZqD19PE4M1ZNYrFlDfYO5V0kUtM/t5uVMjSOvtf2l0SyafYfTKgfcdyKyZTeGuDxL8RNAPslyNGCLfEeOyCqPaj/Cttz9mrPzV3sM8lFrPjamhPVTZoLSN/ETlsytrvzlY2JOuxJGEiiZHHBouQOu0dqOhiGn6iJE8C5F0CNY0IR0jP/38Ou6vrFbQFBPESj7zrLI1cczs1vd29zZn4N/WqGFrVx5Whd/1kBT0ILQtfpV3xE3k91YmonDhtlg9v75KgM8K3cOrL4rJrVyJO4oKBc8/dCylRLpsA8KUJVsvHNkVgLrSvzTbxpyIeeorijUYM/e7RG6GcZcAnbeHi6roKNkOqz+Xh9d03s93/HoMyvNhYzZR7ssAwoX3Xf+9/3JYm2vgFxsbaqstTUn5ELfbRa5j15ACLT6nBhgX2HVQ+DReEcKVpq+8mvZupH X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(232431446821674)(788757137089); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93004095)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DM5PR03MB3131; BCL:0; PCL:0; RULEID:; SRVR:DM5PR03MB3131; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3131; 4:sZZn4oh6rsxG5ozevI8I5N4bpThGku/Wn1kGuu7o27XXxav9lGgRNqpSy3esQd7D56QUayq616hqQVCSKbK/tApvMQKNLztFKJ2znVhQrcV3tSQqRBh+wmYZyxS3AHT1cl3zAS40Gd+IYoiwN+mJb4e0W2GvrcuFbz9VkkYgXrkV349mSXbTMFci/BZS2AC75u+7Ste+BPq04vll1Uwc5eNkvQD9pxy1Bk+aM8l2u1lmKb38plT6ES0jwOx3neOGHJIkGcqTicYuKdxxMj5MZnHjD9xEgqy1ec16eXgI01NFMEkIRPcbq+R0VacPVBl/4/0ZrEIJYXuauJY9M2obdg== X-Forefront-PRVS: 0714841678 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB3131; 23:UQChLec1ulm41whEWg6OvUdVBwIoTz0PLGekovlSg?= =?us-ascii?Q?xZU90UJ+stHNsDgFEgd1WtNzMlvtJ5SlDyBRxtcvcPWS9uXHKI2FncZlxXwh?= =?us-ascii?Q?UtPnHNXzgy+H5VFRF8J2iNPuF9uEJbJtPY28FBLxhGsD+6F+yacwkcakTcRr?= =?us-ascii?Q?0ncL9phrp3tSrJwLOhOjd1TzbfexTMAkcIxSeJzeG8V/QmdN/S7mBk/IV8Fq?= =?us-ascii?Q?yRb5cSF6T3Nt0HeG8xc07KmwbcRjL1NGrLQzJJlZ5eObyfQhZ0kmkS4pLPZb?= =?us-ascii?Q?iwZsbJyzveGZY+Rqrw2BthXH27PN8PfigJKjrOx0+RkI7Ziy+5DY2Pobtb8g?= =?us-ascii?Q?oju5tFiXlMGrXVSk8HrJjN6PiiR4tS7tVSyzXgJjpRceoSOsLOtt05SR7oLs?= =?us-ascii?Q?GsQI/R3CmvollhTuHEWxcC0lsFpi7T3Ci5WymBmRr+rU7ZG0zMai02fIeRPW?= =?us-ascii?Q?2n8SOtEIhMA8hdDeFrCN6mCyQDrAB7XoT7T66hrvCzOiHXS0e3p/XbZyg3L8?= =?us-ascii?Q?5DFm/bK7tYLc6J5I3UhHtZM4HdnP04fhbcPdqu/l6AqXvxT5fYu9YRRcYoDe?= =?us-ascii?Q?z7QnnVJwsYzva4ok698XKr/QDRfgAjTobD+y6S2DkdV7O8FVGPM3Aee1VeIB?= =?us-ascii?Q?xK9CjQ3V1y/G1oG5Wee4akUedfchLpWqjSS4MDxiNdLM7WiRNT3KnQU970wq?= =?us-ascii?Q?2ldOpkX4wTW37VpveGiAqaj6xqLxN/GFutlRFI2WrHnEFqYVZ2VixklOYTpI?= =?us-ascii?Q?JJehToWGVuTj1LduIcX3ljffF7FGZG1P3mTQ4MZxtZ1GP05lKRlOUgJtfVXi?= =?us-ascii?Q?XYlxTMCmmfI9qYa45wXt6+TgVtPVSsaL3yHFVlSg6U6FLuWCh+XTxPsWqV2I?= =?us-ascii?Q?UoG6CJqo953TM2jfZCCQm+yS0qZzVqXHhsSDxnobP+ozyAtgsZUX/9BceJQH?= =?us-ascii?Q?SOiQC67COHlBZKYlVnva209tIYgYPU7kF8TExIRpPL/UNeyq2GfYKdeKPTBM?= =?us-ascii?Q?qz9tusSm6pfgoP8z5aRA5igpip4clsNw7TKM8aYcaIa6l0Uf+Q641Y+s68mi?= =?us-ascii?Q?dw4LGbu2hvP9jAQwbTgkPLwdhLP2mpbDmwtcM0UNLBeOfpSAQ=3D=3D?= X-Microsoft-Antispam-Message-Info: /E87+0KCS1uMTfY9P9AMCmCdsuewv+zIWEQ6OeA/W6Xku2B+8ZMKhznbjo459R7h8CUdsXnQtJWqLVNiQmgqSuXahUwyur4qL9+J/N4FnuVYnydN/evZp+RxvQyxaMuTpFPzN3vC2sE2NQw3IYJW6MJiiPfJtprgnbDHmQ2cK5CGnjbOvTXQjw2nt4cOnaxsKT6AUVbcu3cnCz2jbFPEAH6lc42rWVjopj+YnEMk56vU+XK+oeexrtVloYyaahf3LsdUcLXT+E6TCGGS6Nj/Ru50y3ha/7uWhxv6P24eiI7arnpfeafiFD8qxOQjpSEDFWvC2cYdi41rbn4wxYm3ARSQfPwhDqE0+1KU++niu8w= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3131; 6:CuEihPoQFhw3CX11hXGFG7FqySbTey9BGbD55KnwHw+tNtzulLAZkr4oz0njlvzakpnHW8g2i0UDRgk/LYvZRlHEsj25RngELFe3qGXvFihEMc5/3pxxFLRE6Z0N9HVelQ3BOTL0F3ofQcv0H2KMuXpVqVDnjQZz2f2hUZ+HrXOItKClfuRBc+++M/95plE5S+oAgPsyU8GTofa9qbsGA01PJhzrALRvbxCr4S70NQN0r7sDPCq6KJBu5UhlbKOFLPzaJGbnXZWfaLhvc4EA2k74sUdT1JTQGUkdCNh5dOokfBAgCM9QLRFBYSSc20NeZbtLzcy57QRTA/QXW6zfG2kwkRiJLlO0TXGpGtHTXF07UVxkO0peRYgidASr3YAT/FqpNrgaU3XI6+VwCP0MRpUr/QdctFkQlf/WAgGcn3rMwd84rT2CdVlYCf2jWZwUO3l5e984A/COWuOPolFszg==; 5:PJ1DpPeyKE6mtzFtrKgJKIUAaLQLxdGx4Czcg2O7T+nJ1aDOQBU+CWqc08TV6PoO35oRctt5gN8+658OvMSSZ7+hMTCwC+8ckcUS+q5/0LfvdEKkyaJt2TlDx8ZkrjeIH5Dk0ZHRksjO8Cj06Rr1q5FNA9ACNcg5NaoKSNbztws=; 24:gTSHXBFCCURGgoDFtf8UewJieDBwX9Ysyuf+9ysJK/FhRz0nKJ3khApjaaeLsenzX0T1xFGtjCkkG09idNDTiAvrskJxiHpHXbzJFipDao4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB3131; 7:a6clUyWAZtFao3pulEt7yLirz3i1ETY9LedxWL26bjG8xD6TfMcl0FShIuAzXzQsi6nyzKJKOeeY9hVHRpTWdh7oiPWlXJez0WcnjZped2uWxoWeDsTeHmU67G+HLZIyyvYavkyLOCs4pq6mJbO4EBCtJ6T8W5gVCJWU5zkbQxfdM4etDDbDv5lhzrvfXiCmoOUXS4jWH4NPi888aFpCeymRchv6sIydX983jdWJ2UFOM51wy+pk9I3rHGYw2f5A X-OriginatorOrg: analog.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 08:01:30.3829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c1a88106-3ee0-435c-a159-08d5da71dc49 X-MS-Exchange-CrossTenant-Id: eaa689b4-8f87-40e0-9c6f-7228de4d754a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=eaa689b4-8f87-40e0-9c6f-7228de4d754a; Ip=[137.71.25.57]; Helo=[nwd2mta4.analog.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB3131 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lars-Peter Clausen This is part of a long term effort to make the use of mlock opaque and single purpose. Signed-off-by: Lars-Peter Clausen Signed-off-by: Alexandru Ardelean --- v1 -> v2: * added Signed-off-by: Alexandru Ardelean drivers/iio/frequency/ad9523.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c index ddb6a334ae68..1b70e8a13338 100644 --- a/drivers/iio/frequency/ad9523.c +++ b/drivers/iio/frequency/ad9523.c @@ -274,6 +274,8 @@ struct ad9523_state { unsigned long vco_out_freq[AD9523_NUM_CLK_SRC]; unsigned char vco_out_map[AD9523_NUM_CHAN_ALT_CLK_SRC]; + struct mutex lock; + /* * DMA (thus cache coherency maintenance) requires the * transfer buffers to live in their own cache lines. @@ -500,6 +502,7 @@ static ssize_t ad9523_store(struct device *dev, { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); + struct ad9523_state *st = iio_priv(indio_dev); bool state; int ret; @@ -510,7 +513,7 @@ static ssize_t ad9523_store(struct device *dev, if (!state) return 0; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); switch ((u32)this_attr->address) { case AD9523_SYNC: ret = ad9523_sync(indio_dev); @@ -521,7 +524,7 @@ static ssize_t ad9523_store(struct device *dev, default: ret = -ENODEV; } - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); return ret ? ret : len; } @@ -532,15 +535,16 @@ static ssize_t ad9523_show(struct device *dev, { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); + struct ad9523_state *st = iio_priv(indio_dev); int ret; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); ret = ad9523_read(indio_dev, AD9523_READBACK_0); if (ret >= 0) { ret = sprintf(buf, "%d\n", !!(ret & (1 << (u32)this_attr->address))); } - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); return ret; } @@ -623,9 +627,9 @@ static int ad9523_read_raw(struct iio_dev *indio_dev, unsigned int code; int ret; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); if (ret < 0) return ret; @@ -659,7 +663,7 @@ static int ad9523_write_raw(struct iio_dev *indio_dev, unsigned int reg; int ret, tmp, code; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); ret = ad9523_read(indio_dev, AD9523_CHANNEL_CLOCK_DIST(chan->channel)); if (ret < 0) goto out; @@ -705,7 +709,7 @@ static int ad9523_write_raw(struct iio_dev *indio_dev, ad9523_io_update(indio_dev); out: - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); return ret; } @@ -713,9 +717,10 @@ static int ad9523_reg_access(struct iio_dev *indio_dev, unsigned int reg, unsigned int writeval, unsigned int *readval) { + struct ad9523_state *st = iio_priv(indio_dev); int ret; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->lock); if (readval == NULL) { ret = ad9523_write(indio_dev, reg | AD9523_R1B, writeval); ad9523_io_update(indio_dev); @@ -728,7 +733,7 @@ static int ad9523_reg_access(struct iio_dev *indio_dev, } out_unlock: - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->lock); return ret; } @@ -967,6 +972,8 @@ static int ad9523_probe(struct spi_device *spi) st = iio_priv(indio_dev); + mutex_init(&st->lock); + st->reg = devm_regulator_get(&spi->dev, "vcc"); if (!IS_ERR(st->reg)) { ret = regulator_enable(st->reg);