aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zr364xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/zr364xx.c')
-rw-r--r--drivers/media/video/zr364xx.c50
1 files changed, 27 insertions, 23 deletions
diff --git a/drivers/media/video/zr364xx.c b/drivers/media/video/zr364xx.c
index 93991cb9ca71..7cdac99deea6 100644
--- a/drivers/media/video/zr364xx.c
+++ b/drivers/media/video/zr364xx.c
@@ -52,7 +52,7 @@
52 52
53 53
54/* Debug macro */ 54/* Debug macro */
55#define DBG(x...) if (debug) info(x) 55#define DBG(x...) if (debug) printk(KERN_INFO KBUILD_MODNAME x)
56 56
57 57
58/* Init methods, need to find nicer names for these 58/* Init methods, need to find nicer names for these
@@ -128,7 +128,7 @@ static int send_control_msg(struct usb_device *udev, u8 request, u16 value,
128 128
129 unsigned char *transfer_buffer = kmalloc(size, GFP_KERNEL); 129 unsigned char *transfer_buffer = kmalloc(size, GFP_KERNEL);
130 if (!transfer_buffer) { 130 if (!transfer_buffer) {
131 info("kmalloc(%d) failed", size); 131 dev_err(&udev->dev, "kmalloc(%d) failed\n", size);
132 return -ENOMEM; 132 return -ENOMEM;
133 } 133 }
134 134
@@ -144,7 +144,8 @@ static int send_control_msg(struct usb_device *udev, u8 request, u16 value,
144 kfree(transfer_buffer); 144 kfree(transfer_buffer);
145 145
146 if (status < 0) 146 if (status < 0)
147 info("Failed sending control message, error %d.", status); 147 dev_err(&udev->dev,
148 "Failed sending control message, error %d.\n", status);
148 149
149 return status; 150 return status;
150} 151}
@@ -304,11 +305,11 @@ static int read_frame(struct zr364xx_camera *cam, int framenum)
304 DBG("buffer : %d %d", cam->buffer[0], cam->buffer[1]); 305 DBG("buffer : %d %d", cam->buffer[0], cam->buffer[1]);
305 DBG("bulk : n=%d size=%d", n, actual_length); 306 DBG("bulk : n=%d size=%d", n, actual_length);
306 if (n < 0) { 307 if (n < 0) {
307 info("error reading bulk msg"); 308 dev_err(&cam->udev->dev, "error reading bulk msg\n");
308 return 0; 309 return 0;
309 } 310 }
310 if (actual_length < 0 || actual_length > BUFFER_SIZE) { 311 if (actual_length < 0 || actual_length > BUFFER_SIZE) {
311 info("wrong number of bytes"); 312 dev_err(&cam->udev->dev, "wrong number of bytes\n");
312 return 0; 313 return 0;
313 } 314 }
314 315
@@ -652,7 +653,7 @@ static int zr364xx_open(struct inode *inode, struct file *file)
652 if (!cam->framebuf) { 653 if (!cam->framebuf) {
653 cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES); 654 cam->framebuf = vmalloc_32(MAX_FRAME_SIZE * FRAMES);
654 if (!cam->framebuf) { 655 if (!cam->framebuf) {
655 info("vmalloc_32 failed!"); 656 dev_err(&cam->udev->dev, "vmalloc_32 failed!\n");
656 err = -ENOMEM; 657 err = -ENOMEM;
657 goto out; 658 goto out;
658 } 659 }
@@ -664,7 +665,8 @@ static int zr364xx_open(struct inode *inode, struct file *file)
664 0, init[cam->method][i].bytes, 665 0, init[cam->method][i].bytes,
665 init[cam->method][i].size); 666 init[cam->method][i].size);
666 if (err < 0) { 667 if (err < 0) {
667 info("error during open sequence: %d", i); 668 dev_err(&cam->udev->dev,
669 "error during open sequence: %d\n", i);
668 goto out; 670 goto out;
669 } 671 }
670 } 672 }
@@ -712,7 +714,7 @@ static int zr364xx_release(struct inode *inode, struct file *file)
712 0, init[i][cam->method].bytes, 714 0, init[i][cam->method].bytes,
713 init[cam->method][i].size); 715 init[cam->method][i].size);
714 if (err < 0) { 716 if (err < 0) {
715 info("error during release sequence"); 717 dev_err(&udev->dev, "error during release sequence\n");
716 goto out; 718 goto out;
717 } 719 }
718 } 720 }
@@ -808,13 +810,14 @@ static int zr364xx_probe(struct usb_interface *intf,
808 810
809 DBG("probing..."); 811 DBG("probing...");
810 812
811 info(DRIVER_DESC " compatible webcam plugged"); 813 dev_info(&intf->dev, DRIVER_DESC " compatible webcam plugged\n");
812 info("model %04x:%04x detected", udev->descriptor.idVendor, 814 dev_info(&intf->dev, "model %04x:%04x detected\n",
813 udev->descriptor.idProduct); 815 le16_to_cpu(udev->descriptor.idVendor),
816 le16_to_cpu(udev->descriptor.idProduct));
814 817
815 cam = kzalloc(sizeof(struct zr364xx_camera), GFP_KERNEL); 818 cam = kzalloc(sizeof(struct zr364xx_camera), GFP_KERNEL);
816 if (cam == NULL) { 819 if (cam == NULL) {
817 info("cam: out of memory !"); 820 dev_err(&udev->dev, "cam: out of memory !\n");
818 return -ENOMEM; 821 return -ENOMEM;
819 } 822 }
820 /* save the init method used by this camera */ 823 /* save the init method used by this camera */
@@ -822,7 +825,7 @@ static int zr364xx_probe(struct usb_interface *intf,
822 825
823 cam->vdev = video_device_alloc(); 826 cam->vdev = video_device_alloc();
824 if (cam->vdev == NULL) { 827 if (cam->vdev == NULL) {
825 info("cam->vdev: out of memory !"); 828 dev_err(&udev->dev, "cam->vdev: out of memory !\n");
826 kfree(cam); 829 kfree(cam);
827 return -ENOMEM; 830 return -ENOMEM;
828 } 831 }
@@ -834,7 +837,7 @@ static int zr364xx_probe(struct usb_interface *intf,
834 cam->udev = udev; 837 cam->udev = udev;
835 838
836 if ((cam->buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL)) == NULL) { 839 if ((cam->buffer = kmalloc(BUFFER_SIZE, GFP_KERNEL)) == NULL) {
837 info("cam->buffer: out of memory !"); 840 dev_info(&udev->dev, "cam->buffer: out of memory !\n");
838 video_device_release(cam->vdev); 841 video_device_release(cam->vdev);
839 kfree(cam); 842 kfree(cam);
840 return -ENODEV; 843 return -ENODEV;
@@ -842,17 +845,17 @@ static int zr364xx_probe(struct usb_interface *intf,
842 845
843 switch (mode) { 846 switch (mode) {
844 case 1: 847 case 1:
845 info("160x120 mode selected"); 848 dev_info(&udev->dev, "160x120 mode selected\n");
846 cam->width = 160; 849 cam->width = 160;
847 cam->height = 120; 850 cam->height = 120;
848 break; 851 break;
849 case 2: 852 case 2:
850 info("640x480 mode selected"); 853 dev_info(&udev->dev, "640x480 mode selected\n");
851 cam->width = 640; 854 cam->width = 640;
852 cam->height = 480; 855 cam->height = 480;
853 break; 856 break;
854 default: 857 default:
855 info("320x240 mode selected"); 858 dev_info(&udev->dev, "320x240 mode selected\n");
856 cam->width = 320; 859 cam->width = 320;
857 cam->height = 240; 860 cam->height = 240;
858 break; 861 break;
@@ -872,7 +875,7 @@ static int zr364xx_probe(struct usb_interface *intf,
872 875
873 err = video_register_device(cam->vdev, VFL_TYPE_GRABBER, -1); 876 err = video_register_device(cam->vdev, VFL_TYPE_GRABBER, -1);
874 if (err) { 877 if (err) {
875 info("video_register_device failed"); 878 dev_err(&udev->dev, "video_register_device failed\n");
876 video_device_release(cam->vdev); 879 video_device_release(cam->vdev);
877 kfree(cam->buffer); 880 kfree(cam->buffer);
878 kfree(cam); 881 kfree(cam);
@@ -881,7 +884,8 @@ static int zr364xx_probe(struct usb_interface *intf,
881 884
882 usb_set_intfdata(intf, cam); 885 usb_set_intfdata(intf, cam);
883 886
884 info(DRIVER_DESC " controlling video device %d", cam->vdev->minor); 887 dev_info(&udev->dev, DRIVER_DESC " controlling video device %d\n",
888 cam->vdev->minor);
885 return 0; 889 return 0;
886} 890}
887 891
@@ -891,7 +895,7 @@ static void zr364xx_disconnect(struct usb_interface *intf)
891 struct zr364xx_camera *cam = usb_get_intfdata(intf); 895 struct zr364xx_camera *cam = usb_get_intfdata(intf);
892 usb_set_intfdata(intf, NULL); 896 usb_set_intfdata(intf, NULL);
893 dev_set_drvdata(&intf->dev, NULL); 897 dev_set_drvdata(&intf->dev, NULL);
894 info(DRIVER_DESC " webcam unplugged"); 898 dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n");
895 if (cam->vdev) 899 if (cam->vdev)
896 video_unregister_device(cam->vdev); 900 video_unregister_device(cam->vdev);
897 cam->vdev = NULL; 901 cam->vdev = NULL;
@@ -920,16 +924,16 @@ static int __init zr364xx_init(void)
920 int retval; 924 int retval;
921 retval = usb_register(&zr364xx_driver); 925 retval = usb_register(&zr364xx_driver);
922 if (retval) 926 if (retval)
923 info("usb_register failed!"); 927 printk(KERN_ERR KBUILD_MODNAME ": usb_register failed!\n");
924 else 928 else
925 info(DRIVER_DESC " module loaded"); 929 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
926 return retval; 930 return retval;
927} 931}
928 932
929 933
930static void __exit zr364xx_exit(void) 934static void __exit zr364xx_exit(void)
931{ 935{
932 info(DRIVER_DESC " module unloaded"); 936 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC " module unloaded\n");
933 usb_deregister(&zr364xx_driver); 937 usb_deregister(&zr364xx_driver);
934} 938}
935 939