linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH v2 4/4] iio:kfifo: Set update_needed to false after allocating a new buffer
Date: Tue, 15 Oct 2013 10:30:30 +0200	[thread overview]
Message-ID: <1381825830-25581-4-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1381825830-25581-1-git-send-email-lars@metafoo.de>

update_needed is used to decide whether the kfifo buffer needs to be
re-allocated. It is set to true whenever the size of the buffer is changed. It
is never set to false though, causing the buffer to always be re-allocated.
Setting update_needed to false after the new buffer has been allocated fixes the
problem.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
No changes in v2
---
 drivers/iio/kfifo_buf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/kfifo_buf.c b/drivers/iio/kfifo_buf.c
index d654f42..95c6fc8 100644
--- a/drivers/iio/kfifo_buf.c
+++ b/drivers/iio/kfifo_buf.c
@@ -38,6 +38,7 @@ static int iio_request_update_kfifo(struct iio_buffer *r)
 		kfifo_free(&buf->kf);
 		ret = __iio_allocate_kfifo(buf, buf->buffer.bytes_per_datum,
 				   buf->buffer.length);
+		buf->update_needed = false;
 	} else {
 		kfifo_reset_out(&buf->kf);
 	}
-- 
1.8.0

  parent reply	other threads:[~2013-10-15  8:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-15  8:30 [PATCH v2 1/4] iio:kfifo: Fix memory leak Lars-Peter Clausen
2013-10-15  8:30 ` [PATCH v2 2/4] iio:kfifo: Protect against concurrent access from userspace Lars-Peter Clausen
2013-10-15 18:19   ` Jonathan Cameron
2013-10-15  8:30 ` [PATCH v2 3/4] iio:kfifo: Empty buffer on update Lars-Peter Clausen
2013-10-15 18:20   ` Jonathan Cameron
2013-10-15  8:30 ` Lars-Peter Clausen [this message]
2013-10-15 18:20   ` [PATCH v2 4/4] iio:kfifo: Set update_needed to false after allocating a new buffer Jonathan Cameron
2013-10-15 18:19 ` [PATCH v2 1/4] iio:kfifo: Fix memory leak 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=1381825830-25581-4-git-send-email-lars@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).