Skip to content

Commit 0005356

Browse files
masneybjic23
authored andcommitted
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>
1 parent 5611cd6 commit 0005356

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎drivers/staging/iio/light/isl29018.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,10 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
355355
int ret = -EINVAL;
356356

357357
mutex_lock(&chip->lock);
358+
if (chip->suspended) {
359+
ret = -EBUSY;
360+
goto write_done;
361+
}
358362
switch (mask) {
359363
case IIO_CHAN_INFO_CALIBSCALE:
360364
if (chan->type == IIO_LIGHT) {
@@ -374,8 +378,9 @@ static int isl29018_write_raw(struct iio_dev *indio_dev,
374378
default:
375379
break;
376380
}
377-
mutex_unlock(&chip->lock);
378381

382+
write_done:
383+
mutex_unlock(&chip->lock);
379384
return ret;
380385
}
381386

0 commit comments

Comments
 (0)