From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH v2 5/5] iio:buffer: Ignore noop requests for iio_update_buffers()
Date: Sat, 12 Oct 2013 12:19:08 +0200 [thread overview]
Message-ID: <5259221C.4040309@metafoo.de> (raw)
In-Reply-To: <52592E09.30507@kernel.org>
On 10/12/2013 01:10 PM, Jonathan Cameron wrote:
> On 10/04/13 12:07, Lars-Peter Clausen wrote:
>> Since the kernel now disables all buffers when a device is unregistered it might
>> happen that a in-kernel consumer tries to disable that buffer again. So ignore
>> requests where the buffer already is in the desired state.
>>
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> ---
>> No changes since v1
>> ---
>> drivers/iio/industrialio-buffer.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
>> index d6a5455..fd3f3af 100644
>> --- a/drivers/iio/industrialio-buffer.c
>> +++ b/drivers/iio/industrialio-buffer.c
>> @@ -681,9 +681,23 @@ int iio_update_buffers(struct iio_dev *indio_dev,
>> {
>> int ret;
>>
>> + if (insert_buffer == remove_buffer)
>> + return 0;
>> +
>> mutex_lock(&indio_dev->info_exist_lock);
>> mutex_lock(&indio_dev->mlock);
>>
>> + if (insert_buffer && iio_buffer_is_active(insert_buffer))
>> + insert_buffer = NULL;
>> +
>> + if (remove_buffer && !iio_buffer_is_active(remove_buffer))
>> + remove_buffer = NULL;
>> +
> So this condition will occur iff insert_buffer = 0 and remove buffer = 0?
>
> If so, then insert_buffer == remove_buffer and you'll have already returned 0 above??
This is to catch the case where we've set one (or both) of them to NULL
because it was already in the requested state.
>
> Entirely possible I'm needing more coffee this morning...
>> + if (!insert_buffer && !remove_buffer) {
>> + ret = 0;
>> + goto out_unlock;
>> + }
>> +
>> if (indio_dev->info == NULL) {
>> ret = -ENODEV;
>> goto out_unlock;
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-10-12 10:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-04 11:06 [PATCH v2 1/5] iio: Add reference counting for buffers Lars-Peter Clausen
2013-10-04 11:06 ` [PATCH v2 2/5] iio: Return -ENODEV for file operations if the device has been unregistered Lars-Peter Clausen
2013-10-12 11:04 ` Jonathan Cameron
2013-10-04 11:07 ` [PATCH v2 3/5] iio: Wakeup poll and blocking reads when the device is unregistered Lars-Peter Clausen
2013-10-12 11:06 ` Jonathan Cameron
2013-10-04 11:07 ` [PATCH v2 4/5] iio:buffer: Add proper locking for iio_update_buffers() Lars-Peter Clausen
2013-10-12 11:07 ` Jonathan Cameron
2013-10-04 11:07 ` [PATCH v2 5/5] iio:buffer: Ignore noop requests " Lars-Peter Clausen
2013-10-12 11:10 ` Jonathan Cameron
2013-10-12 10:19 ` Lars-Peter Clausen [this message]
2013-10-12 12:06 ` Jonathan Cameron
2013-10-12 12:06 ` Jonathan Cameron
2013-10-12 11:00 ` [PATCH v2 1/5] iio: Add reference counting for buffers 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=5259221C.4040309@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@kernel.org \
--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).