summaryrefslogtreecommitdiff
path: root/drivers/iio/chemical
diff options
context:
space:
mode:
authorMatt Ranostay <mranostay@gmail.com>2016-08-19 23:36:09 +0300
committerJonathan Cameron <jic23@kernel.org>2016-08-21 13:55:30 +0300
commitb015b3e32187225ff1265c4b13f84559fd22ecd7 (patch)
tree8526054756f162ab6640e0e2ceb2b1845b109e47 /drivers/iio/chemical
parent4d671b71beefbfc145b971a11e0c3cabde94b673 (diff)
downloadlinux-b015b3e32187225ff1265c4b13f84559fd22ecd7.tar.xz
iio: chemical: atlas-ph-sensor: switch to iio_device_*_direct_mode helpers
Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/chemical')
-rw-r--r--drivers/iio/chemical/atlas-ph-sensor.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/iio/chemical/atlas-ph-sensor.c b/drivers/iio/chemical/atlas-ph-sensor.c
index ae038a59d256..696875413d10 100644
--- a/drivers/iio/chemical/atlas-ph-sensor.c
+++ b/drivers/iio/chemical/atlas-ph-sensor.c
@@ -402,15 +402,13 @@ static int atlas_read_raw(struct iio_dev *indio_dev,
case IIO_PH:
case IIO_CONCENTRATION:
case IIO_ELECTRICALCONDUCTIVITY:
- mutex_lock(&indio_dev->mlock);
+ ret = iio_device_claim_direct_mode(indio_dev);
+ if (ret)
+ return ret;
- if (iio_buffer_enabled(indio_dev))
- ret = -EBUSY;
- else
- ret = atlas_read_measurement(data,
- chan->address, &reg);
+ ret = atlas_read_measurement(data, chan->address, &reg);
- mutex_unlock(&indio_dev->mlock);
+ iio_device_release_direct_mode(indio_dev);
break;
default:
ret = -EINVAL;