From: Andrea <mariofutire@googlemail.com>
To: linux-dvb@linuxtv.org
Subject: [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush
Date: Sat, 22 Mar 2008 11:32:43 +0000 [thread overview]
Message-ID: <47E4EE5B.1010406@googlemail.com> (raw)
In-Reply-To: <mailman.1.1206183601.26852.linux-dvb@linuxtv.org>
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
linux-dvb-request@linuxtv.org wrote:
> Date: Sat, 22 Mar 2008 04:56:43 +0100
> From: Oliver Endriss <o.endriss@gmx.de>
>
> Nak. At the first glance one might think that this patch is correct.
> Unfortunately, it introduces a subtle bug.
> So I suggest to leave dvb_ringbuffer_flush() as is and zero the read and
> write pointers only where it is really required...
Thanks for your feedback.
You are right and I have changed the code.
I've added a new function in the ringbuffer that resets the pointers to 0 and clears the error flag.
There might be some more factoring and one could move into that function 2 more lines
buf->data = NULL;
buf->size = size;
dvb_ringbuffer_reset(buf);
Andrea
[-- Attachment #2: ring2.diff --]
[-- Type: text/x-patch, Size: 1661 bytes --]
diff -r 1886a5ea2f84 linux/drivers/media/dvb/dvb-core/dmxdev.c
--- a/linux/drivers/media/dvb/dvb-core/dmxdev.c Fri Mar 21 08:04:55 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dmxdev.c Sat Mar 22 10:12:59 2008 +0000
@@ -281,7 +313,7 @@ static int dvb_dmxdev_set_buffer_size(st
mem = buf->data;
buf->data = NULL;
buf->size = size;
- dvb_ringbuffer_flush(buf);
+ dvb_ringbuffer_reset(buf);
spin_unlock_irq(&dmxdevfilter->dev->lock);
vfree(mem);
diff -r 1886a5ea2f84 linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
--- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c Fri Mar 21 08:04:55 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c Sat Mar 22 10:12:59 2008 +0000
@@ -90,6 +90,11 @@ void dvb_ringbuffer_flush(struct dvb_rin
rbuf->error = 0;
}
+void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf)
+{
+ rbuf->pread = rbuf->pwrite = 0;
+ rbuf->error = 0;
+}
void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf)
diff -r 1886a5ea2f84 linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
--- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h Fri Mar 21 08:04:55 2008 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h Sat Mar 22 10:12:59 2008 +0000
@@ -84,6 +84,12 @@ extern ssize_t dvb_ringbuffer_free(struc
/* return the number of bytes waiting in the buffer */
extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf);
+/*
+** Reset the read and write pointers to zero and flush the buffer
+** This counts as a read and write operation
+*/
+
+extern void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf);
/* read routines & macros */
/* ---------------------- */
[-- Attachment #3: Type: text/plain, Size: 150 bytes --]
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
next parent reply other threads:[~2008-03-22 11:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1.1206183601.26852.linux-dvb@linuxtv.org>
2008-03-22 11:32 ` Andrea [this message]
2008-04-13 9:30 ` [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush Andrea
2008-04-13 9:49 ` Andrea
2008-04-14 19:51 ` Andrea
2008-04-22 18:54 ` Oliver Endriss
2008-03-22 11:32 ` [linux-dvb] [PATCH] 2/3: implement DMX_SET_BUFFER_SIZE for dvr Andrea
2008-03-24 20:49 ` Andrea
2008-04-12 0:35 ` Oliver Endriss
2008-04-13 9:30 ` Andrea
2008-04-13 9:50 ` Andrea
2008-04-13 23:50 ` Oliver Endriss
2008-04-14 19:51 ` Andrea
2008-04-22 18:54 ` Oliver Endriss
2008-03-22 0:22 [linux-dvb] [PATCH] 1/3: BUG FIX in dvb_ringbuffer_flush Andrea
2008-03-22 3:56 ` Oliver Endriss
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=47E4EE5B.1010406@googlemail.com \
--to=mariofutire@googlemail.com \
--cc=linux-dvb@linuxtv.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