From patchwork Sat Jan 20 15:44:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shreeya Patel X-Patchwork-Id: 10176369 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 647FB6056F for ; Sat, 20 Jan 2018 15:45:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B881287F3 for ; Sat, 20 Jan 2018 15:45:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C3F128817; Sat, 20 Jan 2018 15:45:03 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 C231C287F3 for ; Sat, 20 Jan 2018 15:45:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754301AbeATPo4 (ORCPT ); Sat, 20 Jan 2018 10:44:56 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:45324 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754742AbeATPoz (ORCPT ); Sat, 20 Jan 2018 10:44:55 -0500 Received: by mail-pf0-f194.google.com with SMTP id a88so3675364pfe.12; Sat, 20 Jan 2018 07:44:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=NbmMoMyMBsDtUrajM0MGpVo1jRy9Ky+XwUWx0e/Ovuc=; b=X45kMmpH1bRbhYSaPJqaqLhWXM8rqfbrFR33vHzgzGfnzfOujgdIgjvT5M68Fz6OIW cW29lfzVeE8lChgDUhX7R0RESmVijicmTOuQOWJN2In0KV4MGgLiNW7ONYckJ+XPgE4A 7PrkQyUmmnEgllfcFRtmiVlL1vwI1+U41TjIGQtWQuQtVLUD8/K2EsyTWm++SkxWZjsX 28gQnBBMca3sm4l2GFjz4VULY28A9qAi++K5lqlXXGcZMT+uvNzvLCs2hWxa5cI9waw5 DGta+1Mv9DYO/7GKzLwQ6KIMqzlgoHrp8Kuz89o02LPzLOeDccGzK+ViJAAmia48yjv3 kIbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=NbmMoMyMBsDtUrajM0MGpVo1jRy9Ky+XwUWx0e/Ovuc=; b=qsVK/2xQmsNt38m7Sw4hKic4ysFpAsRF2wUWLF7651IUmVsuTBIjB2PmekkOaMBc5O 3hq8HGx508HLwur3itTolGMUhAQ+zk6D3rEKt4wt2fy4ni+lm/2e7M9s6DyqVfCuStgj h8FJEV98FRVk0lgvFu1HDwcEMdLA898+Rj45+b4qDeDyGbJS5gnYO7NjoH4lwFSglLKZ pqkkbIMilTvBpsUm1u9eBJppbkrH0tLdqGxDsMFbwCsCua8ih+F6WS63G9LnvGroK/a5 rwpR/X1EibKe/Fu3RegLK0wfpNoO/iv6CsLErexRHDvPrK9BUOO5LpuWjUt8gpV1KA3d s5nQ== X-Gm-Message-State: AKwxyteDhG5oPhKqw2nac3mUQstlpyhgCcCHDyDdr0mHixnWyB2gQGl/ uKk63zlQcIWmfb0Bzws4xUc= X-Google-Smtp-Source: AH8x225EW09v9F9OQ9ibL2tFowGKluxvSyFulpVqHehdrofy6LAkVv7joSbb/PnZU0/cYXnYEA0c3A== X-Received: by 10.98.224.205 with SMTP id d74mr2839751pfm.56.1516463094749; Sat, 20 Jan 2018 07:44:54 -0800 (PST) Received: from shreeya-VirtualBox ([103.212.140.141]) by smtp.gmail.com with ESMTPSA id c29sm23476004pfd.172.2018.01.20.07.44.52 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 20 Jan 2018 07:44:53 -0800 (PST) From: Shreeya Patel To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Shreeya Patel Subject: [PATCH] Staging: iio: ade7758: Replace mlock with buf_lock Date: Sat, 20 Jan 2018 21:14:48 +0530 Message-Id: <1516463088-2514-1-git-send-email-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.7.4 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 iio_dev->mlock is to be used only by the IIO core for protecting device mode changes between INDIO_DIRECT and INDIO_BUFFER. This patch replaces the use of mlock with the already established buf_lock mutex. Signed-off-by: Shreeya Patel --- drivers/staging/iio/meter/ade7758_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c index 7b7ffe5..1a866cc 100644 --- a/drivers/staging/iio/meter/ade7758_core.c +++ b/drivers/staging/iio/meter/ade7758_core.c @@ -523,12 +523,13 @@ static int ade7758_read_raw(struct iio_dev *indio_dev, long mask) { int ret; + struct ade7758_state *st = iio_priv(indio_dev); switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->buf_lock); ret = ade7758_read_samp_freq(&indio_dev->dev, val); - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->buf_lock); return ret; default: return -EINVAL; @@ -542,14 +543,15 @@ static int ade7758_write_raw(struct iio_dev *indio_dev, int val, int val2, long mask) { int ret; + struct ade7758_state *st = iio_priv(indio_dev); switch (mask) { case IIO_CHAN_INFO_SAMP_FREQ: if (val2) return -EINVAL; - mutex_lock(&indio_dev->mlock); + mutex_lock(&st->buf_lock); ret = ade7758_write_samp_freq(&indio_dev->dev, val); - mutex_unlock(&indio_dev->mlock); + mutex_unlock(&st->buf_lock); return ret; default: return -EINVAL;