[media] pvrusb2-io: Add some spaces for better code readability
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 22 Dec 2016 19:25:39 +0000 (17:25 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Jan 2017 10:05:45 +0000 (08:05 -0200)
Use space characters at some source code places according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/usb/pvrusb2/pvrusb2-io.c

index aa5c32c678d7f578e1c9390f2877fb7e68fc644e..6d153fc23ec2e14b98d5e1bbb6f88ff94913f178 100644 (file)
@@ -33,13 +33,13 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state);
        if ((bp)->signature != BUFFER_SIG) { \
                pvr2_trace(PVR2_TRACE_ERROR_LEGS, \
                "Buffer %p is bad at %s:%d", \
-               (bp),__FILE__,__LINE__); \
-               pvr2_buffer_describe(bp,"BadSig"); \
+               (bp), __FILE__, __LINE__); \
+               pvr2_buffer_describe(bp, "BadSig"); \
                BUG(); \
        } \
 } while (0)
 #else
-#define BUFFER_CHECK(bp) do {} while(0)
+#define BUFFER_CHECK(bp) do {} while (0)
 #endif
 
 struct pvr2_stream {
@@ -106,7 +106,7 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
 }
 
 #ifdef SANITY_CHECK_BUFFERS
-static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg)
+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 stream=%p purb=%p sig=0x%x",
@@ -152,7 +152,7 @@ static void pvr2_buffer_remove(struct pvr2_buffer *bp)
        (*bcnt) -= ccnt;
        pvr2_trace(PVR2_TRACE_BUF_FLOW,
                   "/*---TRACE_FLOW---*/ bufferPool     %8s dec cap=%07d cnt=%02d",
-                  pvr2_buffer_state_decode(bp->state),*bcnt,*cnt);
+                  pvr2_buffer_state_decode(bp->state), *bcnt, *cnt);
        bp->state = pvr2_buffer_state_none;
 }
 
@@ -167,9 +167,9 @@ static void pvr2_buffer_set_none(struct pvr2_buffer *bp)
                   bp,
                   pvr2_buffer_state_decode(bp->state),
                   pvr2_buffer_state_decode(pvr2_buffer_state_none));
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        pvr2_buffer_remove(bp);
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
 }
 
 static int pvr2_buffer_set_ready(struct pvr2_buffer *bp)
@@ -184,18 +184,18 @@ static int pvr2_buffer_set_ready(struct pvr2_buffer *bp)
                   bp,
                   pvr2_buffer_state_decode(bp->state),
                   pvr2_buffer_state_decode(pvr2_buffer_state_ready));
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        fl = (sp->r_count == 0);
        pvr2_buffer_remove(bp);
-       list_add_tail(&bp->list_overhead,&sp->ready_list);
+       list_add_tail(&bp->list_overhead, &sp->ready_list);
        bp->state = pvr2_buffer_state_ready;
        (sp->r_count)++;
        sp->r_bcount += bp->used_count;
        pvr2_trace(PVR2_TRACE_BUF_FLOW,
                   "/*---TRACE_FLOW---*/ bufferPool     %8s inc cap=%07d cnt=%02d",
                   pvr2_buffer_state_decode(bp->state),
-                  sp->r_bcount,sp->r_count);
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+                  sp->r_bcount, sp->r_count);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
        return fl;
 }
 
@@ -210,17 +210,17 @@ static void pvr2_buffer_set_idle(struct pvr2_buffer *bp)
                   bp,
                   pvr2_buffer_state_decode(bp->state),
                   pvr2_buffer_state_decode(pvr2_buffer_state_idle));
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        pvr2_buffer_remove(bp);
-       list_add_tail(&bp->list_overhead,&sp->idle_list);
+       list_add_tail(&bp->list_overhead, &sp->idle_list);
        bp->state = pvr2_buffer_state_idle;
        (sp->i_count)++;
        sp->i_bcount += bp->max_count;
        pvr2_trace(PVR2_TRACE_BUF_FLOW,
                   "/*---TRACE_FLOW---*/ bufferPool     %8s inc cap=%07d cnt=%02d",
                   pvr2_buffer_state_decode(bp->state),
-                  sp->i_bcount,sp->i_count);
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+                  sp->i_bcount, sp->i_count);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
 }
 
 static void pvr2_buffer_set_queued(struct pvr2_buffer *bp)
@@ -234,17 +234,17 @@ static void pvr2_buffer_set_queued(struct pvr2_buffer *bp)
                   bp,
                   pvr2_buffer_state_decode(bp->state),
                   pvr2_buffer_state_decode(pvr2_buffer_state_queued));
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        pvr2_buffer_remove(bp);
-       list_add_tail(&bp->list_overhead,&sp->queued_list);
+       list_add_tail(&bp->list_overhead, &sp->queued_list);
        bp->state = pvr2_buffer_state_queued;
        (sp->q_count)++;
        sp->q_bcount += bp->max_count;
        pvr2_trace(PVR2_TRACE_BUF_FLOW,
                   "/*---TRACE_FLOW---*/ bufferPool     %8s inc cap=%07d cnt=%02d",
                   pvr2_buffer_state_decode(bp->state),
-                  sp->q_bcount,sp->q_count);
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+                  sp->q_bcount, sp->q_count);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
 }
 
 static void pvr2_buffer_wipe(struct pvr2_buffer *bp)
@@ -258,18 +258,18 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp,
                            struct pvr2_stream *sp,
                            unsigned int id)
 {
-       memset(bp,0,sizeof(*bp));
+       memset(bp, 0, sizeof(*bp));
        bp->signature = BUFFER_SIG;
        bp->id = id;
        pvr2_trace(PVR2_TRACE_BUF_POOL,
-                  "/*---TRACE_FLOW---*/ bufferInit     %p stream=%p",bp,sp);
+                  "/*---TRACE_FLOW---*/ bufferInit     %p stream=%p", bp, sp);
        bp->stream = sp;
        bp->state = pvr2_buffer_state_none;
        INIT_LIST_HEAD(&bp->list_overhead);
-       bp->purb = usb_alloc_urb(0,GFP_KERNEL);
+       bp->purb = usb_alloc_urb(0, GFP_KERNEL);
        if (! bp->purb) return -ENOMEM;
 #ifdef SANITY_CHECK_BUFFERS
-       pvr2_buffer_describe(bp,"create");
+       pvr2_buffer_describe(bp, "create");
 #endif
        return 0;
 }
@@ -277,7 +277,7 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp,
 static void pvr2_buffer_done(struct pvr2_buffer *bp)
 {
 #ifdef SANITY_CHECK_BUFFERS
-       pvr2_buffer_describe(bp,"delete");
+       pvr2_buffer_describe(bp, "delete");
 #endif
        pvr2_buffer_wipe(bp);
        pvr2_buffer_set_none(bp);
@@ -288,7 +288,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
                   bp);
 }
 
-static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
+static int pvr2_stream_buffer_count(struct pvr2_stream *sp, unsigned int cnt)
 {
        int ret;
        unsigned int scnt;
@@ -312,7 +312,7 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
                        nb = kmalloc_array(scnt, sizeof(*nb), GFP_KERNEL);
                        if (!nb) return -ENOMEM;
                        if (sp->buffer_slot_count) {
-                               memcpy(nb,sp->buffers,
+                               memcpy(nb, sp->buffers,
                                       sp->buffer_slot_count * sizeof(*nb));
                                kfree(sp->buffers);
                        }
@@ -321,9 +321,9 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
                }
                while (sp->buffer_total_count < cnt) {
                        struct pvr2_buffer *bp;
-                       bp = kmalloc(sizeof(*bp),GFP_KERNEL);
+                       bp = kmalloc(sizeof(*bp), GFP_KERNEL);
                        if (!bp) return -ENOMEM;
-                       ret = pvr2_buffer_init(bp,sp,sp->buffer_total_count);
+                       ret = pvr2_buffer_init(bp, sp, sp->buffer_total_count);
                        if (ret) {
                                kfree(bp);
                                return -ENOMEM;
@@ -366,10 +366,10 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp)
 
        pvr2_trace(PVR2_TRACE_BUF_POOL,
                   "/*---TRACE_FLOW---*/ poolCheck      stream=%p cur=%d tgt=%d",
-                  sp,sp->buffer_total_count,sp->buffer_target_count);
+                  sp, sp->buffer_total_count, sp->buffer_target_count);
 
        if (sp->buffer_total_count < sp->buffer_target_count) {
-               return pvr2_stream_buffer_count(sp,sp->buffer_target_count);
+               return pvr2_stream_buffer_count(sp, sp->buffer_target_count);
        }
 
        cnt = 0;
@@ -379,7 +379,7 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp)
                cnt++;
        }
        if (cnt) {
-               pvr2_stream_buffer_count(sp,sp->buffer_total_count - cnt);
+               pvr2_stream_buffer_count(sp, sp->buffer_total_count - cnt);
        }
 
        return 0;
@@ -390,7 +390,7 @@ static void pvr2_stream_internal_flush(struct pvr2_stream *sp)
        struct list_head *lp;
        struct pvr2_buffer *bp1;
        while ((lp = sp->queued_list.next) != &sp->queued_list) {
-               bp1 = list_entry(lp,struct pvr2_buffer,list_overhead);
+               bp1 = list_entry(lp, struct pvr2_buffer, list_overhead);
                pvr2_buffer_wipe(bp1);
                /* At this point, we should be guaranteed that no
                   completion callback may happen on this buffer.  But it's
@@ -418,7 +418,7 @@ static void pvr2_stream_done(struct pvr2_stream *sp)
 {
        mutex_lock(&sp->mutex); do {
                pvr2_stream_internal_flush(sp);
-               pvr2_stream_buffer_count(sp,0);
+               pvr2_stream_buffer_count(sp, 0);
        } while (0); mutex_unlock(&sp->mutex);
 }
 
@@ -433,8 +433,8 @@ static void buffer_complete(struct urb *urb)
        bp->status = 0;
        pvr2_trace(PVR2_TRACE_BUF_FLOW,
                   "/*---TRACE_FLOW---*/ bufferComplete %p stat=%d cnt=%d",
-                  bp,urb->status,urb->actual_length);
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+                  bp, urb->status, urb->actual_length);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        if ((!(urb->status)) ||
            (urb->status == -ENOENT) ||
            (urb->status == -ECONNRESET) ||
@@ -455,12 +455,12 @@ static void buffer_complete(struct urb *urb)
                (sp->buffers_failed)++;
                pvr2_trace(PVR2_TRACE_TOLERANCE,
                           "stream %p ignoring error %d - fail count increased to %u",
-                          sp,urb->status,sp->fail_count);
+                          sp, urb->status, sp->fail_count);
        } else {
                (sp->buffers_failed)++;
                bp->status = urb->status;
        }
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
        pvr2_buffer_set_ready(bp);
        if (sp->callback_func) {
                sp->callback_func(sp->callback_data);
@@ -470,9 +470,9 @@ static void buffer_complete(struct urb *urb)
 struct pvr2_stream *pvr2_stream_create(void)
 {
        struct pvr2_stream *sp;
-       sp = kzalloc(sizeof(*sp),GFP_KERNEL);
+       sp = kzalloc(sizeof(*sp), GFP_KERNEL);
        if (!sp) return sp;
-       pvr2_trace(PVR2_TRACE_INIT,"pvr2_stream_create: sp=%p",sp);
+       pvr2_trace(PVR2_TRACE_INIT, "pvr2_stream_create: sp=%p", sp);
        pvr2_stream_init(sp);
        return sp;
 }
@@ -480,7 +480,7 @@ struct pvr2_stream *pvr2_stream_create(void)
 void pvr2_stream_destroy(struct pvr2_stream *sp)
 {
        if (!sp) return;
-       pvr2_trace(PVR2_TRACE_INIT,"pvr2_stream_destroy: sp=%p",sp);
+       pvr2_trace(PVR2_TRACE_INIT, "pvr2_stream_destroy: sp=%p", sp);
        pvr2_stream_done(sp);
        kfree(sp);
 }
@@ -495,7 +495,7 @@ void pvr2_stream_setup(struct pvr2_stream *sp,
                sp->dev = dev;
                sp->endpoint = endpoint;
                sp->fail_tolerance = tolerance;
-       } while(0); mutex_unlock(&sp->mutex);
+       } while (0); mutex_unlock(&sp->mutex);
 }
 
 void pvr2_stream_set_callback(struct pvr2_stream *sp,
@@ -505,11 +505,11 @@ void pvr2_stream_set_callback(struct pvr2_stream *sp,
        unsigned long irq_flags;
        mutex_lock(&sp->mutex);
        do {
-               spin_lock_irqsave(&sp->list_lock,irq_flags);
+               spin_lock_irqsave(&sp->list_lock, irq_flags);
                sp->callback_data = data;
                sp->callback_func = func;
-               spin_unlock_irqrestore(&sp->list_lock,irq_flags);
-       } while(0);
+               spin_unlock_irqrestore(&sp->list_lock, irq_flags);
+       } while (0);
        mutex_unlock(&sp->mutex);
 }
 
@@ -518,7 +518,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp,
                           int zero_counts)
 {
        unsigned long irq_flags;
-       spin_lock_irqsave(&sp->list_lock,irq_flags);
+       spin_lock_irqsave(&sp->list_lock, irq_flags);
        if (stats) {
                stats->buffers_in_queue = sp->q_count;
                stats->buffers_in_idle = sp->i_count;
@@ -532,7 +532,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp,
                sp->buffers_failed = 0;
                sp->bytes_processed = 0;
        }
-       spin_unlock_irqrestore(&sp->list_lock,irq_flags);
+       spin_unlock_irqrestore(&sp->list_lock, irq_flags);
 }
 
 /* Query / set the nominal buffer count */
@@ -541,7 +541,7 @@ 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)
+int pvr2_stream_set_buffer_count(struct pvr2_stream *sp, unsigned int cnt)
 {
        int ret;
        if (sp->buffer_target_count == cnt) return 0;
@@ -549,7 +549,7 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
        do {
                sp->buffer_target_count = cnt;
                ret = pvr2_stream_achieve_buffer_count(sp);
-       } while(0);
+       } while (0);
        mutex_unlock(&sp->mutex);
        return ret;
 }
@@ -558,17 +558,17 @@ 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 NULL;
-       return list_entry(lp,struct pvr2_buffer,list_overhead);
+       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 NULL;
-       return list_entry(lp,struct pvr2_buffer,list_overhead);
+       return list_entry(lp, struct pvr2_buffer, list_overhead);
 }
 
-struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id)
+struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp, int id)
 {
        if (id < 0) return NULL;
        if (id >= sp->buffer_total_count) return NULL;
@@ -592,7 +592,7 @@ void pvr2_stream_kill(struct pvr2_stream *sp)
                if (sp->buffer_total_count != sp->buffer_target_count) {
                        pvr2_stream_achieve_buffer_count(sp);
                }
-       } while(0);
+       } while (0);
        mutex_unlock(&sp->mutex);
 }
 
@@ -626,18 +626,18 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
                usb_fill_bulk_urb(bp->purb,      // struct urb *urb
                                  sp->dev,       // struct usb_device *dev
                                  // endpoint (below)
-                                 usb_rcvbulkpipe(sp->dev,sp->endpoint),
+                                 usb_rcvbulkpipe(sp->dev, sp->endpoint),
                                  bp->ptr,       // void *transfer_buffer
                                  bp->max_count, // int buffer_length
                                  buffer_complete,
                                  bp);
-               usb_submit_urb(bp->purb,GFP_KERNEL);
-       } while(0);
+               usb_submit_urb(bp->purb, GFP_KERNEL);
+       } while (0);
        mutex_unlock(&sp->mutex);
        return ret;
 }
 
-int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
+int pvr2_buffer_set_buffer(struct pvr2_buffer *bp, void *ptr, unsigned int cnt)
 {
        int ret = 0;
        unsigned long irq_flags;
@@ -646,7 +646,7 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
        sp = bp->stream;
        mutex_lock(&sp->mutex);
        do {
-               spin_lock_irqsave(&sp->list_lock,irq_flags);
+               spin_lock_irqsave(&sp->list_lock, irq_flags);
                if (bp->state != pvr2_buffer_state_idle) {
                        ret = -EPERM;
                } else {
@@ -658,10 +658,10 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
                                   "/*---TRACE_FLOW---*/ bufferPool     %8s cap cap=%07d cnt=%02d",
                                   pvr2_buffer_state_decode(
                                           pvr2_buffer_state_idle),
-                                  bp->stream->i_bcount,bp->stream->i_count);
+                                  bp->stream->i_bcount, bp->stream->i_count);
                }
-               spin_unlock_irqrestore(&sp->list_lock,irq_flags);
-       } while(0);
+               spin_unlock_irqrestore(&sp->list_lock, irq_flags);
+       } while (0);
        mutex_unlock(&sp->mutex);
        return ret;
 }