]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/pvrusb2/pvrusb2-io.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
[linux-2.6-omap-h63xx.git] / drivers / media / video / pvrusb2 / pvrusb2-io.c
index c032777a977fc05843dcd02539e00b76baf1b9f2..57fb32033543a1b4749cb429e8eb607b2f636f24 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
@@ -116,8 +118,8 @@ static 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  */
@@ -286,8 +288,8 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
        pvr2_buffer_wipe(bp);
        pvr2_buffer_set_none(bp);
        bp->signature = 0;
-       bp->stream = 0;
-       if (bp->purb) usb_free_urb(bp->purb);
+       bp->stream = NULL;
+       usb_free_urb(bp->purb);
        pvr2_trace(PVR2_TRACE_BUF_POOL,"/*---TRACE_FLOW---*/"
                   " bufferDone     %p",bp);
 }
@@ -341,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;
@@ -427,7 +429,7 @@ static void pvr2_stream_done(struct pvr2_stream *sp)
        } while (0); mutex_unlock(&sp->mutex);
 }
 
-static void buffer_complete(struct urb *urb, struct pt_regs *regs)
+static void buffer_complete(struct urb *urb)
 {
        struct pvr2_buffer *bp = urb->context;
        struct pvr2_stream *sp;
@@ -515,6 +517,10 @@ 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)
 {
@@ -530,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];
 }
 
@@ -553,7 +559,6 @@ int pvr2_stream_get_ready_count(struct pvr2_stream *sp)
        return sp->r_count;
 }
 
-
 void pvr2_stream_kill(struct pvr2_stream *sp)
 {
        struct pvr2_buffer *bp;
@@ -607,7 +612,6 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
        return ret;
 }
 
-
 int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
 {
        int ret = 0;
@@ -646,7 +650,6 @@ int pvr2_buffer_get_status(struct pvr2_buffer *bp)
        return bp->status;
 }
 
-
 int pvr2_buffer_get_id(struct pvr2_buffer *bp)
 {
        return bp->id;