From: Alison Schofield <amsfield22@gmail.com>
To: jic23@kernel.org
Cc: mranostay@gmail.com, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] iio: humidity: hdc100x: remove lock on heater configuration read
Date: Sun, 10 Jul 2016 14:31:36 -0700 [thread overview]
Message-ID: <7509a24ed4958084737c2f7413a63c098d289879.1468180067.git.amsfield22@gmail.com> (raw)
In-Reply-To: <cover.1468180067.git.amsfield22@gmail.com>
The lock around the read (from global data) of the heater configuration
status is not needed. Move the lock in IIO_CHAN_INFO_RAW case to only
protect the get measurement function.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
---
drivers/iio/humidity/hdc100x.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/humidity/hdc100x.c b/drivers/iio/humidity/hdc100x.c
index ad5a12a..8195b0c 100644
--- a/drivers/iio/humidity/hdc100x.c
+++ b/drivers/iio/humidity/hdc100x.c
@@ -193,18 +193,18 @@ static int hdc100x_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_RAW: {
int ret;
- mutex_lock(&data->lock);
if (chan->type == IIO_CURRENT) {
*val = hdc100x_get_heater_status(data);
ret = IIO_VAL_INT;
} else {
+ mutex_lock(&data->lock);
ret = hdc100x_get_measurement(data, chan);
+ mutex_unlock(&data->lock);
if (ret >= 0) {
*val = ret;
ret = IIO_VAL_INT;
}
}
- mutex_unlock(&data->lock);
return ret;
}
case IIO_CHAN_INFO_INT_TIME:
--
2.1.4
prev parent reply other threads:[~2016-07-10 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-10 21:29 [PATCH 0/2] iio: humidity: hdc100x: update driver locking Alison Schofield
2016-07-10 21:30 ` [PATCH 1/2] iio: humidity: hdc100x: move lock on config updates to single function Alison Schofield
2016-07-16 5:23 ` Alison Schofield
2016-07-10 21:31 ` Alison Schofield [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7509a24ed4958084737c2f7413a63c098d289879.1468180067.git.amsfield22@gmail.com \
--to=amsfield22@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mranostay@gmail.com \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).