diff options
author | Varsha Rao <rvarsha016@gmail.com> | 2017-03-14 21:53:18 +0530 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-03-18 14:19:43 +0000 |
commit | 2e2c8d227ac9bc31a7df7401a6508dd73c25a2b6 (patch) | |
tree | 6a17746916c360384daf2de93d71f1a9b8e8b68b /drivers | |
parent | 01d2de39cd765461562ff6cc69dfc419d9fc63b6 (diff) | |
download | linux-2e2c8d227ac9bc31a7df7401a6508dd73c25a2b6.tar.bz2 |
staging: iio: adis16240: Remove mutex_lock() and mutex_unlock() function call.
Remove mutex_lock() and mutex_unlock() function calls, as the
adis16240_spi_read_signed() function can be run parallel and safely
multiple times. Also remove the mutex.h header file and comment, which
are no longer required.
As indio_dev is declared and initialized in adis16240_spi_read_signed(),
again declaration to same type and initialization to same value is not
required, remove it from adis16240_read_12bit_signed().
Simplify the return logic, by merging assignment and return into a single
line.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/accel/adis16240.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/drivers/staging/iio/accel/adis16240.c b/drivers/staging/iio/accel/adis16240.c index b0f449dda88b..6e3c95c9c3f6 100644 --- a/drivers/staging/iio/accel/adis16240.c +++ b/drivers/staging/iio/accel/adis16240.c @@ -10,7 +10,6 @@ #include <linux/irq.h> #include <linux/gpio.h> #include <linux/delay.h> -#include <linux/mutex.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/spi/spi.h> @@ -229,15 +228,7 @@ static ssize_t adis16240_read_12bit_signed(struct device *dev, struct device_attribute *attr, char *buf) { - ssize_t ret; - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - - /* Take the iio_dev status lock */ - mutex_lock(&indio_dev->mlock); - ret = adis16240_spi_read_signed(dev, attr, buf, 12); - mutex_unlock(&indio_dev->mlock); - - return ret; + return adis16240_spi_read_signed(dev, attr, buf, 12); } static IIO_DEVICE_ATTR(in_accel_xyz_squared_peak_raw, 0444, @@ -297,31 +288,25 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBBIAS: bits = 10; - mutex_lock(&indio_dev->mlock); addr = adis16240_addresses[chan->scan_index][0]; ret = adis_read_reg_16(st, addr, &val16); if (ret) { - mutex_unlock(&indio_dev->mlock); return ret; } val16 &= (1 << bits) - 1; val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); *val = val16; - mutex_unlock(&indio_dev->mlock); return IIO_VAL_INT; case IIO_CHAN_INFO_PEAK: bits = 10; - mutex_lock(&indio_dev->mlock); addr = adis16240_addresses[chan->scan_index][1]; ret = adis_read_reg_16(st, addr, &val16); if (ret) { - mutex_unlock(&indio_dev->mlock); return ret; } val16 &= (1 << bits) - 1; val16 = (s16)(val16 << (16 - bits)) >> (16 - bits); *val = val16; - mutex_unlock(&indio_dev->mlock); return IIO_VAL_INT; } return -EINVAL; |