Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: 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>

authored by

Markus Elfring and committed by
Mauro Carvalho Chehab
7cf8c100 16eddbe3

+60 -60
+60 -60
drivers/media/usb/pvrusb2/pvrusb2-io.c
··· 33 33 if ((bp)->signature != BUFFER_SIG) { \ 34 34 pvr2_trace(PVR2_TRACE_ERROR_LEGS, \ 35 35 "Buffer %p is bad at %s:%d", \ 36 - (bp),__FILE__,__LINE__); \ 37 - pvr2_buffer_describe(bp,"BadSig"); \ 36 + (bp), __FILE__, __LINE__); \ 37 + pvr2_buffer_describe(bp, "BadSig"); \ 38 38 BUG(); \ 39 39 } \ 40 40 } while (0) 41 41 #else 42 - #define BUFFER_CHECK(bp) do {} while(0) 42 + #define BUFFER_CHECK(bp) do {} while (0) 43 43 #endif 44 44 45 45 struct pvr2_stream { ··· 106 106 } 107 107 108 108 #ifdef SANITY_CHECK_BUFFERS 109 - static void pvr2_buffer_describe(struct pvr2_buffer *bp,const char *msg) 109 + static void pvr2_buffer_describe(struct pvr2_buffer *bp, const char *msg) 110 110 { 111 111 pvr2_trace(PVR2_TRACE_INFO, 112 112 "buffer%s%s %p state=%s id=%d status=%d stream=%p purb=%p sig=0x%x", ··· 152 152 (*bcnt) -= ccnt; 153 153 pvr2_trace(PVR2_TRACE_BUF_FLOW, 154 154 "/*---TRACE_FLOW---*/ bufferPool %8s dec cap=%07d cnt=%02d", 155 - pvr2_buffer_state_decode(bp->state),*bcnt,*cnt); 155 + pvr2_buffer_state_decode(bp->state), *bcnt, *cnt); 156 156 bp->state = pvr2_buffer_state_none; 157 157 } 158 158 ··· 167 167 bp, 168 168 pvr2_buffer_state_decode(bp->state), 169 169 pvr2_buffer_state_decode(pvr2_buffer_state_none)); 170 - spin_lock_irqsave(&sp->list_lock,irq_flags); 170 + spin_lock_irqsave(&sp->list_lock, irq_flags); 171 171 pvr2_buffer_remove(bp); 172 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 172 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 173 173 } 174 174 175 175 static int pvr2_buffer_set_ready(struct pvr2_buffer *bp) ··· 184 184 bp, 185 185 pvr2_buffer_state_decode(bp->state), 186 186 pvr2_buffer_state_decode(pvr2_buffer_state_ready)); 187 - spin_lock_irqsave(&sp->list_lock,irq_flags); 187 + spin_lock_irqsave(&sp->list_lock, irq_flags); 188 188 fl = (sp->r_count == 0); 189 189 pvr2_buffer_remove(bp); 190 - list_add_tail(&bp->list_overhead,&sp->ready_list); 190 + list_add_tail(&bp->list_overhead, &sp->ready_list); 191 191 bp->state = pvr2_buffer_state_ready; 192 192 (sp->r_count)++; 193 193 sp->r_bcount += bp->used_count; 194 194 pvr2_trace(PVR2_TRACE_BUF_FLOW, 195 195 "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", 196 196 pvr2_buffer_state_decode(bp->state), 197 - sp->r_bcount,sp->r_count); 198 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 197 + sp->r_bcount, sp->r_count); 198 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 199 199 return fl; 200 200 } 201 201 ··· 210 210 bp, 211 211 pvr2_buffer_state_decode(bp->state), 212 212 pvr2_buffer_state_decode(pvr2_buffer_state_idle)); 213 - spin_lock_irqsave(&sp->list_lock,irq_flags); 213 + spin_lock_irqsave(&sp->list_lock, irq_flags); 214 214 pvr2_buffer_remove(bp); 215 - list_add_tail(&bp->list_overhead,&sp->idle_list); 215 + list_add_tail(&bp->list_overhead, &sp->idle_list); 216 216 bp->state = pvr2_buffer_state_idle; 217 217 (sp->i_count)++; 218 218 sp->i_bcount += bp->max_count; 219 219 pvr2_trace(PVR2_TRACE_BUF_FLOW, 220 220 "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", 221 221 pvr2_buffer_state_decode(bp->state), 222 - sp->i_bcount,sp->i_count); 223 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 222 + sp->i_bcount, sp->i_count); 223 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 224 224 } 225 225 226 226 static void pvr2_buffer_set_queued(struct pvr2_buffer *bp) ··· 234 234 bp, 235 235 pvr2_buffer_state_decode(bp->state), 236 236 pvr2_buffer_state_decode(pvr2_buffer_state_queued)); 237 - spin_lock_irqsave(&sp->list_lock,irq_flags); 237 + spin_lock_irqsave(&sp->list_lock, irq_flags); 238 238 pvr2_buffer_remove(bp); 239 - list_add_tail(&bp->list_overhead,&sp->queued_list); 239 + list_add_tail(&bp->list_overhead, &sp->queued_list); 240 240 bp->state = pvr2_buffer_state_queued; 241 241 (sp->q_count)++; 242 242 sp->q_bcount += bp->max_count; 243 243 pvr2_trace(PVR2_TRACE_BUF_FLOW, 244 244 "/*---TRACE_FLOW---*/ bufferPool %8s inc cap=%07d cnt=%02d", 245 245 pvr2_buffer_state_decode(bp->state), 246 - sp->q_bcount,sp->q_count); 247 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 246 + sp->q_bcount, sp->q_count); 247 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 248 248 } 249 249 250 250 static void pvr2_buffer_wipe(struct pvr2_buffer *bp) ··· 258 258 struct pvr2_stream *sp, 259 259 unsigned int id) 260 260 { 261 - memset(bp,0,sizeof(*bp)); 261 + memset(bp, 0, sizeof(*bp)); 262 262 bp->signature = BUFFER_SIG; 263 263 bp->id = id; 264 264 pvr2_trace(PVR2_TRACE_BUF_POOL, 265 - "/*---TRACE_FLOW---*/ bufferInit %p stream=%p",bp,sp); 265 + "/*---TRACE_FLOW---*/ bufferInit %p stream=%p", bp, sp); 266 266 bp->stream = sp; 267 267 bp->state = pvr2_buffer_state_none; 268 268 INIT_LIST_HEAD(&bp->list_overhead); 269 - bp->purb = usb_alloc_urb(0,GFP_KERNEL); 269 + bp->purb = usb_alloc_urb(0, GFP_KERNEL); 270 270 if (! bp->purb) return -ENOMEM; 271 271 #ifdef SANITY_CHECK_BUFFERS 272 - pvr2_buffer_describe(bp,"create"); 272 + pvr2_buffer_describe(bp, "create"); 273 273 #endif 274 274 return 0; 275 275 } ··· 277 277 static void pvr2_buffer_done(struct pvr2_buffer *bp) 278 278 { 279 279 #ifdef SANITY_CHECK_BUFFERS 280 - pvr2_buffer_describe(bp,"delete"); 280 + pvr2_buffer_describe(bp, "delete"); 281 281 #endif 282 282 pvr2_buffer_wipe(bp); 283 283 pvr2_buffer_set_none(bp); ··· 288 288 bp); 289 289 } 290 290 291 - static int pvr2_stream_buffer_count(struct pvr2_stream *sp,unsigned int cnt) 291 + static int pvr2_stream_buffer_count(struct pvr2_stream *sp, unsigned int cnt) 292 292 { 293 293 int ret; 294 294 unsigned int scnt; ··· 312 312 nb = kmalloc_array(scnt, sizeof(*nb), GFP_KERNEL); 313 313 if (!nb) return -ENOMEM; 314 314 if (sp->buffer_slot_count) { 315 - memcpy(nb,sp->buffers, 315 + memcpy(nb, sp->buffers, 316 316 sp->buffer_slot_count * sizeof(*nb)); 317 317 kfree(sp->buffers); 318 318 } ··· 321 321 } 322 322 while (sp->buffer_total_count < cnt) { 323 323 struct pvr2_buffer *bp; 324 - bp = kmalloc(sizeof(*bp),GFP_KERNEL); 324 + bp = kmalloc(sizeof(*bp), GFP_KERNEL); 325 325 if (!bp) return -ENOMEM; 326 - ret = pvr2_buffer_init(bp,sp,sp->buffer_total_count); 326 + ret = pvr2_buffer_init(bp, sp, sp->buffer_total_count); 327 327 if (ret) { 328 328 kfree(bp); 329 329 return -ENOMEM; ··· 366 366 367 367 pvr2_trace(PVR2_TRACE_BUF_POOL, 368 368 "/*---TRACE_FLOW---*/ poolCheck stream=%p cur=%d tgt=%d", 369 - sp,sp->buffer_total_count,sp->buffer_target_count); 369 + sp, sp->buffer_total_count, sp->buffer_target_count); 370 370 371 371 if (sp->buffer_total_count < sp->buffer_target_count) { 372 - return pvr2_stream_buffer_count(sp,sp->buffer_target_count); 372 + return pvr2_stream_buffer_count(sp, sp->buffer_target_count); 373 373 } 374 374 375 375 cnt = 0; ··· 379 379 cnt++; 380 380 } 381 381 if (cnt) { 382 - pvr2_stream_buffer_count(sp,sp->buffer_total_count - cnt); 382 + pvr2_stream_buffer_count(sp, sp->buffer_total_count - cnt); 383 383 } 384 384 385 385 return 0; ··· 390 390 struct list_head *lp; 391 391 struct pvr2_buffer *bp1; 392 392 while ((lp = sp->queued_list.next) != &sp->queued_list) { 393 - bp1 = list_entry(lp,struct pvr2_buffer,list_overhead); 393 + bp1 = list_entry(lp, struct pvr2_buffer, list_overhead); 394 394 pvr2_buffer_wipe(bp1); 395 395 /* At this point, we should be guaranteed that no 396 396 completion callback may happen on this buffer. But it's ··· 418 418 { 419 419 mutex_lock(&sp->mutex); do { 420 420 pvr2_stream_internal_flush(sp); 421 - pvr2_stream_buffer_count(sp,0); 421 + pvr2_stream_buffer_count(sp, 0); 422 422 } while (0); mutex_unlock(&sp->mutex); 423 423 } 424 424 ··· 433 433 bp->status = 0; 434 434 pvr2_trace(PVR2_TRACE_BUF_FLOW, 435 435 "/*---TRACE_FLOW---*/ bufferComplete %p stat=%d cnt=%d", 436 - bp,urb->status,urb->actual_length); 437 - spin_lock_irqsave(&sp->list_lock,irq_flags); 436 + bp, urb->status, urb->actual_length); 437 + spin_lock_irqsave(&sp->list_lock, irq_flags); 438 438 if ((!(urb->status)) || 439 439 (urb->status == -ENOENT) || 440 440 (urb->status == -ECONNRESET) || ··· 455 455 (sp->buffers_failed)++; 456 456 pvr2_trace(PVR2_TRACE_TOLERANCE, 457 457 "stream %p ignoring error %d - fail count increased to %u", 458 - sp,urb->status,sp->fail_count); 458 + sp, urb->status, sp->fail_count); 459 459 } else { 460 460 (sp->buffers_failed)++; 461 461 bp->status = urb->status; 462 462 } 463 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 463 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 464 464 pvr2_buffer_set_ready(bp); 465 465 if (sp->callback_func) { 466 466 sp->callback_func(sp->callback_data); ··· 470 470 struct pvr2_stream *pvr2_stream_create(void) 471 471 { 472 472 struct pvr2_stream *sp; 473 - sp = kzalloc(sizeof(*sp),GFP_KERNEL); 473 + sp = kzalloc(sizeof(*sp), GFP_KERNEL); 474 474 if (!sp) return sp; 475 - pvr2_trace(PVR2_TRACE_INIT,"pvr2_stream_create: sp=%p",sp); 475 + pvr2_trace(PVR2_TRACE_INIT, "pvr2_stream_create: sp=%p", sp); 476 476 pvr2_stream_init(sp); 477 477 return sp; 478 478 } ··· 480 480 void pvr2_stream_destroy(struct pvr2_stream *sp) 481 481 { 482 482 if (!sp) return; 483 - pvr2_trace(PVR2_TRACE_INIT,"pvr2_stream_destroy: sp=%p",sp); 483 + pvr2_trace(PVR2_TRACE_INIT, "pvr2_stream_destroy: sp=%p", sp); 484 484 pvr2_stream_done(sp); 485 485 kfree(sp); 486 486 } ··· 495 495 sp->dev = dev; 496 496 sp->endpoint = endpoint; 497 497 sp->fail_tolerance = tolerance; 498 - } while(0); mutex_unlock(&sp->mutex); 498 + } while (0); mutex_unlock(&sp->mutex); 499 499 } 500 500 501 501 void pvr2_stream_set_callback(struct pvr2_stream *sp, ··· 505 505 unsigned long irq_flags; 506 506 mutex_lock(&sp->mutex); 507 507 do { 508 - spin_lock_irqsave(&sp->list_lock,irq_flags); 508 + spin_lock_irqsave(&sp->list_lock, irq_flags); 509 509 sp->callback_data = data; 510 510 sp->callback_func = func; 511 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 512 - } while(0); 511 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 512 + } while (0); 513 513 mutex_unlock(&sp->mutex); 514 514 } 515 515 ··· 518 518 int zero_counts) 519 519 { 520 520 unsigned long irq_flags; 521 - spin_lock_irqsave(&sp->list_lock,irq_flags); 521 + spin_lock_irqsave(&sp->list_lock, irq_flags); 522 522 if (stats) { 523 523 stats->buffers_in_queue = sp->q_count; 524 524 stats->buffers_in_idle = sp->i_count; ··· 532 532 sp->buffers_failed = 0; 533 533 sp->bytes_processed = 0; 534 534 } 535 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 535 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 536 536 } 537 537 538 538 /* Query / set the nominal buffer count */ ··· 541 541 return sp->buffer_target_count; 542 542 } 543 543 544 - int pvr2_stream_set_buffer_count(struct pvr2_stream *sp,unsigned int cnt) 544 + int pvr2_stream_set_buffer_count(struct pvr2_stream *sp, unsigned int cnt) 545 545 { 546 546 int ret; 547 547 if (sp->buffer_target_count == cnt) return 0; ··· 549 549 do { 550 550 sp->buffer_target_count = cnt; 551 551 ret = pvr2_stream_achieve_buffer_count(sp); 552 - } while(0); 552 + } while (0); 553 553 mutex_unlock(&sp->mutex); 554 554 return ret; 555 555 } ··· 558 558 { 559 559 struct list_head *lp = sp->idle_list.next; 560 560 if (lp == &sp->idle_list) return NULL; 561 - return list_entry(lp,struct pvr2_buffer,list_overhead); 561 + return list_entry(lp, struct pvr2_buffer, list_overhead); 562 562 } 563 563 564 564 struct pvr2_buffer *pvr2_stream_get_ready_buffer(struct pvr2_stream *sp) 565 565 { 566 566 struct list_head *lp = sp->ready_list.next; 567 567 if (lp == &sp->ready_list) return NULL; 568 - return list_entry(lp,struct pvr2_buffer,list_overhead); 568 + return list_entry(lp, struct pvr2_buffer, list_overhead); 569 569 } 570 570 571 - struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp,int id) 571 + struct pvr2_buffer *pvr2_stream_get_buffer(struct pvr2_stream *sp, int id) 572 572 { 573 573 if (id < 0) return NULL; 574 574 if (id >= sp->buffer_total_count) return NULL; ··· 592 592 if (sp->buffer_total_count != sp->buffer_target_count) { 593 593 pvr2_stream_achieve_buffer_count(sp); 594 594 } 595 - } while(0); 595 + } while (0); 596 596 mutex_unlock(&sp->mutex); 597 597 } 598 598 ··· 626 626 usb_fill_bulk_urb(bp->purb, // struct urb *urb 627 627 sp->dev, // struct usb_device *dev 628 628 // endpoint (below) 629 - usb_rcvbulkpipe(sp->dev,sp->endpoint), 629 + usb_rcvbulkpipe(sp->dev, sp->endpoint), 630 630 bp->ptr, // void *transfer_buffer 631 631 bp->max_count, // int buffer_length 632 632 buffer_complete, 633 633 bp); 634 - usb_submit_urb(bp->purb,GFP_KERNEL); 635 - } while(0); 634 + usb_submit_urb(bp->purb, GFP_KERNEL); 635 + } while (0); 636 636 mutex_unlock(&sp->mutex); 637 637 return ret; 638 638 } 639 639 640 - int pvr2_buffer_set_buffer(struct pvr2_buffer *bp,void *ptr,unsigned int cnt) 640 + int pvr2_buffer_set_buffer(struct pvr2_buffer *bp, void *ptr, unsigned int cnt) 641 641 { 642 642 int ret = 0; 643 643 unsigned long irq_flags; ··· 646 646 sp = bp->stream; 647 647 mutex_lock(&sp->mutex); 648 648 do { 649 - spin_lock_irqsave(&sp->list_lock,irq_flags); 649 + spin_lock_irqsave(&sp->list_lock, irq_flags); 650 650 if (bp->state != pvr2_buffer_state_idle) { 651 651 ret = -EPERM; 652 652 } else { ··· 658 658 "/*---TRACE_FLOW---*/ bufferPool %8s cap cap=%07d cnt=%02d", 659 659 pvr2_buffer_state_decode( 660 660 pvr2_buffer_state_idle), 661 - bp->stream->i_bcount,bp->stream->i_count); 661 + bp->stream->i_bcount, bp->stream->i_count); 662 662 } 663 - spin_unlock_irqrestore(&sp->list_lock,irq_flags); 664 - } while(0); 663 + spin_unlock_irqrestore(&sp->list_lock, irq_flags); 664 + } while (0); 665 665 mutex_unlock(&sp->mutex); 666 666 return ret; 667 667 }