* [PATCH] staging: iio: adis16209: Remove mutex_lock() and mutex_unlock() calls
@ 2017-03-15 17:00 Narcisa Ana Maria Vasile
2017-03-19 11:02 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Narcisa Ana Maria Vasile @ 2017-03-15 17:00 UTC (permalink / raw)
To: lars, Michael.Hennerich, jic23, knaack.h, pmeerw, gregkh
Cc: outreachy-kernel, linux-iio, Narcisa Ana Maria Vasile
The function adis16209_read_raw() is safe to be run in parallel.
The call to adis_read_reg_16() is safe since adis_read_reg() uses the
txrx_lock from struct adis to protect simultaneous changes.
Remove mutex.h inclusion since it is no longer needed.
Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
---
drivers/staging/iio/accel/adis16209.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c
index 8ff537f..f8c1fb0 100644
--- a/drivers/staging/iio/accel/adis16209.c
+++ b/drivers/staging/iio/accel/adis16209.c
@@ -7,7 +7,6 @@
*/
#include <linux/delay.h>
-#include <linux/mutex.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/spi/spi.h>
@@ -252,17 +251,14 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
default:
return -EINVAL;
}
- mutex_lock(&indio_dev->mlock);
addr = adis16209_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;
}
return -EINVAL;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: iio: adis16209: Remove mutex_lock() and mutex_unlock() calls
2017-03-15 17:00 [PATCH] staging: iio: adis16209: Remove mutex_lock() and mutex_unlock() calls Narcisa Ana Maria Vasile
@ 2017-03-19 11:02 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-03-19 11:02 UTC (permalink / raw)
To: Narcisa Ana Maria Vasile, lars, Michael.Hennerich, knaack.h,
pmeerw, gregkh
Cc: outreachy-kernel, linux-iio
On 15/03/17 17:00, Narcisa Ana Maria Vasile wrote:
> The function adis16209_read_raw() is safe to be run in parallel.
> The call to adis_read_reg_16() is safe since adis_read_reg() uses the
> txrx_lock from struct adis to protect simultaneous changes.
>
> Remove mutex.h inclusion since it is no longer needed.
>
> Signed-off-by: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com>
Applied to the togreg branch of iio.git and pushed out as testing. Thanks,
Jonathan
> ---
> drivers/staging/iio/accel/adis16209.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/staging/iio/accel/adis16209.c b/drivers/staging/iio/accel/adis16209.c
> index 8ff537f..f8c1fb0 100644
> --- a/drivers/staging/iio/accel/adis16209.c
> +++ b/drivers/staging/iio/accel/adis16209.c
> @@ -7,7 +7,6 @@
> */
>
> #include <linux/delay.h>
> -#include <linux/mutex.h>
> #include <linux/device.h>
> #include <linux/kernel.h>
> #include <linux/spi/spi.h>
> @@ -252,17 +251,14 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
> default:
> return -EINVAL;
> }
> - mutex_lock(&indio_dev->mlock);
> addr = adis16209_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;
> }
> return -EINVAL;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-19 11:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-15 17:00 [PATCH] staging: iio: adis16209: Remove mutex_lock() and mutex_unlock() calls Narcisa Ana Maria Vasile
2017-03-19 11:02 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.