mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-27 01:11:31 +00:00
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: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
5611cd6fc6
commit
0005356638
1 changed files with 6 additions and 1 deletions
|
|
@ -355,6 +355,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
|
||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
mutex_lock(&chip->lock);
|
mutex_lock(&chip->lock);
|
||||||
|
if (chip->suspended) {
|
||||||
|
ret = -EBUSY;
|
||||||
|
goto write_done;
|
||||||
|
}
|
||||||
switch (mask) {
|
switch (mask) {
|
||||||
case IIO_CHAN_INFO_CALIBSCALE:
|
case IIO_CHAN_INFO_CALIBSCALE:
|
||||||
if (chan->type == IIO_LIGHT) {
|
if (chan->type == IIO_LIGHT) {
|
||||||
|
|
@ -374,8 +378,9 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mutex_unlock(&chip->lock);
|
|
||||||
|
|
||||||
|
write_done:
|
||||||
|
mutex_unlock(&chip->lock);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue