aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/dvb-core/dmxdev.c4
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.c6
-rw-r--r--drivers/media/dvb/dvb-core/dvb_ringbuffer.h8
3 files changed, 16 insertions, 2 deletions
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c
index 3415a3bb363..bbd52be552d 100644
--- a/drivers/media/dvb/dvb-core/dmxdev.c
+++ b/drivers/media/dvb/dvb-core/dmxdev.c
@@ -281,7 +281,9 @@ static int dvb_dmxdev_set_buffer_size(struct dmxdev_filter *dmxdevfilter,
281 mem = buf->data; 281 mem = buf->data;
282 buf->data = NULL; 282 buf->data = NULL;
283 buf->size = size; 283 buf->size = size;
284 dvb_ringbuffer_flush(buf); 284
285 /* reset and not flush in case the buffer shrinks */
286 dvb_ringbuffer_reset(buf);
285 spin_unlock_irq(&dmxdevfilter->dev->lock); 287 spin_unlock_irq(&dmxdevfilter->dev->lock);
286 vfree(mem); 288 vfree(mem);
287 289
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
index ac9d93cf83c..872985b7912 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
@@ -90,7 +90,11 @@ void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
90 rbuf->error = 0; 90 rbuf->error = 0;
91} 91}
92 92
93 93void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf)
94{
95 rbuf->pread = rbuf->pwrite = 0;
96 rbuf->error = 0;
97}
94 98
95void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf) 99void dvb_ringbuffer_flush_spinlock_wakeup(struct dvb_ringbuffer *rbuf)
96{ 100{
diff --git a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
index d97714e7573..89082626296 100644
--- a/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
+++ b/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
@@ -69,6 +69,7 @@ struct dvb_ringbuffer {
69** to lock read or write operations. 69** to lock read or write operations.
70** Two or more readers must be locked against each other. 70** Two or more readers must be locked against each other.
71** Flushing the buffer counts as a read operation. 71** Flushing the buffer counts as a read operation.
72** Resetting the buffer counts as a read and write operation.
72** Two or more writers must be locked against each other. 73** Two or more writers must be locked against each other.
73*/ 74*/
74 75
@@ -85,6 +86,13 @@ extern ssize_t dvb_ringbuffer_free(struct dvb_ringbuffer *rbuf);
85extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf); 86extern ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf);
86 87
87 88
89/*
90** Reset the read and write pointers to zero and flush the buffer
91** This counts as a read and write operation
92*/
93extern void dvb_ringbuffer_reset(struct dvb_ringbuffer *rbuf);
94
95
88/* read routines & macros */ 96/* read routines & macros */
89/* ---------------------- */ 97/* ---------------------- */
90/* flush buffer */ 98/* flush buffer */