Commit 00053566 authored by Brian Masney's avatar Brian Masney Committed by Jonathan Cameron

staging: iio: isl29018: check if the chip is in a suspended state

Add a check to isl29018_write_raw() to ensure that the chip is not in a
suspended state. This makes the code consistent with what is present
in isl29018_read_raw().
Signed-off-by: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 5611cd6f
......@@ -355,6 +355,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
int ret = -EINVAL;
mutex_lock(&chip->lock);
if (chip->suspended) {
ret = -EBUSY;
goto write_done;
}
switch (mask) {
case IIO_CHAN_INFO_CALIBSCALE:
if (chan->type == IIO_LIGHT) {
......@@ -374,8 +378,9 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
default:
break;
}
mutex_unlock(&chip->lock);
write_done:
mutex_unlock(&chip->lock);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment