aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/pvrusb2/pvrusb2-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/pvrusb2/pvrusb2-io.c')
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-io.c57
1 files changed, 13 insertions, 44 deletions
diff --git a/drivers/media/video/pvrusb2/pvrusb2-io.c b/drivers/media/video/pvrusb2/pvrusb2-io.c
index a984c91f571..681f79c8064 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-io.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-io.c
@@ -93,7 +93,7 @@ struct pvr2_buffer {
struct urb *purb;
};
-const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
+static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
{
switch (st) {
case pvr2_buffer_state_none: return "none";
@@ -104,7 +104,8 @@ const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
return "unknown";
}
-void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
+#ifdef SANITY_CHECK_BUFFERS
+static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
{
pvr2_trace(PVR2_TRACE_INFO,
"buffer%s%s %p state=%s id=%d status=%d"
@@ -115,10 +116,11 @@ void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
(bp ? pvr2_buffer_state_decode(bp->state) : "(invalid)"),
(bp ? bp->id : 0),
(bp ? bp->status : 0),
- (bp ? bp->stream : 0),
- (bp ? bp->purb : 0),
+ (bp ? bp->stream : NULL),
+ (bp ? bp->purb : NULL),
(bp ? bp->signature : 0));
}
+#endif /* SANITY_CHECK_BUFFERS */
static void pvr2_buffer_remove(struct pvr2_buffer *bp)
{
@@ -284,7 +286,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
pvr2_buffer_wipe(bp);
pvr2_buffer_set_none(bp);
bp->signature = 0;
- bp->stream = 0;
+ bp->stream = NULL;
if (bp->purb) usb_free_urb(bp->purb);
pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/"
" bufferDone %p",bp);
@@ -339,13 +341,13 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
struct pvr2_buffer *bp;
bp = sp->buffers[sp->buffer_total_count - 1];
/* Paranoia */
- sp->buffers[sp->buffer_total_count - 1] = 0;
+ sp->buffers[sp->buffer_total_count - 1] = NULL;
(sp->buffer_total_count)--;
pvr2_buffer_done(bp);
kfree(bp);
}
if (scnt < sp->buffer_slot_count) {
- struct pvr2_buffer **nb = 0;
+ struct pvr2_buffer **nb = NULL;
if (scnt) {
nb = kmalloc(scnt * sizeof(*nb),GFP_KERNEL);
if (!nb) return -ENOMEM;
@@ -513,10 +515,6 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp,
}
/* Query / set the nominal buffer count */
-int pvr2_stream_get_buffer_count(struct pvr2_stream *sp)
-{
- return sp->buffer_target_count;
-}
int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
{
@@ -532,21 +530,21 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp)
{
struct list_head *lp = sp->idle_list.next;
- if (lp == &sp->idle_list) return 0;
+ if (lp == &sp->idle_list) return NULL;
return list_entry(lp,struct pvr2_buffer,list_overhead);
}
struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp)
{
struct list_head *lp = sp->ready_list.next;
- if (lp == &sp->ready_list) return 0;
+ if (lp == &sp->ready_list) return NULL;
return list_entry(lp,struct pvr2_buffer,list_overhead);
}
struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id)
{
- if (id < 0) return 0;
- if (id >= sp->buffer_total_count) return 0;
+ if (id < 0) return NULL;
+ if (id >= sp->buffer_total_count) return NULL;
return sp->buffers[id];
}
@@ -555,17 +553,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp)
return sp->r_count;
}
-int pvr2_stream_get_idle_count(struct pvr2_stream *sp)
-{
- return sp->i_count;
-}
-
-void pvr2_stream_flush(struct pvr2_stream *sp)
-{
- mutex_lock(&sp->mutex); do {
- pvr2_stream_internal_flush(sp);
- } while(0); mutex_unlock(&sp->mutex);
-}
void pvr2_stream_kill(struct pvr2_stream *sp)
{
@@ -620,20 +607,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
return ret;
}
-int pvr2_buffer_idle(struct pvr2_buffer *bp)
-{
- struct pvr2_stream *sp;
- if (!bp) return -EINVAL;
- sp = bp->stream;
- mutex_lock(&sp->mutex); do {
- pvr2_buffer_wipe(bp);
- pvr2_buffer_set_idle(bp);
- if (sp->buffer_total_count != sp->buffer_target_count) {
- pvr2_stream_achieve_buffer_count(sp);
- }
- } while(0); mutex_unlock(&sp->mutex);
- return 0;
-}
int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
{
@@ -673,10 +646,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp)
return bp->status;
}
-enum pvr2_buffer_state pvr2_buffer_get_state(struct pvr2_buffer *bp)
-{
- return bp->state;
-}
int pvr2_buffer_get_id(struct pvr2_buffer *bp)
{