From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
Michael Hennerich <michael.hennerich@analog.com>,
linux-iio@vger.kernel.org,
device-drivers-devel@blackfin.uclinux.org, drivers@analog.com
Subject: Re: [PATCH v2 6/6] staging:iio:events: Use non-atmoic bitops
Date: Sun, 29 Jan 2012 10:49:58 +0000 [thread overview]
Message-ID: <4F252456.4040700@kernel.org> (raw)
In-Reply-To: <4EEFA5C2.70604@kernel.org>
On 12/19/2011 08:59 PM, Jonathan Cameron wrote:
> On 12/19/2011 10:29 AM, Lars-Peter Clausen wrote:
>> We always hold the waitqueue lock when modifying the flags field. So it is safe
>> to use the non-atomic bitops here instead of the atomic versions.
>>
>> The lock has to be held, because we need to clear the busy flag and flush the
>> event fifo in one atomic operation when closing the event file descriptor.
> Good spot. Glad to be rid of these. Thanks for doing this series, all
> excellent tidying up and general reworking!
Have these gone to Greg? Sorry, have lost track.
If not, atmoic -> atomic in the patch title!
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Acked-by: Jonathan Cameron <jic23@kernel.org>
>> ---
>> drivers/staging/iio/industrialio-event.c | 6 +++---
>> 1 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/staging/iio/industrialio-event.c b/drivers/staging/iio/industrialio-event.c
>> index 58243d9..5e461e1 100644
>> --- a/drivers/staging/iio/industrialio-event.c
>> +++ b/drivers/staging/iio/industrialio-event.c
>> @@ -124,7 +124,7 @@ static int iio_event_chrdev_release(struct inode *inode, struct file *filep)
>> struct iio_event_interface *ev_int = filep->private_data;
>>
>> spin_lock(&ev_int->wait.lock);
>> - clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
>> + __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
>> /*
>> * In order to maintain a clean state for reopening,
>> * clear out any awaiting events. The mask will prevent
>> @@ -153,7 +153,7 @@ int iio_event_getfd(struct iio_dev *indio_dev)
>> return -ENODEV;
>>
>> spin_lock(&ev_int->wait.lock);
>> - if (test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
>> + if (__test_and_set_bit(IIO_BUSY_BIT_POS, &ev_int->flags)) {
>> spin_unlock(&ev_int->wait.lock);
>> return -EBUSY;
>> }
>> @@ -162,7 +162,7 @@ int iio_event_getfd(struct iio_dev *indio_dev)
>> &iio_event_chrdev_fileops, ev_int, O_RDONLY);
>> if (fd < 0) {
>> spin_lock(&ev_int->wait.lock);
>> - clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
>> + __clear_bit(IIO_BUSY_BIT_POS, &ev_int->flags);
>> spin_unlock(&ev_int->wait.lock);
>> }
>> return fd;
>
next prev parent reply other threads:[~2012-01-29 10:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-19 10:29 [PATCH v2 1/6] staging:iio: Update iio_event_interface documentation Lars-Peter Clausen
2011-12-19 10:29 ` [PATCH v2 6/6] staging:iio:events: Use non-atmoic bitops Lars-Peter Clausen
2011-12-19 20:59 ` Jonathan Cameron
2012-01-29 10:49 ` Jonathan Cameron [this message]
2011-12-19 20:55 ` [PATCH v2 1/6] staging:iio: Update iio_event_interface documentation Jonathan Cameron
2011-12-19 21:28 ` Lars-Peter Clausen
[not found] ` <1324290580-17511-2-git-send-email-lars@metafoo.de>
2011-12-19 20:56 ` [PATCH v2 2/6] staging:iio: Factor out event handling into its own file Jonathan Cameron
[not found] ` <1324290580-17511-3-git-send-email-lars@metafoo.de>
2011-12-19 20:56 ` [PATCH v2 3/6] staging:iio:events: Use kfifo for event queue Jonathan Cameron
[not found] ` <1324290580-17511-4-git-send-email-lars@metafoo.de>
2011-12-19 20:57 ` [PATCH v2 4/6] staging:iio:events: Use waitqueue lock to protect " Jonathan Cameron
2011-12-19 21:28 ` Lars-Peter Clausen
2012-01-29 18:18 ` Jonathan Cameron
2012-01-31 17:26 ` Lars-Peter Clausen
2012-01-31 20:58 ` 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=4F252456.4040700@kernel.org \
--to=jic23@kernel.org \
--cc=device-drivers-devel@blackfin.uclinux.org \
--cc=drivers@analog.com \
--cc=jic23@cam.ac.uk \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=michael.hennerich@analog.com \
/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).