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

[media] usbvision: remove broken testpattern

Enabling force_testpattern module parameter in usbvision causes kernel panic.
Things like that does not belong to the kernel anyway so the fix is easy.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Ondrej Zary and committed by
Mauro Carvalho Chehab
59983439 240d57bb

-92
-92
drivers/media/video/usbvision/usbvision-core.c
··· 49 49 module_param(core_debug, int, 0644); 50 50 MODULE_PARM_DESC(core_debug, "enable debug messages [core]"); 51 51 52 - static unsigned int force_testpattern; 53 - module_param(force_testpattern, int, 0644); 54 - MODULE_PARM_DESC(force_testpattern, "enable test pattern display [core]"); 55 - 56 52 static int adjust_compression = 1; /* Set the compression to be adaptive */ 57 53 module_param(adjust_compression, int, 0444); 58 54 MODULE_PARM_DESC(adjust_compression, " Set the ADPCM compression for the device. Default: 1 (On)"); ··· 384 388 } 385 389 386 390 /* 387 - * usbvision_testpattern() 388 - * 389 - * Procedure forms a test pattern (yellow grid on blue background). 390 - * 391 - * Parameters: 392 - * fullframe: if TRUE then entire frame is filled, otherwise the procedure 393 - * continues from the current scanline. 394 - * pmode 0: fill the frame with solid blue color (like on VCR or TV) 395 - * 1: Draw a colored grid 396 - * 397 - */ 398 - static void usbvision_testpattern(struct usb_usbvision *usbvision, 399 - int fullframe, int pmode) 400 - { 401 - static const char proc[] = "usbvision_testpattern"; 402 - struct usbvision_frame *frame; 403 - unsigned char *f; 404 - int num_cell = 0; 405 - int scan_length = 0; 406 - static int num_pass; 407 - 408 - if (usbvision == NULL) { 409 - printk(KERN_ERR "%s: usbvision == NULL\n", proc); 410 - return; 411 - } 412 - if (usbvision->cur_frame == NULL) { 413 - printk(KERN_ERR "%s: usbvision->cur_frame is NULL.\n", proc); 414 - return; 415 - } 416 - 417 - /* Grab the current frame */ 418 - frame = usbvision->cur_frame; 419 - 420 - /* Optionally start at the beginning */ 421 - if (fullframe) { 422 - frame->curline = 0; 423 - frame->scanlength = 0; 424 - } 425 - 426 - /* Form every scan line */ 427 - for (; frame->curline < frame->frmheight; frame->curline++) { 428 - int i; 429 - 430 - f = frame->data + (usbvision->curwidth * 3 * frame->curline); 431 - for (i = 0; i < usbvision->curwidth; i++) { 432 - unsigned char cb = 0x80; 433 - unsigned char cg = 0; 434 - unsigned char cr = 0; 435 - 436 - if (pmode == 1) { 437 - if (frame->curline % 32 == 0) 438 - cb = 0, cg = cr = 0xFF; 439 - else if (i % 32 == 0) { 440 - if (frame->curline % 32 == 1) 441 - num_cell++; 442 - cb = 0, cg = cr = 0xFF; 443 - } else { 444 - cb = 445 - ((num_cell * 7) + 446 - num_pass) & 0xFF; 447 - cg = 448 - ((num_cell * 5) + 449 - num_pass * 2) & 0xFF; 450 - cr = 451 - ((num_cell * 3) + 452 - num_pass * 3) & 0xFF; 453 - } 454 - } else { 455 - /* Just the blue screen */ 456 - } 457 - 458 - *f++ = cb; 459 - *f++ = cg; 460 - *f++ = cr; 461 - scan_length += 3; 462 - } 463 - } 464 - 465 - frame->grabstate = frame_state_done; 466 - frame->scanlength += scan_length; 467 - ++num_pass; 468 - } 469 - 470 - /* 471 391 * usbvision_decompress_alloc() 472 392 * 473 393 * allocates intermediate buffer for decompression ··· 483 571 frame->scanstate = scan_state_lines; 484 572 frame->curline = 0; 485 573 486 - if (force_testpattern) { 487 - usbvision_testpattern(usbvision, 1, 1); 488 - return parse_state_next_frame; 489 - } 490 574 return parse_state_continue; 491 575 } 492 576