Merge branch 'from-linus' into upstream
[pandora-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-io.c
index a984c91..1e39376 100644 (file)
@@ -26,6 +26,8 @@
 #include <linux/slab.h>
 #include <linux/mutex.h>
 
+static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state);
+
 #define BUFFER_SIG 0x47653271
 
 // #define SANITY_CHECK_BUFFERS
@@ -93,7 +95,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 +106,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 +118,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 +288,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 +343,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;
@@ -532,21 +536,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,18 +559,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)
 {
        struct pvr2_buffer *bp;
@@ -620,21 +612,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)
 {
        int ret = 0;
@@ -673,11 +650,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)
 {
        return bp->id;