|
@@ -308,6 +308,7 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
|
|
{
|
|
|
struct ms5611_state *st = iio_priv(indio_dev);
|
|
|
const struct ms5611_osr *osr = NULL;
|
|
|
+ int ret;
|
|
|
|
|
|
if (mask != IIO_CHAN_INFO_OVERSAMPLING_RATIO)
|
|
|
return -EINVAL;
|
|
@@ -321,12 +322,11 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
|
|
if (!osr)
|
|
|
return -EINVAL;
|
|
|
|
|
|
- mutex_lock(&st->lock);
|
|
|
+ ret = iio_device_claim_direct_mode(indio_dev);
|
|
|
+ if (ret)
|
|
|
+ return ret;
|
|
|
|
|
|
- if (iio_buffer_enabled(indio_dev)) {
|
|
|
- mutex_unlock(&st->lock);
|
|
|
- return -EBUSY;
|
|
|
- }
|
|
|
+ mutex_lock(&st->lock);
|
|
|
|
|
|
if (chan->type == IIO_TEMP)
|
|
|
st->temp_osr = osr;
|
|
@@ -334,6 +334,8 @@ static int ms5611_write_raw(struct iio_dev *indio_dev,
|
|
|
st->pressure_osr = osr;
|
|
|
|
|
|
mutex_unlock(&st->lock);
|
|
|
+ iio_device_release_direct_mode(indio_dev);
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|