diff options
author | Alison Schofield <amsfield22@gmail.com> | 2016-07-25 22:11:20 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-08-15 19:12:43 +0300 |
commit | b75b58b46b7cfd9c8e715bb3eada9e3892d217e2 (patch) | |
tree | 7fcab9983a179308368b61f4dcd3272fa1eb6fea /drivers/iio/accel | |
parent | ca1902ff98bcd9fe655028b19573e436fe9d3c76 (diff) | |
download | linux-b75b58b46b7cfd9c8e715bb3eada9e3892d217e2.tar.xz |
iio: accel: bma180: use iio helper function to guarantee direct mode
Replace the code that guarantees the device stays in direct mode
with iio_device_claim_direct_mode() which does same.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r-- | drivers/iio/accel/bma180.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index e3f88ba5faf3..0890934ef66f 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -469,13 +469,14 @@ static int bma180_read_raw(struct iio_dev *indio_dev, switch (mask) { case IIO_CHAN_INFO_RAW: + ret = iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + mutex_lock(&data->mutex); - if (iio_buffer_enabled(indio_dev)) { - mutex_unlock(&data->mutex); - return -EBUSY; - } ret = bma180_get_data_reg(data, chan->scan_index); mutex_unlock(&data->mutex); + iio_device_release_direct_mode(indio_dev); if (ret < 0) return ret; *val = sign_extend32(ret >> chan->scan_type.shift, |