lkml.org 
[lkml]   [2016]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/2] iio: humidity: hdc100x: remove lock on heater configuration read
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
\
 
 \ /
  Last update: 2016-07-11 00:01    [W:0.031 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site