diff options
author | Brian Masney <masneyb@onstation.org> | 2016-09-26 20:20:20 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-10-01 14:57:04 +0100 |
commit | 00053566385e3e7a2f81f0fd2fa09bccce1589f2 (patch) | |
tree | 7d33515d97b4103e89a94a1db06dee9c55efa8d6 /drivers | |
parent | 5611cd6fc61dbccdba61656bea9c5c1634b51e46 (diff) | |
download | linux-00053566385e3e7a2f81f0fd2fa09bccce1589f2.tar.bz2 |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/light/isl29018.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 3a4d79d7e23c..51226bd337c5 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -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; } |