Skip to content

Commit

Permalink
staging: iio: isl29018: check if the chip is in a suspended state
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Masney authored and Jonathan Cameron committed Oct 1, 2016
1 parent 5611cd6 commit 0005356
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/staging/iio/light/isl29018.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand Down

0 comments on commit 0005356

Please sign in to comment.