Commit 7cf8c100 authored by Markus Elfring's avatar Markus Elfring Committed by Mauro Carvalho Chehab

[media] pvrusb2-io: Add some spaces for better code readability

Use space characters at some source code places according to
the Linux coding style convention.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 16eddbe3
...@@ -33,13 +33,13 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state); ...@@ -33,13 +33,13 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state);
if ((bp)->signature != BUFFER_SIG) { \ if ((bp)->signature != BUFFER_SIG) { \
pvr2_trace(PVR2_TRACE_ERROR_LEGS, \ pvr2_trace(PVR2_TRACE_ERROR_LEGS, \
"Buffer %p is bad at %s:%d", \ "Buffer %p is bad at %s:%d", \
(bp),__FILE__,__LINE__); \ (bp), __FILE__, __LINE__); \
pvr2_buffer_describe(bp,"BadSig"); \ pvr2_buffer_describe(bp, "BadSig"); \
BUG(); \ BUG(); \
} \ } \
} while (0) } while (0)
#else #else
#define BUFFER_CHECK(bp) do {} while(0) #define BUFFER_CHECK(bp) do {} while (0)
#endif #endif
struct pvr2_stream { struct pvr2_stream {
...@@ -106,7 +106,7 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st) ...@@ -106,7 +106,7 @@ static const char *pvr2_buffer_state_decode(enum pvr2_buffer_state st)
} }
#ifdef SANITY_CHECK_BUFFERS #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, pvr2_trace(PVR2_TRACE_INFO,
"buffer%s%s %p state=%s id=%d status=%d stream=%p purb=%p sig=0x%x", "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) ...@@ -152,7 +152,7 @@ static void pvr2_buffer_remove(struct pvr2_buffer *bp)
(*bcnt) -= ccnt; (*bcnt) -= ccnt;
pvr2_trace(PVR2_TRACE_BUF_FLOW, pvr2_trace(PVR2_TRACE_BUF_FLOW,
"/*---TRACE_FLOW---*/ bufferPool %8s dec cap=%07d cnt=%02d", "/*---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; bp->state = pvr2_buffer_state_none;
} }
...@@ -167,9 +167,9 @@ static void pvr2_buffer_set_none(struct pvr2_buffer *bp) ...@@ -167,9 +167,9 @@ static void pvr2_buffer_set_none(struct pvr2_buffer *bp)
bp, bp,
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
pvr2_buffer_state_decode(pvr2_buffer_state_none)); 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); 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) static int pvr2_buffer_set_ready(struct pvr2_buffer *bp)
...@@ -184,18 +184,18 @@ 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, bp,
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
pvr2_buffer_state_decode(pvr2_buffer_state_ready)); 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); fl = (sp->r_count == 0);
pvr2_buffer_remove(bp); 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; bp->state = pvr2_buffer_state_ready;
(sp->r_count)++; (sp->r_count)++;
sp->r_bcount += bp->used_count; sp->r_bcount += bp->used_count;
pvr2_trace(PVR2_TRACE_BUF_FLOW, pvr2_trace(PVR2_TRACE_BUF_FLOW,
"/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d",
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
sp->r_bcount,sp->r_count); sp->r_bcount, sp->r_count);
spin_unlock_irqrestore(&sp->list_lock,irq_flags); spin_unlock_irqrestore(&sp->list_lock, irq_flags);
return fl; return fl;
} }
...@@ -210,17 +210,17 @@ static void pvr2_buffer_set_idle(struct pvr2_buffer *bp) ...@@ -210,17 +210,17 @@ static void pvr2_buffer_set_idle(struct pvr2_buffer *bp)
bp, bp,
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
pvr2_buffer_state_decode(pvr2_buffer_state_idle)); 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); 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; bp->state = pvr2_buffer_state_idle;
(sp->i_count)++; (sp->i_count)++;
sp->i_bcount += bp->max_count; sp->i_bcount += bp->max_count;
pvr2_trace(PVR2_TRACE_BUF_FLOW, pvr2_trace(PVR2_TRACE_BUF_FLOW,
"/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d",
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
sp->i_bcount,sp->i_count); sp->i_bcount, sp->i_count);
spin_unlock_irqrestore(&sp->list_lock,irq_flags); spin_unlock_irqrestore(&sp->list_lock, irq_flags);
} }
static void pvr2_buffer_set_queued(struct pvr2_buffer *bp) static void pvr2_buffer_set_queued(struct pvr2_buffer *bp)
...@@ -234,17 +234,17 @@ 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, bp,
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
pvr2_buffer_state_decode(pvr2_buffer_state_queued)); 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); 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; bp->state = pvr2_buffer_state_queued;
(sp->q_count)++; (sp->q_count)++;
sp->q_bcount += bp->max_count; sp->q_bcount += bp->max_count;
pvr2_trace(PVR2_TRACE_BUF_FLOW, pvr2_trace(PVR2_TRACE_BUF_FLOW,
"/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d",
pvr2_buffer_state_decode(bp->state), pvr2_buffer_state_decode(bp->state),
sp->q_bcount,sp->q_count); sp->q_bcount, sp->q_count);
spin_unlock_irqrestore(&sp->list_lock,irq_flags); spin_unlock_irqrestore(&sp->list_lock, irq_flags);
} }
static void pvr2_buffer_wipe(struct pvr2_buffer *bp) static void pvr2_buffer_wipe(struct pvr2_buffer *bp)
...@@ -258,18 +258,18 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp, ...@@ -258,18 +258,18 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp,
struct pvr2_stream *sp, struct pvr2_stream *sp,
unsigned int id) unsigned int id)
{ {
memset(bp,0,sizeof(*bp)); memset(bp, 0, sizeof(*bp));
bp->signature = BUFFER_SIG; bp->signature = BUFFER_SIG;
bp->id = id; bp->id = id;
pvr2_trace(PVR2_TRACE_BUF_POOL, 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->stream = sp;
bp->state = pvr2_buffer_state_none; bp->state = pvr2_buffer_state_none;
INIT_LIST_HEAD(&bp->list_overhead); 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; if (! bp->purb) return -ENOMEM;
#ifdef SANITY_CHECK_BUFFERS #ifdef SANITY_CHECK_BUFFERS
pvr2_buffer_describe(bp,"create"); pvr2_buffer_describe(bp, "create");
#endif #endif
return 0; return 0;
} }
...@@ -277,7 +277,7 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp, ...@@ -277,7 +277,7 @@ static int pvr2_buffer_init(struct pvr2_buffer *bp,
static void pvr2_buffer_done(struct pvr2_buffer *bp) static void pvr2_buffer_done(struct pvr2_buffer *bp)
{ {
#ifdef SANITY_CHECK_BUFFERS #ifdef SANITY_CHECK_BUFFERS
pvr2_buffer_describe(bp,"delete"); pvr2_buffer_describe(bp, "delete");
#endif #endif
pvr2_buffer_wipe(bp); pvr2_buffer_wipe(bp);
pvr2_buffer_set_none(bp); pvr2_buffer_set_none(bp);
...@@ -288,7 +288,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp) ...@@ -288,7 +288,7 @@ static void pvr2_buffer_done(struct pvr2_buffer *bp)
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; int ret;
unsigned int scnt; unsigned int scnt;
...@@ -312,7 +312,7 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt) ...@@ -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); nb = kmalloc_array(scnt, sizeof(*nb), GFP_KERNEL);
if (!nb) return -ENOMEM; if (!nb) return -ENOMEM;
if (sp->buffer_slot_count) { if (sp->buffer_slot_count) {
memcpy(nb,sp->buffers, memcpy(nb, sp->buffers,
sp->buffer_slot_count * sizeof(*nb)); sp->buffer_slot_count * sizeof(*nb));
kfree(sp->buffers); kfree(sp->buffers);
} }
...@@ -321,9 +321,9 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt) ...@@ -321,9 +321,9 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
} }
while (sp->buffer_total_count < cnt) { while (sp->buffer_total_count < cnt) {
struct pvr2_buffer *bp; struct pvr2_buffer *bp;
bp = kmalloc(sizeof(*bp),GFP_KERNEL); bp = kmalloc(sizeof(*bp), GFP_KERNEL);
if (!bp) return -ENOMEM; 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) { if (ret) {
kfree(bp); kfree(bp);
return -ENOMEM; return -ENOMEM;
...@@ -366,10 +366,10 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp) ...@@ -366,10 +366,10 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp)
pvr2_trace(PVR2_TRACE_BUF_POOL, pvr2_trace(PVR2_TRACE_BUF_POOL,
"/*---TRACE_FLOW---*/ poolCheck stream=%p cur=%d tgt=%d", "/*---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) { 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; cnt = 0;
...@@ -379,7 +379,7 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp) ...@@ -379,7 +379,7 @@ static int pvr2_stream_achieve_buffer_count(struct pvr2_stream *sp)
cnt++; cnt++;
} }
if (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; return 0;
...@@ -390,7 +390,7 @@ static void pvr2_stream_internal_flush(struct pvr2_stream *sp) ...@@ -390,7 +390,7 @@ static void pvr2_stream_internal_flush(struct pvr2_stream *sp)
struct list_head *lp; struct list_head *lp;
struct pvr2_buffer *bp1; struct pvr2_buffer *bp1;
while ((lp = sp->queued_list.next) != &sp->queued_list) { 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); pvr2_buffer_wipe(bp1);
/* At this point, we should be guaranteed that no /* At this point, we should be guaranteed that no
completion callback may happen on this buffer. But it's completion callback may happen on this buffer. But it's
...@@ -418,7 +418,7 @@ static void pvr2_stream_done(struct pvr2_stream *sp) ...@@ -418,7 +418,7 @@ static void pvr2_stream_done(struct pvr2_stream *sp)
{ {
mutex_lock(&sp->mutex); do { mutex_lock(&sp->mutex); do {
pvr2_stream_internal_flush(sp); pvr2_stream_internal_flush(sp);
pvr2_stream_buffer_count(sp,0); pvr2_stream_buffer_count(sp, 0);
} while (0); mutex_unlock(&sp->mutex); } while (0); mutex_unlock(&sp->mutex);
} }
...@@ -433,8 +433,8 @@ static void buffer_complete(struct urb *urb) ...@@ -433,8 +433,8 @@ static void buffer_complete(struct urb *urb)
bp->status = 0; bp->status = 0;
pvr2_trace(PVR2_TRACE_BUF_FLOW, pvr2_trace(PVR2_TRACE_BUF_FLOW,
"/*---TRACE_FLOW---*/ bufferComplete %p stat=%d cnt=%d", "/*---TRACE_FLOW---*/ bufferComplete %p stat=%d cnt=%d",
bp,urb->status,urb->actual_length); bp, urb->status, urb->actual_length);
spin_lock_irqsave(&sp->list_lock,irq_flags); spin_lock_irqsave(&sp->list_lock, irq_flags);
if ((!(urb->status)) || if ((!(urb->status)) ||
(urb->status == -ENOENT) || (urb->status == -ENOENT) ||
(urb->status == -ECONNRESET) || (urb->status == -ECONNRESET) ||
...@@ -455,12 +455,12 @@ static void buffer_complete(struct urb *urb) ...@@ -455,12 +455,12 @@ static void buffer_complete(struct urb *urb)
(sp->buffers_failed)++; (sp->buffers_failed)++;
pvr2_trace(PVR2_TRACE_TOLERANCE, pvr2_trace(PVR2_TRACE_TOLERANCE,
"stream %p ignoring error %d - fail count increased to %u", "stream %p ignoring error %d - fail count increased to %u",
sp,urb->status,sp->fail_count); sp, urb->status, sp->fail_count);
} else { } else {
(sp->buffers_failed)++; (sp->buffers_failed)++;
bp->status = urb->status; 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); pvr2_buffer_set_ready(bp);
if (sp->callback_func) { if (sp->callback_func) {
sp->callback_func(sp->callback_data); sp->callback_func(sp->callback_data);
...@@ -470,9 +470,9 @@ static void buffer_complete(struct urb *urb) ...@@ -470,9 +470,9 @@ static void buffer_complete(struct urb *urb)
struct pvr2_stream *pvr2_stream_create(void) struct pvr2_stream *pvr2_stream_create(void)
{ {
struct pvr2_stream *sp; struct pvr2_stream *sp;
sp = kzalloc(sizeof(*sp),GFP_KERNEL); sp = kzalloc(sizeof(*sp), GFP_KERNEL);
if (!sp) return sp; 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); pvr2_stream_init(sp);
return sp; return sp;
} }
...@@ -480,7 +480,7 @@ struct pvr2_stream *pvr2_stream_create(void) ...@@ -480,7 +480,7 @@ struct pvr2_stream *pvr2_stream_create(void)
void pvr2_stream_destroy(struct pvr2_stream *sp) void pvr2_stream_destroy(struct pvr2_stream *sp)
{ {
if (!sp) return; 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); pvr2_stream_done(sp);
kfree(sp); kfree(sp);
} }
...@@ -495,7 +495,7 @@ void pvr2_stream_setup(struct pvr2_stream *sp, ...@@ -495,7 +495,7 @@ void pvr2_stream_setup(struct pvr2_stream *sp,
sp->dev = dev; sp->dev = dev;
sp->endpoint = endpoint; sp->endpoint = endpoint;
sp->fail_tolerance = tolerance; 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, void pvr2_stream_set_callback(struct pvr2_stream *sp,
...@@ -505,11 +505,11 @@ 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; unsigned long irq_flags;
mutex_lock(&sp->mutex); mutex_lock(&sp->mutex);
do { do {
spin_lock_irqsave(&sp->list_lock,irq_flags); spin_lock_irqsave(&sp->list_lock, irq_flags);
sp->callback_data = data; sp->callback_data = data;
sp->callback_func = func; sp->callback_func = func;
spin_unlock_irqrestore(&sp->list_lock,irq_flags); spin_unlock_irqrestore(&sp->list_lock, irq_flags);
} while(0); } while (0);
mutex_unlock(&sp->mutex); mutex_unlock(&sp->mutex);
} }
...@@ -518,7 +518,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp, ...@@ -518,7 +518,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp,
int zero_counts) int zero_counts)
{ {
unsigned long irq_flags; unsigned long irq_flags;
spin_lock_irqsave(&sp->list_lock,irq_flags); spin_lock_irqsave(&sp->list_lock, irq_flags);
if (stats) { if (stats) {
stats->buffers_in_queue = sp->q_count; stats->buffers_in_queue = sp->q_count;
stats->buffers_in_idle = sp->i_count; stats->buffers_in_idle = sp->i_count;
...@@ -532,7 +532,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp, ...@@ -532,7 +532,7 @@ void pvr2_stream_get_stats(struct pvr2_stream *sp,
sp->buffers_failed = 0; sp->buffers_failed = 0;
sp->bytes_processed = 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 */ /* Query / set the nominal buffer count */
...@@ -541,7 +541,7 @@ int pvr2_stream_get_buffer_count(struct pvr2_stream *sp) ...@@ -541,7 +541,7 @@ int pvr2_stream_get_buffer_count(struct pvr2_stream *sp)
return sp->buffer_target_count; 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; int ret;
if (sp->buffer_target_count == cnt) return 0; 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) ...@@ -549,7 +549,7 @@ int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt)
do { do {
sp->buffer_target_count = cnt; sp->buffer_target_count = cnt;
ret = pvr2_stream_achieve_buffer_count(sp); ret = pvr2_stream_achieve_buffer_count(sp);
} while(0); } while (0);
mutex_unlock(&sp->mutex); mutex_unlock(&sp->mutex);
return ret; return ret;
} }
...@@ -558,17 +558,17 @@ struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp) ...@@ -558,17 +558,17 @@ struct pvr2_buffer *pvr2_stream_get_idle_buffer(struct pvr2_stream *sp)
{ {
struct list_head *lp = sp->idle_list.next; struct list_head *lp = sp->idle_list.next;
if (lp == &sp->idle_list) return NULL; 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 pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp)
{ {
struct list_head *lp = sp->ready_list.next; struct list_head *lp = sp->ready_list.next;
if (lp == &sp->ready_list) return NULL; 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 < 0) return NULL;
if (id >= sp->buffer_total_count) return NULL; if (id >= sp->buffer_total_count) return NULL;
...@@ -592,7 +592,7 @@ void pvr2_stream_kill(struct pvr2_stream *sp) ...@@ -592,7 +592,7 @@ void pvr2_stream_kill(struct pvr2_stream *sp)
if (sp->buffer_total_count != sp->buffer_target_count) { if (sp->buffer_total_count != sp->buffer_target_count) {
pvr2_stream_achieve_buffer_count(sp); pvr2_stream_achieve_buffer_count(sp);
} }
} while(0); } while (0);
mutex_unlock(&sp->mutex); mutex_unlock(&sp->mutex);
} }
...@@ -626,18 +626,18 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp) ...@@ -626,18 +626,18 @@ int pvr2_buffer_queue(struct pvr2_buffer *bp)
usb_fill_bulk_urb(bp->purb, // struct urb *urb usb_fill_bulk_urb(bp->purb, // struct urb *urb
sp->dev, // struct usb_device *dev sp->dev, // struct usb_device *dev
// endpoint (below) // endpoint (below)
usb_rcvbulkpipe(sp->dev,sp->endpoint), usb_rcvbulkpipe(sp->dev, sp->endpoint),
bp->ptr, // void *transfer_buffer bp->ptr, // void *transfer_buffer
bp->max_count, // int buffer_length bp->max_count, // int buffer_length
buffer_complete, buffer_complete,
bp); bp);
usb_submit_urb(bp->purb,GFP_KERNEL); usb_submit_urb(bp->purb, GFP_KERNEL);
} while(0); } while (0);
mutex_unlock(&sp->mutex); mutex_unlock(&sp->mutex);
return ret; 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; int ret = 0;
unsigned long irq_flags; unsigned long irq_flags;
...@@ -646,7 +646,7 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) ...@@ -646,7 +646,7 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt)
sp = bp->stream; sp = bp->stream;
mutex_lock(&sp->mutex); mutex_lock(&sp->mutex);
do { do {
spin_lock_irqsave(&sp->list_lock,irq_flags); spin_lock_irqsave(&sp->list_lock, irq_flags);
if (bp->state != pvr2_buffer_state_idle) { if (bp->state != pvr2_buffer_state_idle) {
ret = -EPERM; ret = -EPERM;
} else { } else {
...@@ -658,10 +658,10 @@ int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) ...@@ -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", "/*---TRACE_FLOW---*/ bufferPool %8s cap cap=%07d cnt=%02d",
pvr2_buffer_state_decode( pvr2_buffer_state_decode(
pvr2_buffer_state_idle), 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); spin_unlock_irqrestore(&sp->list_lock, irq_flags);
} while(0); } while (0);
mutex_unlock(&sp->mutex); mutex_unlock(&sp->mutex);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment