linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 5/7] staging:iio:adis16080: Remove unnecessary lock
Date: Wed,  9 Jan 2013 15:01:17 +0100	[thread overview]
Message-ID: <1357740079-12326-5-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1357740079-12326-1-git-send-email-lars@metafoo.de>

All sections in which the transfer buffer is accessed are already protected by
the IIO device's mlock. So we do not need the extra mutex protecting the buffer.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/staging/iio/gyro/adis16080_core.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/iio/gyro/adis16080_core.c b/drivers/staging/iio/gyro/adis16080_core.c
index 6ff9ffc..55ffe39 100644
--- a/drivers/staging/iio/gyro/adis16080_core.c
+++ b/drivers/staging/iio/gyro/adis16080_core.c
@@ -33,11 +33,9 @@
  * struct adis16080_state - device instance specific data
  * @us:			actual spi_device to write data
  * @buf:		transmit or receive buffer
- * @buf_lock:		mutex to protect tx and rx
  **/
 struct adis16080_state {
 	struct spi_device		*us;
-	struct mutex			buf_lock;
 
 	__be16 buf ____cacheline_aligned;
 };
@@ -59,7 +57,6 @@ static int adis16080_read_sample(struct iio_dev *indio_dev,
 		},
 	};
 
-	mutex_lock(&st->buf_lock);
 	st->buf = cpu_to_be16(addr | ADIS16080_DIN_WRITE);
 
 	spi_message_init(&m);
@@ -69,7 +66,6 @@ static int adis16080_read_sample(struct iio_dev *indio_dev,
 	ret = spi_sync(st->us, &m);
 	if (ret == 0)
 		*val = sign_extend32(12, be16_to_cpu(st->buf));
-	mutex_unlock(&st->buf_lock);
 
 	return ret;
 }
@@ -144,7 +140,6 @@ static int adis16080_probe(struct spi_device *spi)
 
 	/* Allocate the comms buffers */
 	st->us = spi;
-	mutex_init(&st->buf_lock);
 
 	indio_dev->name = spi->dev.driver->name;
 	indio_dev->channels = adis16080_channels;
-- 
1.8.0


  parent reply	other threads:[~2013-01-09 14:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-09 14:01 [PATCH 1/7] staging:iio:adis16080: Perform sign extension Lars-Peter Clausen
2013-01-09 14:01 ` [PATCH 2/7] staging:iio:adis16080: Add device id table entry for the adis16100 Lars-Peter Clausen
2013-01-09 21:44   ` Jonathan Cameron
2013-01-09 14:01 ` [PATCH 3/7] staging:iio:adis16080: Cleanup SPI transfer Lars-Peter Clausen
2013-01-09 21:45   ` Jonathan Cameron
2013-01-09 14:01 ` [PATCH 4/7] staging:iio:adis16080: be16 cleanups Lars-Peter Clausen
2013-01-09 21:49   ` Jonathan Cameron
2013-01-09 14:01 ` Lars-Peter Clausen [this message]
2013-01-09 14:01 ` [PATCH 6/7] staging:iio:adis16080: Add scale and offset attributes Lars-Peter Clausen
2013-01-09 14:01 ` [PATCH 7/7] staging:iio:adis16080: Move out of staging Lars-Peter Clausen
2013-01-09 20:09 ` [PATCH 1/7] staging:iio:adis16080: Perform sign extension Jonathan Cameron
2013-01-09 20:34   ` Lars-Peter Clausen
2013-01-09 21:16     ` Jonathan Cameron
2013-01-26 10:32       ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357740079-12326-5-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).