aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/usbvideo
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/usbvideo')
-rw-r--r--drivers/media/video/usbvideo/ibmcam.c78
-rw-r--r--drivers/media/video/usbvideo/konicawc.c17
-rw-r--r--drivers/media/video/usbvideo/quickcam_messenger.c3
-rw-r--r--drivers/media/video/usbvideo/ultracam.c29
-rw-r--r--drivers/media/video/usbvideo/usbvideo.c166
-rw-r--r--drivers/media/video/usbvideo/vicam.c17
6 files changed, 199 insertions, 111 deletions
diff --git a/drivers/media/video/usbvideo/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c
index cc27efe121dd..28421d386f1e 100644
--- a/drivers/media/video/usbvideo/ibmcam.c
+++ b/drivers/media/video/usbvideo/ibmcam.c
@@ -258,7 +258,9 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h
258 (RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00)) 258 (RING_QUEUE_PEEK(&uvd->dp, 2) == 0x00))
259 { 259 {
260#if 0 /* This code helps to detect new frame markers */ 260#if 0 /* This code helps to detect new frame markers */
261 info("Header sig: 00 FF 00 %02X", RING_QUEUE_PEEK(&uvd->dp, 3)); 261 dev_info(&uvd->dev->dev,
262 "Header sig: 00 FF 00 %02X\n",
263 RING_QUEUE_PEEK(&uvd->dp, 3));
262#endif 264#endif
263 frame->header = RING_QUEUE_PEEK(&uvd->dp, 3); 265 frame->header = RING_QUEUE_PEEK(&uvd->dp, 3);
264 if ((frame->header == HDRSIG_MODEL1_128x96) || 266 if ((frame->header == HDRSIG_MODEL1_128x96) ||
@@ -266,7 +268,8 @@ static enum ParseState ibmcam_find_header(struct uvd *uvd) /* FIXME: Add frame h
266 (frame->header == HDRSIG_MODEL1_352x288)) 268 (frame->header == HDRSIG_MODEL1_352x288))
267 { 269 {
268#if 0 270#if 0
269 info("Header found."); 271 dev_info(&uvd->dev->dev,
272 "Header found.\n");
270#endif 273#endif
271 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 274 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
272 icam->has_hdr = 1; 275 icam->has_hdr = 1;
@@ -295,7 +298,7 @@ case IBMCAM_MODEL_4:
295 (RING_QUEUE_PEEK(&uvd->dp, 1) == 0xFF)) 298 (RING_QUEUE_PEEK(&uvd->dp, 1) == 0xFF))
296 { 299 {
297#if 0 300#if 0
298 info("Header found."); 301 dev_info(&uvd->dev->dev, "Header found.\n");
299#endif 302#endif
300 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 303 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
301 icam->has_hdr = 1; 304 icam->has_hdr = 1;
@@ -338,7 +341,7 @@ case IBMCAM_MODEL_4:
338 byte4 = RING_QUEUE_PEEK(&uvd->dp, 3); 341 byte4 = RING_QUEUE_PEEK(&uvd->dp, 3);
339 frame->header = (byte3 << 8) | byte4; 342 frame->header = (byte3 << 8) | byte4;
340#if 0 343#if 0
341 info("Header found."); 344 dev_info(&uvd->dev->dev, "Header found.\n");
342#endif 345#endif
343 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len); 346 RING_QUEUE_DEQUEUE_BYTES(&uvd->dp, marker_len);
344 icam->has_hdr = 1; 347 icam->has_hdr = 1;
@@ -354,7 +357,8 @@ case IBMCAM_MODEL_4:
354 } 357 }
355 if (!icam->has_hdr) { 358 if (!icam->has_hdr) {
356 if (uvd->debug > 2) 359 if (uvd->debug > 2)
357 info("Skipping frame, no header"); 360 dev_info(&uvd->dev->dev,
361 "Skipping frame, no header\n");
358 return scan_EndParse; 362 return scan_EndParse;
359 } 363 }
360 364
@@ -881,7 +885,9 @@ static enum ParseState ibmcam_model3_parse_lines(
881 */ 885 */
882 if ((frame->curline + 1) >= data_h) { 886 if ((frame->curline + 1) >= data_h) {
883 if (uvd->debug >= 3) 887 if (uvd->debug >= 3)
884 info("Reached line %d. (frame is done)", frame->curline); 888 dev_info(&uvd->dev->dev,
889 "Reached line %d. (frame is done)\n",
890 frame->curline);
885 return scan_NextFrame; 891 return scan_NextFrame;
886 } 892 }
887 893
@@ -954,8 +960,9 @@ static enum ParseState ibmcam_model3_parse_lines(
954 960
955 if (frame->curline >= VIDEOSIZE_Y(frame->request)) { 961 if (frame->curline >= VIDEOSIZE_Y(frame->request)) {
956 if (uvd->debug >= 3) { 962 if (uvd->debug >= 3) {
957 info("All requested lines (%ld.) done.", 963 dev_info(&uvd->dev->dev,
958 VIDEOSIZE_Y(frame->request)); 964 "All requested lines (%ld.) done.\n",
965 VIDEOSIZE_Y(frame->request));
959 } 966 }
960 return scan_NextFrame; 967 return scan_NextFrame;
961 } else 968 } else
@@ -1000,7 +1007,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines(
1000 */ 1007 */
1001 if ((frame->curline + 1) >= data_h) { 1008 if ((frame->curline + 1) >= data_h) {
1002 if (uvd->debug >= 3) 1009 if (uvd->debug >= 3)
1003 info("Reached line %d. (frame is done)", frame->curline); 1010 dev_info(&uvd->dev->dev,
1011 "Reached line %d. (frame is done)\n",
1012 frame->curline);
1004 return scan_NextFrame; 1013 return scan_NextFrame;
1005 } 1014 }
1006 1015
@@ -1049,8 +1058,9 @@ static enum ParseState ibmcam_model4_128x96_parse_lines(
1049 1058
1050 if (frame->curline >= VIDEOSIZE_Y(frame->request)) { 1059 if (frame->curline >= VIDEOSIZE_Y(frame->request)) {
1051 if (uvd->debug >= 3) { 1060 if (uvd->debug >= 3) {
1052 info("All requested lines (%ld.) done.", 1061 dev_info(&uvd->dev->dev,
1053 VIDEOSIZE_Y(frame->request)); 1062 "All requested lines (%ld.) done.\n",
1063 VIDEOSIZE_Y(frame->request));
1054 } 1064 }
1055 return scan_NextFrame; 1065 return scan_NextFrame;
1056 } else 1066 } else
@@ -1171,10 +1181,11 @@ static int ibmcam_veio(
1171 sizeof(cp), 1181 sizeof(cp),
1172 1000); 1182 1000);
1173#if 0 1183#if 0
1174 info("USB => %02x%02x%02x%02x%02x%02x%02x%02x " 1184 dev_info(&uvd->dev->dev,
1175 "(req=$%02x val=$%04x ind=$%04x)", 1185 "USB => %02x%02x%02x%02x%02x%02x%02x%02x "
1176 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], 1186 "(req=$%02x val=$%04x ind=$%04x)\n",
1177 req, value, index); 1187 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7],
1188 req, value, index);
1178#endif 1189#endif
1179 } else { 1190 } else {
1180 i = usb_control_msg( 1191 i = usb_control_msg(
@@ -1449,10 +1460,9 @@ static void ibmcam_adjust_contrast(struct uvd *uvd)
1449 */ 1460 */
1450static void ibmcam_change_lighting_conditions(struct uvd *uvd) 1461static void ibmcam_change_lighting_conditions(struct uvd *uvd)
1451{ 1462{
1452 static const char proc[] = "ibmcam_change_lighting_conditions";
1453
1454 if (debug > 0) 1463 if (debug > 0)
1455 info("%s: Set lighting to %hu.", proc, lighting); 1464 dev_info(&uvd->dev->dev,
1465 "%s: Set lighting to %hu.\n", __func__, lighting);
1456 1466
1457 switch (IBMCAM_T(uvd)->camera_model) { 1467 switch (IBMCAM_T(uvd)->camera_model) {
1458 case IBMCAM_MODEL_1: 1468 case IBMCAM_MODEL_1:
@@ -1495,8 +1505,6 @@ static void ibmcam_change_lighting_conditions(struct uvd *uvd)
1495 */ 1505 */
1496static void ibmcam_set_sharpness(struct uvd *uvd) 1506static void ibmcam_set_sharpness(struct uvd *uvd)
1497{ 1507{
1498 static const char proc[] = "ibmcam_set_sharpness";
1499
1500 switch (IBMCAM_T(uvd)->camera_model) { 1508 switch (IBMCAM_T(uvd)->camera_model) {
1501 case IBMCAM_MODEL_1: 1509 case IBMCAM_MODEL_1:
1502 { 1510 {
@@ -1505,7 +1513,8 @@ static void ibmcam_set_sharpness(struct uvd *uvd)
1505 1513
1506 RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX); 1514 RESTRICT_TO_RANGE(sharpness, SHARPNESS_MIN, SHARPNESS_MAX);
1507 if (debug > 0) 1515 if (debug > 0)
1508 info("%s: Set sharpness to %hu.", proc, sharpness); 1516 dev_info(&uvd->dev->dev, "%s: Set sharpness to %hu.\n",
1517 __func__, sharpness);
1509 1518
1510 sv = sa[sharpness - SHARPNESS_MIN]; 1519 sv = sa[sharpness - SHARPNESS_MIN];
1511 for (i=0; i < 2; i++) { 1520 for (i=0; i < 2; i++) {
@@ -1564,11 +1573,11 @@ static void ibmcam_set_sharpness(struct uvd *uvd)
1564 */ 1573 */
1565static void ibmcam_set_brightness(struct uvd *uvd) 1574static void ibmcam_set_brightness(struct uvd *uvd)
1566{ 1575{
1567 static const char proc[] = "ibmcam_set_brightness";
1568 static const unsigned short n = 1; 1576 static const unsigned short n = 1;
1569 1577
1570 if (debug > 0) 1578 if (debug > 0)
1571 info("%s: Set brightness to %hu.", proc, uvd->vpic.brightness); 1579 dev_info(&uvd->dev->dev, "%s: Set brightness to %hu.\n",
1580 __func__, uvd->vpic.brightness);
1572 1581
1573 switch (IBMCAM_T(uvd)->camera_model) { 1582 switch (IBMCAM_T(uvd)->camera_model) {
1574 case IBMCAM_MODEL_1: 1583 case IBMCAM_MODEL_1:
@@ -2115,7 +2124,8 @@ static void ibmcam_model2_setup_after_video_if(struct uvd *uvd)
2115 break; 2124 break;
2116 } 2125 }
2117 if (uvd->debug > 0) 2126 if (uvd->debug > 0)
2118 info("Framerate (hardware): %hd.", hw_fps); 2127 dev_info(&uvd->dev->dev, "Framerate (hardware): %hd.\n",
2128 hw_fps);
2119 RESTRICT_TO_RANGE(hw_fps, 0, 31); 2129 RESTRICT_TO_RANGE(hw_fps, 0, 31);
2120 ibmcam_model2_Packet1(uvd, mod2_set_framerate, hw_fps); 2130 ibmcam_model2_Packet1(uvd, mod2_set_framerate, hw_fps);
2121 } 2131 }
@@ -3487,7 +3497,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd)
3487 /* 01.01.08 - Added for RCA video in support -LO */ 3497 /* 01.01.08 - Added for RCA video in support -LO */
3488 if(init_model3_input) { 3498 if(init_model3_input) {
3489 if (debug > 0) 3499 if (debug > 0)
3490 info("Setting input to RCA."); 3500 dev_info(&uvd->dev->dev, "Setting input to RCA.\n");
3491 for (i=0; i < ARRAY_SIZE(initData); i++) { 3501 for (i=0; i < ARRAY_SIZE(initData); i++) {
3492 ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index); 3502 ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index);
3493 } 3503 }
@@ -3685,7 +3695,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3685 unsigned char video_ep = 0; 3695 unsigned char video_ep = 0;
3686 3696
3687 if (debug >= 1) 3697 if (debug >= 1)
3688 info("ibmcam_probe(%p,%u.)", intf, ifnum); 3698 dev_info(&uvd->dev->dev, "ibmcam_probe(%p,%u.)\n", intf, ifnum);
3689 3699
3690 /* We don't handle multi-config cameras */ 3700 /* We don't handle multi-config cameras */
3691 if (dev->descriptor.bNumConfigurations != 1) 3701 if (dev->descriptor.bNumConfigurations != 1)
@@ -3736,14 +3746,16 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3736 brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */ 3746 brand = "IBM PC Camera"; /* a.k.a. Xirlink C-It */
3737 break; 3747 break;
3738 } 3748 }
3739 info("%s USB camera found (model %d, rev. 0x%04x)", 3749 dev_info(&uvd->dev->dev,
3740 brand, model, le16_to_cpu(dev->descriptor.bcdDevice)); 3750 "%s USB camera found (model %d, rev. 0x%04x)\n",
3751 brand, model, le16_to_cpu(dev->descriptor.bcdDevice));
3741 } while (0); 3752 } while (0);
3742 3753
3743 /* Validate found interface: must have one ISO endpoint */ 3754 /* Validate found interface: must have one ISO endpoint */
3744 nas = intf->num_altsetting; 3755 nas = intf->num_altsetting;
3745 if (debug > 0) 3756 if (debug > 0)
3746 info("Number of alternate settings=%d.", nas); 3757 dev_info(&uvd->dev->dev, "Number of alternate settings=%d.\n",
3758 nas);
3747 if (nas < 2) { 3759 if (nas < 2) {
3748 err("Too few alternate settings for this camera!"); 3760 err("Too few alternate settings for this camera!");
3749 return -ENODEV; 3761 return -ENODEV;
@@ -3787,7 +3799,9 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3787 actInterface = i; 3799 actInterface = i;
3788 maxPS = le16_to_cpu(endpoint->wMaxPacketSize); 3800 maxPS = le16_to_cpu(endpoint->wMaxPacketSize);
3789 if (debug > 0) 3801 if (debug > 0)
3790 info("Active setting=%d. maxPS=%d.", i, maxPS); 3802 dev_info(&uvd->dev->dev,
3803 "Active setting=%d. "
3804 "maxPS=%d.\n", i, maxPS);
3791 } else 3805 } else
3792 err("More than one active alt. setting! Ignoring #%d.", i); 3806 err("More than one active alt. setting! Ignoring #%d.", i);
3793 } 3807 }
@@ -3826,7 +3840,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3826 RESTRICT_TO_RANGE(framerate, 0, 5); 3840 RESTRICT_TO_RANGE(framerate, 0, 5);
3827 break; 3841 break;
3828 default: 3842 default:
3829 info("IBM camera: using 320x240"); 3843 dev_info(&uvd->dev->dev, "IBM camera: using 320x240\n");
3830 size = SIZE_320x240; 3844 size = SIZE_320x240;
3831 /* No break here */ 3845 /* No break here */
3832 case SIZE_320x240: 3846 case SIZE_320x240:
@@ -3855,7 +3869,7 @@ static int ibmcam_probe(struct usb_interface *intf, const struct usb_device_id *
3855 canvasY = 120; 3869 canvasY = 120;
3856 break; 3870 break;
3857 default: 3871 default:
3858 info("IBM NetCamera: using 176x144"); 3872 dev_info(&uvd->dev->dev, "IBM NetCamera: using 176x144\n");
3859 size = SIZE_176x144; 3873 size = SIZE_176x144;
3860 /* No break here */ 3874 /* No break here */
3861 case SIZE_176x144: 3875 case SIZE_176x144:
diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c
index 1c180284ec6c..e986c28b7bb0 100644
--- a/drivers/media/video/usbvideo/konicawc.c
+++ b/drivers/media/video/usbvideo/konicawc.c
@@ -337,7 +337,8 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur
337 } 337 }
338 338
339 if((sts > 0x01) && (sts < 0x80)) { 339 if((sts > 0x01) && (sts < 0x80)) {
340 info("unknown status %2.2x", sts); 340 dev_info(&uvd->dev->dev, "unknown status %2.2x\n",
341 sts);
341 bad++; 342 bad++;
342 continue; 343 continue;
343 } 344 }
@@ -568,8 +569,12 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame)
568 fdrops = (0x80 + curframe - cam->lastframe) & 0x7F; 569 fdrops = (0x80 + curframe - cam->lastframe) & 0x7F;
569 fdrops--; 570 fdrops--;
570 if(fdrops) { 571 if(fdrops) {
571 info("Dropped %d frames (%d -> %d)", fdrops, 572 dev_info(&uvd->dev->dev,
572 cam->lastframe, curframe); 573 "Dropped %d frames "
574 "(%d -> %d)\n",
575 fdrops,
576 cam->lastframe,
577 curframe);
573 } 578 }
574 } 579 }
575 cam->lastframe = curframe; 580 cam->lastframe = curframe;
@@ -784,7 +789,8 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
784 if (dev->descriptor.bNumConfigurations != 1) 789 if (dev->descriptor.bNumConfigurations != 1)
785 return -ENODEV; 790 return -ENODEV;
786 791
787 info("Konica Webcam (rev. 0x%04x)", le16_to_cpu(dev->descriptor.bcdDevice)); 792 dev_info(&intf->dev, "Konica Webcam (rev. 0x%04x)\n",
793 le16_to_cpu(dev->descriptor.bcdDevice));
788 RESTRICT_TO_RANGE(speed, 0, MAX_SPEED); 794 RESTRICT_TO_RANGE(speed, 0, MAX_SPEED);
789 795
790 /* Validate found interface: must have one ISO endpoint */ 796 /* Validate found interface: must have one ISO endpoint */
@@ -925,7 +931,8 @@ static struct usb_device_id id_table[] = {
925static int __init konicawc_init(void) 931static int __init konicawc_init(void)
926{ 932{
927 struct usbvideo_cb cbTbl; 933 struct usbvideo_cb cbTbl;
928 info(DRIVER_DESC " " DRIVER_VERSION); 934 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
935 DRIVER_DESC "\n");
929 memset(&cbTbl, 0, sizeof(cbTbl)); 936 memset(&cbTbl, 0, sizeof(cbTbl));
930 cbTbl.probe = konicawc_probe; 937 cbTbl.probe = konicawc_probe;
931 cbTbl.setupOnOpen = konicawc_setup_on_open; 938 cbTbl.setupOnOpen = konicawc_setup_on_open;
diff --git a/drivers/media/video/usbvideo/quickcam_messenger.c b/drivers/media/video/usbvideo/quickcam_messenger.c
index 3d26a30abe1e..05c61b523115 100644
--- a/drivers/media/video/usbvideo/quickcam_messenger.c
+++ b/drivers/media/video/usbvideo/quickcam_messenger.c
@@ -1080,7 +1080,8 @@ static struct usbvideo_cb qcm_driver = {
1080 1080
1081static int __init qcm_init(void) 1081static int __init qcm_init(void)
1082{ 1082{
1083 info(DRIVER_DESC " " DRIVER_VERSION); 1083 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1084 DRIVER_DESC "\n");
1084 1085
1085 return usbvideo_register( 1086 return usbvideo_register(
1086 &cams, 1087 &cams,
diff --git a/drivers/media/video/usbvideo/ultracam.c b/drivers/media/video/usbvideo/ultracam.c
index 9544e644bf0d..9714baab7833 100644
--- a/drivers/media/video/usbvideo/ultracam.c
+++ b/drivers/media/video/usbvideo/ultracam.c
@@ -156,10 +156,11 @@ static int ultracam_veio(
156 sizeof(cp), 156 sizeof(cp),
157 1000); 157 1000);
158#if 1 158#if 1
159 info("USB => %02x%02x%02x%02x%02x%02x%02x%02x " 159 dev_info(&uvd->dev->dev,
160 "(req=$%02x val=$%04x ind=$%04x)", 160 "USB => %02x%02x%02x%02x%02x%02x%02x%02x "
161 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7], 161 "(req=$%02x val=$%04x ind=$%04x)\n",
162 req, value, index); 162 cp[0],cp[1],cp[2],cp[3],cp[4],cp[5],cp[6],cp[7],
163 req, value, index);
163#endif 164#endif
164 } else { 165 } else {
165 i = usb_control_msg( 166 i = usb_control_msg(
@@ -517,19 +518,20 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id
517 unsigned char video_ep = 0; 518 unsigned char video_ep = 0;
518 519
519 if (debug >= 1) 520 if (debug >= 1)
520 info("ultracam_probe(%p)", intf); 521 dev_info(&intf->dev, "ultracam_probe\n");
521 522
522 /* We don't handle multi-config cameras */ 523 /* We don't handle multi-config cameras */
523 if (dev->descriptor.bNumConfigurations != 1) 524 if (dev->descriptor.bNumConfigurations != 1)
524 return -ENODEV; 525 return -ENODEV;
525 526
526 info("IBM Ultra camera found (rev. 0x%04x)", 527 dev_info(&intf->dev, "IBM Ultra camera found (rev. 0x%04x)\n",
527 le16_to_cpu(dev->descriptor.bcdDevice)); 528 le16_to_cpu(dev->descriptor.bcdDevice));
528 529
529 /* Validate found interface: must have one ISO endpoint */ 530 /* Validate found interface: must have one ISO endpoint */
530 nas = intf->num_altsetting; 531 nas = intf->num_altsetting;
531 if (debug > 0) 532 if (debug > 0)
532 info("Number of alternate settings=%d.", nas); 533 dev_info(&intf->dev, "Number of alternate settings=%d.\n",
534 nas);
533 if (nas < 8) { 535 if (nas < 8) {
534 err("Too few alternate settings for this camera!"); 536 err("Too few alternate settings for this camera!");
535 return -ENODEV; 537 return -ENODEV;
@@ -576,7 +578,9 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id
576 actInterface = i; 578 actInterface = i;
577 maxPS = le16_to_cpu(endpoint->wMaxPacketSize); 579 maxPS = le16_to_cpu(endpoint->wMaxPacketSize);
578 if (debug > 0) 580 if (debug > 0)
579 info("Active setting=%d. maxPS=%d.", i, maxPS); 581 dev_info(&intf->dev,
582 "Active setting=%d. "
583 "maxPS=%d.\n", i, maxPS);
580 } else { 584 } else {
581 /* Got another active alt. setting */ 585 /* Got another active alt. setting */
582 if (maxPS < le16_to_cpu(endpoint->wMaxPacketSize)) { 586 if (maxPS < le16_to_cpu(endpoint->wMaxPacketSize)) {
@@ -584,8 +588,11 @@ static int ultracam_probe(struct usb_interface *intf, const struct usb_device_id
584 actInterface = i; 588 actInterface = i;
585 maxPS = le16_to_cpu(endpoint->wMaxPacketSize); 589 maxPS = le16_to_cpu(endpoint->wMaxPacketSize);
586 if (debug > 0) { 590 if (debug > 0) {
587 info("Even better ctive setting=%d. maxPS=%d.", 591 dev_info(&intf->dev,
588 i, maxPS); 592 "Even better ctive "
593 "setting=%d. "
594 "maxPS=%d.\n",
595 i, maxPS);
589 } 596 }
590 } 597 }
591 } 598 }
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c
index bf1bc2f69b02..07cd87d16f69 100644
--- a/drivers/media/video/usbvideo/usbvideo.c
+++ b/drivers/media/video/usbvideo/usbvideo.c
@@ -468,8 +468,9 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd)
468 percent = (100 * goodPackets) / allPackets; 468 percent = (100 * goodPackets) / allPackets;
469 else 469 else
470 percent = goodPackets / (allPackets / 100); 470 percent = goodPackets / (allPackets / 100);
471 info("Packet Statistics: Total=%lu. Empty=%lu. Usage=%lu%%", 471 dev_info(&uvd->dev->dev,
472 allPackets, badPackets, percent); 472 "Packet Statistics: Total=%lu. Empty=%lu. Usage=%lu%%\n",
473 allPackets, badPackets, percent);
473 if (uvd->iso_packet_len > 0) { 474 if (uvd->iso_packet_len > 0) {
474 unsigned long allBytes, xferBytes; 475 unsigned long allBytes, xferBytes;
475 char multiplier = ' '; 476 char multiplier = ' ';
@@ -497,8 +498,9 @@ static void usbvideo_ReportStatistics(const struct uvd *uvd)
497 } 498 }
498 } 499 }
499 } 500 }
500 info("Transfer Statistics: Transferred=%lu%cB Usage=%lu%%", 501 dev_info(&uvd->dev->dev,
501 xferBytes, multiplier, percent); 502 "Transfer Statistics: Transferred=%lu%cB Usage=%lu%%\n",
503 xferBytes, multiplier, percent);
502 } 504 }
503 } 505 }
504} 506}
@@ -545,7 +547,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode)
545 { /* For debugging purposes only */ 547 { /* For debugging purposes only */
546 char tmp[20]; 548 char tmp[20];
547 usbvideo_VideosizeToString(tmp, sizeof(tmp), frame->request); 549 usbvideo_VideosizeToString(tmp, sizeof(tmp), frame->request);
548 info("testpattern: frame=%s", tmp); 550 dev_info(&uvd->dev->dev, "testpattern: frame=%s\n", tmp);
549 } 551 }
550#endif 552#endif
551 /* Form every scan line */ 553 /* Form every scan line */
@@ -854,7 +856,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf)
854 856
855 usbvideo_ClientIncModCount(uvd); 857 usbvideo_ClientIncModCount(uvd);
856 if (uvd->debug > 0) 858 if (uvd->debug > 0)
857 info("%s(%p.)", __func__, intf); 859 dev_info(&intf->dev, "%s(%p.)\n", __func__, intf);
858 860
859 mutex_lock(&uvd->lock); 861 mutex_lock(&uvd->lock);
860 uvd->remove_pending = 1; /* Now all ISO data will be ignored */ 862 uvd->remove_pending = 1; /* Now all ISO data will be ignored */
@@ -870,14 +872,15 @@ static void usbvideo_Disconnect(struct usb_interface *intf)
870 872
871 video_unregister_device(&uvd->vdev); 873 video_unregister_device(&uvd->vdev);
872 if (uvd->debug > 0) 874 if (uvd->debug > 0)
873 info("%s: Video unregistered.", __func__); 875 dev_info(&intf->dev, "%s: Video unregistered.\n", __func__);
874 876
875 if (uvd->user) 877 if (uvd->user)
876 info("%s: In use, disconnect pending.", __func__); 878 dev_info(&intf->dev, "%s: In use, disconnect pending.\n",
879 __func__);
877 else 880 else
878 usbvideo_CameraRelease(uvd); 881 usbvideo_CameraRelease(uvd);
879 mutex_unlock(&uvd->lock); 882 mutex_unlock(&uvd->lock);
880 info("USB camera disconnected."); 883 dev_info(&intf->dev, "USB camera disconnected.\n");
881 884
882 usbvideo_ClientDecModCount(uvd); 885 usbvideo_ClientDecModCount(uvd);
883} 886}
@@ -1015,14 +1018,17 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd)
1015 return -EINVAL; 1018 return -EINVAL;
1016 } 1019 }
1017 if (uvd->video_endp == 0) { 1020 if (uvd->video_endp == 0) {
1018 info("%s: No video endpoint specified; data pump disabled.", __func__); 1021 dev_info(&uvd->dev->dev,
1022 "%s: No video endpoint specified; data pump disabled.\n",
1023 __func__);
1019 } 1024 }
1020 if (uvd->paletteBits == 0) { 1025 if (uvd->paletteBits == 0) {
1021 err("%s: No palettes specified!", __func__); 1026 err("%s: No palettes specified!", __func__);
1022 return -EINVAL; 1027 return -EINVAL;
1023 } 1028 }
1024 if (uvd->defaultPalette == 0) { 1029 if (uvd->defaultPalette == 0) {
1025 info("%s: No default palette!", __func__); 1030 dev_info(&uvd->dev->dev, "%s: No default palette!\n",
1031 __func__);
1026 } 1032 }
1027 1033
1028 uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) * 1034 uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) *
@@ -1031,25 +1037,29 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd)
1031 usbvideo_VideosizeToString(tmp2, sizeof(tmp2), uvd->canvas); 1037 usbvideo_VideosizeToString(tmp2, sizeof(tmp2), uvd->canvas);
1032 1038
1033 if (uvd->debug > 0) { 1039 if (uvd->debug > 0) {
1034 info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", 1040 dev_info(&uvd->dev->dev,
1035 __func__, uvd->iface, uvd->video_endp, uvd->paletteBits); 1041 "%s: iface=%d. endpoint=$%02x paletteBits=$%08lx\n",
1042 __func__, uvd->iface, uvd->video_endp,
1043 uvd->paletteBits);
1036 } 1044 }
1037 if (uvd->dev == NULL) { 1045 if (uvd->dev == NULL) {
1038 err("%s: uvd->dev == NULL", __func__); 1046 err("%s: uvd->dev == NULL", __func__);
1039 return -EINVAL; 1047 return -EINVAL;
1040 } 1048 }
1041 uvd->vdev.parent = &uvd->dev->dev; 1049 uvd->vdev.parent = &uvd->dev->dev;
1042 if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { 1050 uvd->vdev.release = video_device_release_empty;
1051 if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) < 0) {
1043 err("%s: video_register_device failed", __func__); 1052 err("%s: video_register_device failed", __func__);
1044 return -EPIPE; 1053 return -EPIPE;
1045 } 1054 }
1046 if (uvd->debug > 1) { 1055 if (uvd->debug > 1) {
1047 info("%s: video_register_device() successful", __func__); 1056 dev_info(&uvd->dev->dev,
1057 "%s: video_register_device() successful\n", __func__);
1048 } 1058 }
1049 1059
1050 info("%s on /dev/video%d: canvas=%s videosize=%s", 1060 dev_info(&uvd->dev->dev, "%s on /dev/video%d: canvas=%s videosize=%s\n",
1051 (uvd->handle != NULL) ? uvd->handle->drvName : "???", 1061 (uvd->handle != NULL) ? uvd->handle->drvName : "???",
1052 uvd->vdev.minor, tmp2, tmp1); 1062 uvd->vdev.minor, tmp2, tmp1);
1053 1063
1054 usb_get_dev(uvd->dev); 1064 usb_get_dev(uvd->dev);
1055 return 0; 1065 return 0;
@@ -1111,7 +1121,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1111 int i, errCode = 0; 1121 int i, errCode = 0;
1112 1122
1113 if (uvd->debug > 1) 1123 if (uvd->debug > 1)
1114 info("%s($%p)", __func__, dev); 1124 dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev);
1115 1125
1116 if (0 < usbvideo_ClientIncModCount(uvd)) 1126 if (0 < usbvideo_ClientIncModCount(uvd))
1117 return -ENODEV; 1127 return -ENODEV;
@@ -1178,19 +1188,25 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1178 if (errCode == 0) { 1188 if (errCode == 0) {
1179 if (VALID_CALLBACK(uvd, setupOnOpen)) { 1189 if (VALID_CALLBACK(uvd, setupOnOpen)) {
1180 if (uvd->debug > 1) 1190 if (uvd->debug > 1)
1181 info("%s: setupOnOpen callback", __func__); 1191 dev_info(&uvd->dev->dev,
1192 "%s: setupOnOpen callback\n",
1193 __func__);
1182 errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd); 1194 errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd);
1183 if (errCode < 0) { 1195 if (errCode < 0) {
1184 err("%s: setupOnOpen callback failed (%d.).", 1196 err("%s: setupOnOpen callback failed (%d.).",
1185 __func__, errCode); 1197 __func__, errCode);
1186 } else if (uvd->debug > 1) { 1198 } else if (uvd->debug > 1) {
1187 info("%s: setupOnOpen callback successful", __func__); 1199 dev_info(&uvd->dev->dev,
1200 "%s: setupOnOpen callback successful\n",
1201 __func__);
1188 } 1202 }
1189 } 1203 }
1190 if (errCode == 0) { 1204 if (errCode == 0) {
1191 uvd->settingsAdjusted = 0; 1205 uvd->settingsAdjusted = 0;
1192 if (uvd->debug > 1) 1206 if (uvd->debug > 1)
1193 info("%s: Open succeeded.", __func__); 1207 dev_info(&uvd->dev->dev,
1208 "%s: Open succeeded.\n",
1209 __func__);
1194 uvd->user++; 1210 uvd->user++;
1195 file->private_data = uvd; 1211 file->private_data = uvd;
1196 } 1212 }
@@ -1200,7 +1216,8 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file)
1200 if (errCode != 0) 1216 if (errCode != 0)
1201 usbvideo_ClientDecModCount(uvd); 1217 usbvideo_ClientDecModCount(uvd);
1202 if (uvd->debug > 0) 1218 if (uvd->debug > 0)
1203 info("%s: Returning %d.", __func__, errCode); 1219 dev_info(&uvd->dev->dev, "%s: Returning %d.\n", __func__,
1220 errCode);
1204 return errCode; 1221 return errCode;
1205} 1222}
1206 1223
@@ -1223,7 +1240,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
1223 int i; 1240 int i;
1224 1241
1225 if (uvd->debug > 1) 1242 if (uvd->debug > 1)
1226 info("%s($%p)", __func__, dev); 1243 dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, dev);
1227 1244
1228 mutex_lock(&uvd->lock); 1245 mutex_lock(&uvd->lock);
1229 GET_CALLBACK(uvd, stopDataPump)(uvd); 1246 GET_CALLBACK(uvd, stopDataPump)(uvd);
@@ -1243,14 +1260,15 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file)
1243 uvd->user--; 1260 uvd->user--;
1244 if (uvd->remove_pending) { 1261 if (uvd->remove_pending) {
1245 if (uvd->debug > 0) 1262 if (uvd->debug > 0)
1246 info("usbvideo_v4l_close: Final disconnect."); 1263 dev_info(&uvd->dev->dev, "%s: Final disconnect.\n",
1264 __func__);
1247 usbvideo_CameraRelease(uvd); 1265 usbvideo_CameraRelease(uvd);
1248 } 1266 }
1249 mutex_unlock(&uvd->lock); 1267 mutex_unlock(&uvd->lock);
1250 usbvideo_ClientDecModCount(uvd); 1268 usbvideo_ClientDecModCount(uvd);
1251 1269
1252 if (uvd->debug > 1) 1270 if (uvd->debug > 1)
1253 info("%s: Completed.", __func__); 1271 dev_info(&uvd->dev->dev, "%s: Completed.\n", __func__);
1254 file->private_data = NULL; 1272 file->private_data = NULL;
1255 return 0; 1273 return 0;
1256} 1274}
@@ -1364,8 +1382,9 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
1364 struct video_mmap *vm = arg; 1382 struct video_mmap *vm = arg;
1365 1383
1366 if (uvd->debug >= 1) { 1384 if (uvd->debug >= 1) {
1367 info("VIDIOCMCAPTURE: frame=%d. size=%dx%d, format=%d.", 1385 dev_info(&uvd->dev->dev,
1368 vm->frame, vm->width, vm->height, vm->format); 1386 "VIDIOCMCAPTURE: frame=%d. size=%dx%d, format=%d.\n",
1387 vm->frame, vm->width, vm->height, vm->format);
1369 } 1388 }
1370 /* 1389 /*
1371 * Check if the requested size is supported. If the requestor 1390 * Check if the requested size is supported. If the requestor
@@ -1383,18 +1402,24 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
1383 if ((vm->width > VIDEOSIZE_X(uvd->canvas)) || 1402 if ((vm->width > VIDEOSIZE_X(uvd->canvas)) ||
1384 (vm->height > VIDEOSIZE_Y(uvd->canvas))) { 1403 (vm->height > VIDEOSIZE_Y(uvd->canvas))) {
1385 if (uvd->debug > 0) { 1404 if (uvd->debug > 0) {
1386 info("VIDIOCMCAPTURE: Size=%dx%d too large; " 1405 dev_info(&uvd->dev->dev,
1387 "allowed only up to %ldx%ld", vm->width, vm->height, 1406 "VIDIOCMCAPTURE: Size=%dx%d "
1388 VIDEOSIZE_X(uvd->canvas), VIDEOSIZE_Y(uvd->canvas)); 1407 "too large; allowed only up "
1408 "to %ldx%ld\n", vm->width,
1409 vm->height,
1410 VIDEOSIZE_X(uvd->canvas),
1411 VIDEOSIZE_Y(uvd->canvas));
1389 } 1412 }
1390 return -EINVAL; 1413 return -EINVAL;
1391 } 1414 }
1392 /* Check if the palette is supported */ 1415 /* Check if the palette is supported */
1393 if (((1L << vm->format) & uvd->paletteBits) == 0) { 1416 if (((1L << vm->format) & uvd->paletteBits) == 0) {
1394 if (uvd->debug > 0) { 1417 if (uvd->debug > 0) {
1395 info("VIDIOCMCAPTURE: format=%d. not supported" 1418 dev_info(&uvd->dev->dev,
1396 " (paletteBits=$%08lx)", 1419 "VIDIOCMCAPTURE: format=%d. "
1397 vm->format, uvd->paletteBits); 1420 "not supported "
1421 "(paletteBits=$%08lx)\n",
1422 vm->format, uvd->paletteBits);
1398 } 1423 }
1399 return -EINVAL; 1424 return -EINVAL;
1400 } 1425 }
@@ -1422,7 +1447,9 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file,
1422 return -EINVAL; 1447 return -EINVAL;
1423 1448
1424 if (uvd->debug >= 1) 1449 if (uvd->debug >= 1)
1425 info("VIDIOCSYNC: syncing to frame %d.", *frameNum); 1450 dev_info(&uvd->dev->dev,
1451 "VIDIOCSYNC: syncing to frame %d.\n",
1452 *frameNum);
1426 if (uvd->flags & FLAGS_NO_DECODING) 1453 if (uvd->flags & FLAGS_NO_DECODING)
1427 ret = usbvideo_GetFrame(uvd, *frameNum); 1454 ret = usbvideo_GetFrame(uvd, *frameNum);
1428 else if (VALID_CALLBACK(uvd, getFrame)) { 1455 else if (VALID_CALLBACK(uvd, getFrame)) {
@@ -1504,7 +1531,9 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf,
1504 return -EFAULT; 1531 return -EFAULT;
1505 1532
1506 if (uvd->debug >= 1) 1533 if (uvd->debug >= 1)
1507 info("%s: %Zd. bytes, noblock=%d.", __func__, count, noblock); 1534 dev_info(&uvd->dev->dev,
1535 "%s: %Zd. bytes, noblock=%d.\n",
1536 __func__, count, noblock);
1508 1537
1509 mutex_lock(&uvd->lock); 1538 mutex_lock(&uvd->lock);
1510 1539
@@ -1685,18 +1714,21 @@ static void usbvideo_IsocIrq(struct urb *urb)
1685 return; 1714 return;
1686#if 0 1715#if 0
1687 if (urb->actual_length > 0) { 1716 if (urb->actual_length > 0) {
1688 info("urb=$%p status=%d. errcount=%d. length=%d.", 1717 dev_info(&uvd->dev->dev,
1689 urb, urb->status, urb->error_count, urb->actual_length); 1718 "urb=$%p status=%d. errcount=%d. length=%d.\n",
1719 urb, urb->status, urb->error_count,
1720 urb->actual_length);
1690 } else { 1721 } else {
1691 static int c = 0; 1722 static int c = 0;
1692 if (c++ % 100 == 0) 1723 if (c++ % 100 == 0)
1693 info("No Isoc data"); 1724 dev_info(&uvd->dev->dev, "No Isoc data\n");
1694 } 1725 }
1695#endif 1726#endif
1696 1727
1697 if (!uvd->streaming) { 1728 if (!uvd->streaming) {
1698 if (uvd->debug >= 1) 1729 if (uvd->debug >= 1)
1699 info("Not streaming, but interrupt!"); 1730 dev_info(&uvd->dev->dev,
1731 "Not streaming, but interrupt!\n");
1700 return; 1732 return;
1701 } 1733 }
1702 1734
@@ -1741,7 +1773,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd)
1741 int i, errFlag; 1773 int i, errFlag;
1742 1774
1743 if (uvd->debug > 1) 1775 if (uvd->debug > 1)
1744 info("%s($%p)", __func__, uvd); 1776 dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd);
1745 1777
1746 if (!CAMERA_IS_OPERATIONAL(uvd)) { 1778 if (!CAMERA_IS_OPERATIONAL(uvd)) {
1747 err("%s: Camera is not operational", __func__); 1779 err("%s: Camera is not operational", __func__);
@@ -1789,7 +1821,9 @@ static int usbvideo_StartDataPump(struct uvd *uvd)
1789 1821
1790 uvd->streaming = 1; 1822 uvd->streaming = 1;
1791 if (uvd->debug > 1) 1823 if (uvd->debug > 1)
1792 info("%s: streaming=1 video_endp=$%02x", __func__, uvd->video_endp); 1824 dev_info(&uvd->dev->dev,
1825 "%s: streaming=1 video_endp=$%02x\n", __func__,
1826 uvd->video_endp);
1793 return 0; 1827 return 0;
1794} 1828}
1795 1829
@@ -1811,14 +1845,14 @@ static void usbvideo_StopDataPump(struct uvd *uvd)
1811 return; 1845 return;
1812 1846
1813 if (uvd->debug > 1) 1847 if (uvd->debug > 1)
1814 info("%s($%p)", __func__, uvd); 1848 dev_info(&uvd->dev->dev, "%s($%p)\n", __func__, uvd);
1815 1849
1816 /* Unschedule all of the iso td's */ 1850 /* Unschedule all of the iso td's */
1817 for (i=0; i < USBVIDEO_NUMSBUF; i++) { 1851 for (i=0; i < USBVIDEO_NUMSBUF; i++) {
1818 usb_kill_urb(uvd->sbuf[i].urb); 1852 usb_kill_urb(uvd->sbuf[i].urb);
1819 } 1853 }
1820 if (uvd->debug > 1) 1854 if (uvd->debug > 1)
1821 info("%s: streaming=0", __func__); 1855 dev_info(&uvd->dev->dev, "%s: streaming=0\n", __func__);
1822 uvd->streaming = 0; 1856 uvd->streaming = 0;
1823 1857
1824 if (!uvd->remove_pending) { 1858 if (!uvd->remove_pending) {
@@ -1850,7 +1884,8 @@ static int usbvideo_NewFrame(struct uvd *uvd, int framenum)
1850 int n; 1884 int n;
1851 1885
1852 if (uvd->debug > 1) 1886 if (uvd->debug > 1)
1853 info("usbvideo_NewFrame($%p,%d.)", uvd, framenum); 1887 dev_info(&uvd->dev->dev, "usbvideo_NewFrame($%p,%d.)\n", uvd,
1888 framenum);
1854 1889
1855 /* If we're not grabbing a frame right now and the other frame is */ 1890 /* If we're not grabbing a frame right now and the other frame is */
1856 /* ready to be grabbed into, then use it instead */ 1891 /* ready to be grabbed into, then use it instead */
@@ -1955,12 +1990,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
1955 struct usbvideo_frame *frame = &uvd->frame[frameNum]; 1990 struct usbvideo_frame *frame = &uvd->frame[frameNum];
1956 1991
1957 if (uvd->debug >= 2) 1992 if (uvd->debug >= 2)
1958 info("%s($%p,%d.)", __func__, uvd, frameNum); 1993 dev_info(&uvd->dev->dev, "%s($%p,%d.)\n", __func__, uvd,
1994 frameNum);
1959 1995
1960 switch (frame->frameState) { 1996 switch (frame->frameState) {
1961 case FrameState_Unused: 1997 case FrameState_Unused:
1962 if (uvd->debug >= 2) 1998 if (uvd->debug >= 2)
1963 info("%s: FrameState_Unused", __func__); 1999 dev_info(&uvd->dev->dev, "%s: FrameState_Unused\n",
2000 __func__);
1964 return -EINVAL; 2001 return -EINVAL;
1965 case FrameState_Ready: 2002 case FrameState_Ready:
1966 case FrameState_Grabbing: 2003 case FrameState_Grabbing:
@@ -1970,7 +2007,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
1970 redo: 2007 redo:
1971 if (!CAMERA_IS_OPERATIONAL(uvd)) { 2008 if (!CAMERA_IS_OPERATIONAL(uvd)) {
1972 if (uvd->debug >= 2) 2009 if (uvd->debug >= 2)
1973 info("%s: Camera is not operational (1)", __func__); 2010 dev_info(&uvd->dev->dev,
2011 "%s: Camera is not operational (1)\n",
2012 __func__);
1974 return -EIO; 2013 return -EIO;
1975 } 2014 }
1976 ntries = 0; 2015 ntries = 0;
@@ -1979,24 +2018,33 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
1979 signalPending = signal_pending(current); 2018 signalPending = signal_pending(current);
1980 if (!CAMERA_IS_OPERATIONAL(uvd)) { 2019 if (!CAMERA_IS_OPERATIONAL(uvd)) {
1981 if (uvd->debug >= 2) 2020 if (uvd->debug >= 2)
1982 info("%s: Camera is not operational (2)", __func__); 2021 dev_info(&uvd->dev->dev,
2022 "%s: Camera is not "
2023 "operational (2)\n", __func__);
1983 return -EIO; 2024 return -EIO;
1984 } 2025 }
1985 assert(uvd->fbuf != NULL); 2026 assert(uvd->fbuf != NULL);
1986 if (signalPending) { 2027 if (signalPending) {
1987 if (uvd->debug >= 2) 2028 if (uvd->debug >= 2)
1988 info("%s: Signal=$%08x", __func__, signalPending); 2029 dev_info(&uvd->dev->dev,
2030 "%s: Signal=$%08x\n", __func__,
2031 signalPending);
1989 if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) { 2032 if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) {
1990 usbvideo_TestPattern(uvd, 1, 0); 2033 usbvideo_TestPattern(uvd, 1, 0);
1991 uvd->curframe = -1; 2034 uvd->curframe = -1;
1992 uvd->stats.frame_num++; 2035 uvd->stats.frame_num++;
1993 if (uvd->debug >= 2) 2036 if (uvd->debug >= 2)
1994 info("%s: Forced test pattern screen", __func__); 2037 dev_info(&uvd->dev->dev,
2038 "%s: Forced test "
2039 "pattern screen\n",
2040 __func__);
1995 return 0; 2041 return 0;
1996 } else { 2042 } else {
1997 /* Standard answer: Interrupted! */ 2043 /* Standard answer: Interrupted! */
1998 if (uvd->debug >= 2) 2044 if (uvd->debug >= 2)
1999 info("%s: Interrupted!", __func__); 2045 dev_info(&uvd->dev->dev,
2046 "%s: Interrupted!\n",
2047 __func__);
2000 return -EINTR; 2048 return -EINTR;
2001 } 2049 }
2002 } else { 2050 } else {
@@ -2010,8 +2058,10 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
2010 } 2058 }
2011 } while (frame->frameState == FrameState_Grabbing); 2059 } while (frame->frameState == FrameState_Grabbing);
2012 if (uvd->debug >= 2) { 2060 if (uvd->debug >= 2) {
2013 info("%s: Grabbing done; state=%d. (%lu. bytes)", 2061 dev_info(&uvd->dev->dev,
2014 __func__, frame->frameState, frame->seqRead_Length); 2062 "%s: Grabbing done; state=%d. (%lu. bytes)\n",
2063 __func__, frame->frameState,
2064 frame->seqRead_Length);
2015 } 2065 }
2016 if (frame->frameState == FrameState_Error) { 2066 if (frame->frameState == FrameState_Error) {
2017 int ret = usbvideo_NewFrame(uvd, frameNum); 2067 int ret = usbvideo_NewFrame(uvd, frameNum);
@@ -2048,7 +2098,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
2048 } 2098 }
2049 frame->frameState = FrameState_Done_Hold; 2099 frame->frameState = FrameState_Done_Hold;
2050 if (uvd->debug >= 2) 2100 if (uvd->debug >= 2)
2051 info("%s: Entered FrameState_Done_Hold state.", __func__); 2101 dev_info(&uvd->dev->dev,
2102 "%s: Entered FrameState_Done_Hold state.\n",
2103 __func__);
2052 return 0; 2104 return 0;
2053 2105
2054 case FrameState_Done_Hold: 2106 case FrameState_Done_Hold:
@@ -2059,7 +2111,9 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum)
2059 * it will be released back into the wild to roam freely. 2111 * it will be released back into the wild to roam freely.
2060 */ 2112 */
2061 if (uvd->debug >= 2) 2113 if (uvd->debug >= 2)
2062 info("%s: FrameState_Done_Hold state.", __func__); 2114 dev_info(&uvd->dev->dev,
2115 "%s: FrameState_Done_Hold state.\n",
2116 __func__);
2063 return 0; 2117 return 0;
2064 } 2118 }
2065 2119
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 2eb45829791c..7a127d6bfdee 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -472,9 +472,8 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign
472static int 472static int
473vicam_open(struct inode *inode, struct file *file) 473vicam_open(struct inode *inode, struct file *file)
474{ 474{
475 struct video_device *dev = video_devdata(file); 475 struct vicam_camera *cam = video_drvdata(file);
476 struct vicam_camera *cam = 476
477 (struct vicam_camera *) dev->priv;
478 DBG("open\n"); 477 DBG("open\n");
479 478
480 if (!cam) { 479 if (!cam) {
@@ -488,20 +487,24 @@ vicam_open(struct inode *inode, struct file *file)
488 * rely on this fact forever. 487 * rely on this fact forever.
489 */ 488 */
490 489
490 lock_kernel();
491 if (cam->open_count > 0) { 491 if (cam->open_count > 0) {
492 printk(KERN_INFO 492 printk(KERN_INFO
493 "vicam_open called on already opened camera"); 493 "vicam_open called on already opened camera");
494 unlock_kernel();
494 return -EBUSY; 495 return -EBUSY;
495 } 496 }
496 497
497 cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); 498 cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL);
498 if (!cam->raw_image) { 499 if (!cam->raw_image) {
500 unlock_kernel();
499 return -ENOMEM; 501 return -ENOMEM;
500 } 502 }
501 503
502 cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); 504 cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
503 if (!cam->framebuf) { 505 if (!cam->framebuf) {
504 kfree(cam->raw_image); 506 kfree(cam->raw_image);
507 unlock_kernel();
505 return -ENOMEM; 508 return -ENOMEM;
506 } 509 }
507 510
@@ -509,6 +512,7 @@ vicam_open(struct inode *inode, struct file *file)
509 if (!cam->cntrlbuf) { 512 if (!cam->cntrlbuf) {
510 kfree(cam->raw_image); 513 kfree(cam->raw_image);
511 rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); 514 rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES);
515 unlock_kernel();
512 return -ENOMEM; 516 return -ENOMEM;
513 } 517 }
514 518
@@ -526,6 +530,7 @@ vicam_open(struct inode *inode, struct file *file)
526 cam->open_count++; 530 cam->open_count++;
527 531
528 file->private_data = cam; 532 file->private_data = cam;
533 unlock_kernel();
529 534
530 return 0; 535 return 0;
531} 536}
@@ -795,6 +800,7 @@ static struct video_device vicam_template = {
795 .name = "ViCam-based USB Camera", 800 .name = "ViCam-based USB Camera",
796 .fops = &vicam_fops, 801 .fops = &vicam_fops,
797 .minor = -1, 802 .minor = -1,
803 .release = video_device_release_empty,
798}; 804};
799 805
800/* table of devices that work with this driver */ 806/* table of devices that work with this driver */
@@ -859,9 +865,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
859 865
860 mutex_init(&cam->cam_lock); 866 mutex_init(&cam->cam_lock);
861 867
862 memcpy(&cam->vdev, &vicam_template, 868 memcpy(&cam->vdev, &vicam_template, sizeof(vicam_template));
863 sizeof (vicam_template)); 869 video_set_drvdata(&cam->vdev, cam);
864 cam->vdev.priv = cam; // sort of a reverse mapping for those functions that get vdev only
865 870
866 cam->udev = dev; 871 cam->udev = dev;
867 cam->bulkEndpoint = bulkEndpoint; 872 cam->bulkEndpoint = bulkEndpoint;