From 9d9d6baeca6f9174b8e7fd219a62a8fa09d61cc7 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Mon, 13 Mar 2006 13:14:34 -0300 Subject: [PATCH] V4L/DVB (3484): Make dvb_ringbuffer compatible to dmxdev_buffer Added variable 'error' to struct dvb_ringbuffer, which is set to zero on init() and flush(). Also reset read an write pointers to zero on flush() to get less fragmented data. Signed-off-by: Andreas Oberritter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/dvb-core/dvb_ringbuffer.c | 4 +++- drivers/media/dvb/dvb-core/dvb_ringbuffer.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c index 77ad2410f4d3..f233248358c4 100644 --- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c +++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c @@ -45,6 +45,7 @@ void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len) rbuf->pread=rbuf->pwrite=0; rbuf->data=data; rbuf->size=len; + rbuf->error=0; init_waitqueue_head(&rbuf->queue); @@ -86,7 +87,8 @@ ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf) void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf) { - rbuf->pread = rbuf->pwrite; + rbuf->pread = rbuf->pwrite = 0; + rbuf->error = 0; } diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h index 6d2560972771..d97714e75736 100644 --- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h +++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h @@ -35,6 +35,7 @@ struct dvb_ringbuffer { ssize_t size; ssize_t pread; ssize_t pwrite; + int error; wait_queue_head_t queue; spinlock_t lock; -- 2.30.2