diff options
Diffstat (limited to 'drivers/media/video/usbvideo/usbvideo.c')
-rw-r--r-- | drivers/media/video/usbvideo/usbvideo.c | 148 |
1 files changed, 75 insertions, 73 deletions
diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 5d363be7bc73..4128ee20b64e 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c | |||
@@ -522,14 +522,14 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) | |||
522 | struct usbvideo_frame *frame; | 522 | struct usbvideo_frame *frame; |
523 | int num_cell = 0; | 523 | int num_cell = 0; |
524 | int scan_length = 0; | 524 | int scan_length = 0; |
525 | static int num_pass = 0; | 525 | static int num_pass; |
526 | 526 | ||
527 | if (uvd == NULL) { | 527 | if (uvd == NULL) { |
528 | err("%s: uvd == NULL", __FUNCTION__); | 528 | err("%s: uvd == NULL", __func__); |
529 | return; | 529 | return; |
530 | } | 530 | } |
531 | if ((uvd->curframe < 0) || (uvd->curframe >= USBVIDEO_NUMFRAMES)) { | 531 | if ((uvd->curframe < 0) || (uvd->curframe >= USBVIDEO_NUMFRAMES)) { |
532 | err("%s: uvd->curframe=%d.", __FUNCTION__, uvd->curframe); | 532 | err("%s: uvd->curframe=%d.", __func__, uvd->curframe); |
533 | return; | 533 | return; |
534 | } | 534 | } |
535 | 535 | ||
@@ -630,15 +630,15 @@ EXPORT_SYMBOL(usbvideo_HexDump); | |||
630 | static int usbvideo_ClientIncModCount(struct uvd *uvd) | 630 | static int usbvideo_ClientIncModCount(struct uvd *uvd) |
631 | { | 631 | { |
632 | if (uvd == NULL) { | 632 | if (uvd == NULL) { |
633 | err("%s: uvd == NULL", __FUNCTION__); | 633 | err("%s: uvd == NULL", __func__); |
634 | return -EINVAL; | 634 | return -EINVAL; |
635 | } | 635 | } |
636 | if (uvd->handle == NULL) { | 636 | if (uvd->handle == NULL) { |
637 | err("%s: uvd->handle == NULL", __FUNCTION__); | 637 | err("%s: uvd->handle == NULL", __func__); |
638 | return -EINVAL; | 638 | return -EINVAL; |
639 | } | 639 | } |
640 | if (!try_module_get(uvd->handle->md_module)) { | 640 | if (!try_module_get(uvd->handle->md_module)) { |
641 | err("%s: try_module_get() == 0", __FUNCTION__); | 641 | err("%s: try_module_get() == 0", __func__); |
642 | return -ENODEV; | 642 | return -ENODEV; |
643 | } | 643 | } |
644 | return 0; | 644 | return 0; |
@@ -647,15 +647,15 @@ static int usbvideo_ClientIncModCount(struct uvd *uvd) | |||
647 | static void usbvideo_ClientDecModCount(struct uvd *uvd) | 647 | static void usbvideo_ClientDecModCount(struct uvd *uvd) |
648 | { | 648 | { |
649 | if (uvd == NULL) { | 649 | if (uvd == NULL) { |
650 | err("%s: uvd == NULL", __FUNCTION__); | 650 | err("%s: uvd == NULL", __func__); |
651 | return; | 651 | return; |
652 | } | 652 | } |
653 | if (uvd->handle == NULL) { | 653 | if (uvd->handle == NULL) { |
654 | err("%s: uvd->handle == NULL", __FUNCTION__); | 654 | err("%s: uvd->handle == NULL", __func__); |
655 | return; | 655 | return; |
656 | } | 656 | } |
657 | if (uvd->handle->md_module == NULL) { | 657 | if (uvd->handle->md_module == NULL) { |
658 | err("%s: uvd->handle->md_module == NULL", __FUNCTION__); | 658 | err("%s: uvd->handle->md_module == NULL", __func__); |
659 | return; | 659 | return; |
660 | } | 660 | } |
661 | module_put(uvd->handle->md_module); | 661 | module_put(uvd->handle->md_module); |
@@ -675,13 +675,13 @@ int usbvideo_register( | |||
675 | 675 | ||
676 | /* Check parameters for sanity */ | 676 | /* Check parameters for sanity */ |
677 | if ((num_cams <= 0) || (pCams == NULL) || (cbTbl == NULL)) { | 677 | if ((num_cams <= 0) || (pCams == NULL) || (cbTbl == NULL)) { |
678 | err("%s: Illegal call", __FUNCTION__); | 678 | err("%s: Illegal call", __func__); |
679 | return -EINVAL; | 679 | return -EINVAL; |
680 | } | 680 | } |
681 | 681 | ||
682 | /* Check registration callback - must be set! */ | 682 | /* Check registration callback - must be set! */ |
683 | if (cbTbl->probe == NULL) { | 683 | if (cbTbl->probe == NULL) { |
684 | err("%s: probe() is required!", __FUNCTION__); | 684 | err("%s: probe() is required!", __func__); |
685 | return -EINVAL; | 685 | return -EINVAL; |
686 | } | 686 | } |
687 | 687 | ||
@@ -692,7 +692,7 @@ int usbvideo_register( | |||
692 | return -ENOMEM; | 692 | return -ENOMEM; |
693 | } | 693 | } |
694 | dbg("%s: Allocated $%p (%d. bytes) for %d. cameras", | 694 | dbg("%s: Allocated $%p (%d. bytes) for %d. cameras", |
695 | __FUNCTION__, cams, base_size, num_cams); | 695 | __func__, cams, base_size, num_cams); |
696 | 696 | ||
697 | /* Copy callbacks, apply defaults for those that are not set */ | 697 | /* Copy callbacks, apply defaults for those that are not set */ |
698 | memmove(&cams->cb, cbTbl, sizeof(cams->cb)); | 698 | memmove(&cams->cb, cbTbl, sizeof(cams->cb)); |
@@ -721,7 +721,7 @@ int usbvideo_register( | |||
721 | up->user_data = kmalloc(up->user_size, GFP_KERNEL); | 721 | up->user_data = kmalloc(up->user_size, GFP_KERNEL); |
722 | if (up->user_data == NULL) { | 722 | if (up->user_data == NULL) { |
723 | err("%s: Failed to allocate user_data (%d. bytes)", | 723 | err("%s: Failed to allocate user_data (%d. bytes)", |
724 | __FUNCTION__, up->user_size); | 724 | __func__, up->user_size); |
725 | while (i) { | 725 | while (i) { |
726 | up = &cams->cam[--i]; | 726 | up = &cams->cam[--i]; |
727 | kfree(up->user_data); | 727 | kfree(up->user_data); |
@@ -730,7 +730,7 @@ int usbvideo_register( | |||
730 | return -ENOMEM; | 730 | return -ENOMEM; |
731 | } | 731 | } |
732 | dbg("%s: Allocated cams[%d].user_data=$%p (%d. bytes)", | 732 | dbg("%s: Allocated cams[%d].user_data=$%p (%d. bytes)", |
733 | __FUNCTION__, i, up->user_data, up->user_size); | 733 | __func__, i, up->user_data, up->user_size); |
734 | } | 734 | } |
735 | } | 735 | } |
736 | 736 | ||
@@ -776,19 +776,19 @@ void usbvideo_Deregister(struct usbvideo **pCams) | |||
776 | int i; | 776 | int i; |
777 | 777 | ||
778 | if (pCams == NULL) { | 778 | if (pCams == NULL) { |
779 | err("%s: pCams == NULL", __FUNCTION__); | 779 | err("%s: pCams == NULL", __func__); |
780 | return; | 780 | return; |
781 | } | 781 | } |
782 | cams = *pCams; | 782 | cams = *pCams; |
783 | if (cams == NULL) { | 783 | if (cams == NULL) { |
784 | err("%s: cams == NULL", __FUNCTION__); | 784 | err("%s: cams == NULL", __func__); |
785 | return; | 785 | return; |
786 | } | 786 | } |
787 | 787 | ||
788 | dbg("%s: Deregistering %s driver.", __FUNCTION__, cams->drvName); | 788 | dbg("%s: Deregistering %s driver.", __func__, cams->drvName); |
789 | usb_deregister(&cams->usbdrv); | 789 | usb_deregister(&cams->usbdrv); |
790 | 790 | ||
791 | dbg("%s: Deallocating cams=$%p (%d. cameras)", __FUNCTION__, cams, cams->num_cameras); | 791 | dbg("%s: Deallocating cams=$%p (%d. cameras)", __func__, cams, cams->num_cameras); |
792 | for (i=0; i < cams->num_cameras; i++) { | 792 | for (i=0; i < cams->num_cameras; i++) { |
793 | struct uvd *up = &cams->cam[i]; | 793 | struct uvd *up = &cams->cam[i]; |
794 | int warning = 0; | 794 | int warning = 0; |
@@ -802,16 +802,16 @@ void usbvideo_Deregister(struct usbvideo **pCams) | |||
802 | } | 802 | } |
803 | if (warning) { | 803 | if (warning) { |
804 | err("%s: Warning: user_data=$%p user_size=%d.", | 804 | err("%s: Warning: user_data=$%p user_size=%d.", |
805 | __FUNCTION__, up->user_data, up->user_size); | 805 | __func__, up->user_data, up->user_size); |
806 | } else { | 806 | } else { |
807 | dbg("%s: Freeing %d. $%p->user_data=$%p", | 807 | dbg("%s: Freeing %d. $%p->user_data=$%p", |
808 | __FUNCTION__, i, up, up->user_data); | 808 | __func__, i, up, up->user_data); |
809 | kfree(up->user_data); | 809 | kfree(up->user_data); |
810 | } | 810 | } |
811 | } | 811 | } |
812 | /* Whole array was allocated in one chunk */ | 812 | /* Whole array was allocated in one chunk */ |
813 | dbg("%s: Freed %d uvd structures", | 813 | dbg("%s: Freed %d uvd structures", |
814 | __FUNCTION__, cams->num_cameras); | 814 | __func__, cams->num_cameras); |
815 | kfree(cams); | 815 | kfree(cams); |
816 | *pCams = NULL; | 816 | *pCams = NULL; |
817 | } | 817 | } |
@@ -846,7 +846,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf) | |||
846 | int i; | 846 | int i; |
847 | 847 | ||
848 | if (uvd == NULL) { | 848 | if (uvd == NULL) { |
849 | err("%s($%p): Illegal call.", __FUNCTION__, intf); | 849 | err("%s($%p): Illegal call.", __func__, intf); |
850 | return; | 850 | return; |
851 | } | 851 | } |
852 | 852 | ||
@@ -854,7 +854,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf) | |||
854 | 854 | ||
855 | usbvideo_ClientIncModCount(uvd); | 855 | usbvideo_ClientIncModCount(uvd); |
856 | if (uvd->debug > 0) | 856 | if (uvd->debug > 0) |
857 | info("%s(%p.)", __FUNCTION__, intf); | 857 | info("%s(%p.)", __func__, intf); |
858 | 858 | ||
859 | mutex_lock(&uvd->lock); | 859 | mutex_lock(&uvd->lock); |
860 | uvd->remove_pending = 1; /* Now all ISO data will be ignored */ | 860 | uvd->remove_pending = 1; /* Now all ISO data will be ignored */ |
@@ -870,10 +870,10 @@ static void usbvideo_Disconnect(struct usb_interface *intf) | |||
870 | 870 | ||
871 | video_unregister_device(&uvd->vdev); | 871 | video_unregister_device(&uvd->vdev); |
872 | if (uvd->debug > 0) | 872 | if (uvd->debug > 0) |
873 | info("%s: Video unregistered.", __FUNCTION__); | 873 | info("%s: Video unregistered.", __func__); |
874 | 874 | ||
875 | if (uvd->user) | 875 | if (uvd->user) |
876 | info("%s: In use, disconnect pending.", __FUNCTION__); | 876 | info("%s: In use, disconnect pending.", __func__); |
877 | else | 877 | else |
878 | usbvideo_CameraRelease(uvd); | 878 | usbvideo_CameraRelease(uvd); |
879 | mutex_unlock(&uvd->lock); | 879 | mutex_unlock(&uvd->lock); |
@@ -895,7 +895,7 @@ static void usbvideo_Disconnect(struct usb_interface *intf) | |||
895 | static void usbvideo_CameraRelease(struct uvd *uvd) | 895 | static void usbvideo_CameraRelease(struct uvd *uvd) |
896 | { | 896 | { |
897 | if (uvd == NULL) { | 897 | if (uvd == NULL) { |
898 | err("%s: Illegal call", __FUNCTION__); | 898 | err("%s: Illegal call", __func__); |
899 | return; | 899 | return; |
900 | } | 900 | } |
901 | 901 | ||
@@ -946,7 +946,9 @@ static const struct file_operations usbvideo_fops = { | |||
946 | .read = usbvideo_v4l_read, | 946 | .read = usbvideo_v4l_read, |
947 | .mmap = usbvideo_v4l_mmap, | 947 | .mmap = usbvideo_v4l_mmap, |
948 | .ioctl = usbvideo_v4l_ioctl, | 948 | .ioctl = usbvideo_v4l_ioctl, |
949 | #ifdef CONFIG_COMPAT | ||
949 | .compat_ioctl = v4l_compat_ioctl32, | 950 | .compat_ioctl = v4l_compat_ioctl32, |
951 | #endif | ||
950 | .llseek = no_llseek, | 952 | .llseek = no_llseek, |
951 | }; | 953 | }; |
952 | static const struct video_device usbvideo_template = { | 954 | static const struct video_device usbvideo_template = { |
@@ -1011,18 +1013,18 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1011 | char tmp1[20], tmp2[20]; /* Buffers for printing */ | 1013 | char tmp1[20], tmp2[20]; /* Buffers for printing */ |
1012 | 1014 | ||
1013 | if (uvd == NULL) { | 1015 | if (uvd == NULL) { |
1014 | err("%s: Illegal call.", __FUNCTION__); | 1016 | err("%s: Illegal call.", __func__); |
1015 | return -EINVAL; | 1017 | return -EINVAL; |
1016 | } | 1018 | } |
1017 | if (uvd->video_endp == 0) { | 1019 | if (uvd->video_endp == 0) { |
1018 | info("%s: No video endpoint specified; data pump disabled.", __FUNCTION__); | 1020 | info("%s: No video endpoint specified; data pump disabled.", __func__); |
1019 | } | 1021 | } |
1020 | if (uvd->paletteBits == 0) { | 1022 | if (uvd->paletteBits == 0) { |
1021 | err("%s: No palettes specified!", __FUNCTION__); | 1023 | err("%s: No palettes specified!", __func__); |
1022 | return -EINVAL; | 1024 | return -EINVAL; |
1023 | } | 1025 | } |
1024 | if (uvd->defaultPalette == 0) { | 1026 | if (uvd->defaultPalette == 0) { |
1025 | info("%s: No default palette!", __FUNCTION__); | 1027 | info("%s: No default palette!", __func__); |
1026 | } | 1028 | } |
1027 | 1029 | ||
1028 | uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) * | 1030 | uvd->max_frame_size = VIDEOSIZE_X(uvd->canvas) * |
@@ -1032,19 +1034,19 @@ int usbvideo_RegisterVideoDevice(struct uvd *uvd) | |||
1032 | 1034 | ||
1033 | if (uvd->debug > 0) { | 1035 | if (uvd->debug > 0) { |
1034 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", | 1036 | info("%s: iface=%d. endpoint=$%02x paletteBits=$%08lx", |
1035 | __FUNCTION__, uvd->iface, uvd->video_endp, uvd->paletteBits); | 1037 | __func__, uvd->iface, uvd->video_endp, uvd->paletteBits); |
1036 | } | 1038 | } |
1037 | if (uvd->dev == NULL) { | 1039 | if (uvd->dev == NULL) { |
1038 | err("%s: uvd->dev == NULL", __FUNCTION__); | 1040 | err("%s: uvd->dev == NULL", __func__); |
1039 | return -EINVAL; | 1041 | return -EINVAL; |
1040 | } | 1042 | } |
1041 | uvd->vdev.dev=&(uvd->dev->dev); | 1043 | uvd->vdev.dev = &uvd->dev->dev; |
1042 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 1044 | if (video_register_device(&uvd->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { |
1043 | err("%s: video_register_device failed", __FUNCTION__); | 1045 | err("%s: video_register_device failed", __func__); |
1044 | return -EPIPE; | 1046 | return -EPIPE; |
1045 | } | 1047 | } |
1046 | if (uvd->debug > 1) { | 1048 | if (uvd->debug > 1) { |
1047 | info("%s: video_register_device() successful", __FUNCTION__); | 1049 | info("%s: video_register_device() successful", __func__); |
1048 | } | 1050 | } |
1049 | 1051 | ||
1050 | info("%s on /dev/video%d: canvas=%s videosize=%s", | 1052 | info("%s on /dev/video%d: canvas=%s videosize=%s", |
@@ -1111,14 +1113,14 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) | |||
1111 | int i, errCode = 0; | 1113 | int i, errCode = 0; |
1112 | 1114 | ||
1113 | if (uvd->debug > 1) | 1115 | if (uvd->debug > 1) |
1114 | info("%s($%p)", __FUNCTION__, dev); | 1116 | info("%s($%p)", __func__, dev); |
1115 | 1117 | ||
1116 | if (0 < usbvideo_ClientIncModCount(uvd)) | 1118 | if (0 < usbvideo_ClientIncModCount(uvd)) |
1117 | return -ENODEV; | 1119 | return -ENODEV; |
1118 | mutex_lock(&uvd->lock); | 1120 | mutex_lock(&uvd->lock); |
1119 | 1121 | ||
1120 | if (uvd->user) { | 1122 | if (uvd->user) { |
1121 | err("%s: Someone tried to open an already opened device!", __FUNCTION__); | 1123 | err("%s: Someone tried to open an already opened device!", __func__); |
1122 | errCode = -EBUSY; | 1124 | errCode = -EBUSY; |
1123 | } else { | 1125 | } else { |
1124 | /* Clear statistics */ | 1126 | /* Clear statistics */ |
@@ -1134,7 +1136,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) | |||
1134 | RingQueue_Allocate(&uvd->dp, RING_QUEUE_SIZE); | 1136 | RingQueue_Allocate(&uvd->dp, RING_QUEUE_SIZE); |
1135 | if ((uvd->fbuf == NULL) || | 1137 | if ((uvd->fbuf == NULL) || |
1136 | (!RingQueue_IsAllocated(&uvd->dp))) { | 1138 | (!RingQueue_IsAllocated(&uvd->dp))) { |
1137 | err("%s: Failed to allocate fbuf or dp", __FUNCTION__); | 1139 | err("%s: Failed to allocate fbuf or dp", __func__); |
1138 | errCode = -ENOMEM; | 1140 | errCode = -ENOMEM; |
1139 | } else { | 1141 | } else { |
1140 | /* Allocate all buffers */ | 1142 | /* Allocate all buffers */ |
@@ -1178,19 +1180,19 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) | |||
1178 | if (errCode == 0) { | 1180 | if (errCode == 0) { |
1179 | if (VALID_CALLBACK(uvd, setupOnOpen)) { | 1181 | if (VALID_CALLBACK(uvd, setupOnOpen)) { |
1180 | if (uvd->debug > 1) | 1182 | if (uvd->debug > 1) |
1181 | info("%s: setupOnOpen callback", __FUNCTION__); | 1183 | info("%s: setupOnOpen callback", __func__); |
1182 | errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd); | 1184 | errCode = GET_CALLBACK(uvd, setupOnOpen)(uvd); |
1183 | if (errCode < 0) { | 1185 | if (errCode < 0) { |
1184 | err("%s: setupOnOpen callback failed (%d.).", | 1186 | err("%s: setupOnOpen callback failed (%d.).", |
1185 | __FUNCTION__, errCode); | 1187 | __func__, errCode); |
1186 | } else if (uvd->debug > 1) { | 1188 | } else if (uvd->debug > 1) { |
1187 | info("%s: setupOnOpen callback successful", __FUNCTION__); | 1189 | info("%s: setupOnOpen callback successful", __func__); |
1188 | } | 1190 | } |
1189 | } | 1191 | } |
1190 | if (errCode == 0) { | 1192 | if (errCode == 0) { |
1191 | uvd->settingsAdjusted = 0; | 1193 | uvd->settingsAdjusted = 0; |
1192 | if (uvd->debug > 1) | 1194 | if (uvd->debug > 1) |
1193 | info("%s: Open succeeded.", __FUNCTION__); | 1195 | info("%s: Open succeeded.", __func__); |
1194 | uvd->user++; | 1196 | uvd->user++; |
1195 | file->private_data = uvd; | 1197 | file->private_data = uvd; |
1196 | } | 1198 | } |
@@ -1200,7 +1202,7 @@ static int usbvideo_v4l_open(struct inode *inode, struct file *file) | |||
1200 | if (errCode != 0) | 1202 | if (errCode != 0) |
1201 | usbvideo_ClientDecModCount(uvd); | 1203 | usbvideo_ClientDecModCount(uvd); |
1202 | if (uvd->debug > 0) | 1204 | if (uvd->debug > 0) |
1203 | info("%s: Returning %d.", __FUNCTION__, errCode); | 1205 | info("%s: Returning %d.", __func__, errCode); |
1204 | return errCode; | 1206 | return errCode; |
1205 | } | 1207 | } |
1206 | 1208 | ||
@@ -1223,7 +1225,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) | |||
1223 | int i; | 1225 | int i; |
1224 | 1226 | ||
1225 | if (uvd->debug > 1) | 1227 | if (uvd->debug > 1) |
1226 | info("%s($%p)", __FUNCTION__, dev); | 1228 | info("%s($%p)", __func__, dev); |
1227 | 1229 | ||
1228 | mutex_lock(&uvd->lock); | 1230 | mutex_lock(&uvd->lock); |
1229 | GET_CALLBACK(uvd, stopDataPump)(uvd); | 1231 | GET_CALLBACK(uvd, stopDataPump)(uvd); |
@@ -1250,7 +1252,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) | |||
1250 | usbvideo_ClientDecModCount(uvd); | 1252 | usbvideo_ClientDecModCount(uvd); |
1251 | 1253 | ||
1252 | if (uvd->debug > 1) | 1254 | if (uvd->debug > 1) |
1253 | info("%s: Completed.", __FUNCTION__); | 1255 | info("%s: Completed.", __func__); |
1254 | file->private_data = NULL; | 1256 | file->private_data = NULL; |
1255 | return 0; | 1257 | return 0; |
1256 | } | 1258 | } |
@@ -1504,7 +1506,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, | |||
1504 | return -EFAULT; | 1506 | return -EFAULT; |
1505 | 1507 | ||
1506 | if (uvd->debug >= 1) | 1508 | if (uvd->debug >= 1) |
1507 | info("%s: %Zd. bytes, noblock=%d.", __FUNCTION__, count, noblock); | 1509 | info("%s: %Zd. bytes, noblock=%d.", __func__, count, noblock); |
1508 | 1510 | ||
1509 | mutex_lock(&uvd->lock); | 1511 | mutex_lock(&uvd->lock); |
1510 | 1512 | ||
@@ -1551,7 +1553,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, | |||
1551 | */ | 1553 | */ |
1552 | if (frmx == -1) { | 1554 | if (frmx == -1) { |
1553 | if (uvd->defaultPalette == 0) { | 1555 | if (uvd->defaultPalette == 0) { |
1554 | err("%s: No default palette; don't know what to do!", __FUNCTION__); | 1556 | err("%s: No default palette; don't know what to do!", __func__); |
1555 | count = -EFAULT; | 1557 | count = -EFAULT; |
1556 | goto read_done; | 1558 | goto read_done; |
1557 | } | 1559 | } |
@@ -1623,7 +1625,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, | |||
1623 | frame->seqRead_Index += count; | 1625 | frame->seqRead_Index += count; |
1624 | if (uvd->debug >= 1) { | 1626 | if (uvd->debug >= 1) { |
1625 | err("%s: {copy} count used=%Zd, new seqRead_Index=%ld", | 1627 | err("%s: {copy} count used=%Zd, new seqRead_Index=%ld", |
1626 | __FUNCTION__, count, frame->seqRead_Index); | 1628 | __func__, count, frame->seqRead_Index); |
1627 | } | 1629 | } |
1628 | 1630 | ||
1629 | /* Finally check if the frame is done with and "release" it */ | 1631 | /* Finally check if the frame is done with and "release" it */ |
@@ -1634,7 +1636,7 @@ static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, | |||
1634 | /* Mark it as available to be used again. */ | 1636 | /* Mark it as available to be used again. */ |
1635 | uvd->frame[frmx].frameState = FrameState_Unused; | 1637 | uvd->frame[frmx].frameState = FrameState_Unused; |
1636 | if (usbvideo_NewFrame(uvd, (frmx + 1) % USBVIDEO_NUMFRAMES)) { | 1638 | if (usbvideo_NewFrame(uvd, (frmx + 1) % USBVIDEO_NUMFRAMES)) { |
1637 | err("%s: usbvideo_NewFrame failed.", __FUNCTION__); | 1639 | err("%s: usbvideo_NewFrame failed.", __func__); |
1638 | } | 1640 | } |
1639 | } | 1641 | } |
1640 | read_done: | 1642 | read_done: |
@@ -1741,10 +1743,10 @@ static int usbvideo_StartDataPump(struct uvd *uvd) | |||
1741 | int i, errFlag; | 1743 | int i, errFlag; |
1742 | 1744 | ||
1743 | if (uvd->debug > 1) | 1745 | if (uvd->debug > 1) |
1744 | info("%s($%p)", __FUNCTION__, uvd); | 1746 | info("%s($%p)", __func__, uvd); |
1745 | 1747 | ||
1746 | if (!CAMERA_IS_OPERATIONAL(uvd)) { | 1748 | if (!CAMERA_IS_OPERATIONAL(uvd)) { |
1747 | err("%s: Camera is not operational", __FUNCTION__); | 1749 | err("%s: Camera is not operational", __func__); |
1748 | return -EFAULT; | 1750 | return -EFAULT; |
1749 | } | 1751 | } |
1750 | uvd->curframe = -1; | 1752 | uvd->curframe = -1; |
@@ -1752,14 +1754,14 @@ static int usbvideo_StartDataPump(struct uvd *uvd) | |||
1752 | /* Alternate interface 1 is is the biggest frame size */ | 1754 | /* Alternate interface 1 is is the biggest frame size */ |
1753 | i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive); | 1755 | i = usb_set_interface(dev, uvd->iface, uvd->ifaceAltActive); |
1754 | if (i < 0) { | 1756 | if (i < 0) { |
1755 | err("%s: usb_set_interface error", __FUNCTION__); | 1757 | err("%s: usb_set_interface error", __func__); |
1756 | uvd->last_error = i; | 1758 | uvd->last_error = i; |
1757 | return -EBUSY; | 1759 | return -EBUSY; |
1758 | } | 1760 | } |
1759 | if (VALID_CALLBACK(uvd, videoStart)) | 1761 | if (VALID_CALLBACK(uvd, videoStart)) |
1760 | GET_CALLBACK(uvd, videoStart)(uvd); | 1762 | GET_CALLBACK(uvd, videoStart)(uvd); |
1761 | else | 1763 | else |
1762 | err("%s: videoStart not set", __FUNCTION__); | 1764 | err("%s: videoStart not set", __func__); |
1763 | 1765 | ||
1764 | /* We double buffer the Iso lists */ | 1766 | /* We double buffer the Iso lists */ |
1765 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 1767 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
@@ -1784,12 +1786,12 @@ static int usbvideo_StartDataPump(struct uvd *uvd) | |||
1784 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 1786 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
1785 | errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL); | 1787 | errFlag = usb_submit_urb(uvd->sbuf[i].urb, GFP_KERNEL); |
1786 | if (errFlag) | 1788 | if (errFlag) |
1787 | err("%s: usb_submit_isoc(%d) ret %d", __FUNCTION__, i, errFlag); | 1789 | err("%s: usb_submit_isoc(%d) ret %d", __func__, i, errFlag); |
1788 | } | 1790 | } |
1789 | 1791 | ||
1790 | uvd->streaming = 1; | 1792 | uvd->streaming = 1; |
1791 | if (uvd->debug > 1) | 1793 | if (uvd->debug > 1) |
1792 | info("%s: streaming=1 video_endp=$%02x", __FUNCTION__, uvd->video_endp); | 1794 | info("%s: streaming=1 video_endp=$%02x", __func__, uvd->video_endp); |
1793 | return 0; | 1795 | return 0; |
1794 | } | 1796 | } |
1795 | 1797 | ||
@@ -1811,14 +1813,14 @@ static void usbvideo_StopDataPump(struct uvd *uvd) | |||
1811 | return; | 1813 | return; |
1812 | 1814 | ||
1813 | if (uvd->debug > 1) | 1815 | if (uvd->debug > 1) |
1814 | info("%s($%p)", __FUNCTION__, uvd); | 1816 | info("%s($%p)", __func__, uvd); |
1815 | 1817 | ||
1816 | /* Unschedule all of the iso td's */ | 1818 | /* Unschedule all of the iso td's */ |
1817 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 1819 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
1818 | usb_kill_urb(uvd->sbuf[i].urb); | 1820 | usb_kill_urb(uvd->sbuf[i].urb); |
1819 | } | 1821 | } |
1820 | if (uvd->debug > 1) | 1822 | if (uvd->debug > 1) |
1821 | info("%s: streaming=0", __FUNCTION__); | 1823 | info("%s: streaming=0", __func__); |
1822 | uvd->streaming = 0; | 1824 | uvd->streaming = 0; |
1823 | 1825 | ||
1824 | if (!uvd->remove_pending) { | 1826 | if (!uvd->remove_pending) { |
@@ -1826,12 +1828,12 @@ static void usbvideo_StopDataPump(struct uvd *uvd) | |||
1826 | if (VALID_CALLBACK(uvd, videoStop)) | 1828 | if (VALID_CALLBACK(uvd, videoStop)) |
1827 | GET_CALLBACK(uvd, videoStop)(uvd); | 1829 | GET_CALLBACK(uvd, videoStop)(uvd); |
1828 | else | 1830 | else |
1829 | err("%s: videoStop not set", __FUNCTION__); | 1831 | err("%s: videoStop not set", __func__); |
1830 | 1832 | ||
1831 | /* Set packet size to 0 */ | 1833 | /* Set packet size to 0 */ |
1832 | j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive); | 1834 | j = usb_set_interface(uvd->dev, uvd->iface, uvd->ifaceAltInactive); |
1833 | if (j < 0) { | 1835 | if (j < 0) { |
1834 | err("%s: usb_set_interface() error %d.", __FUNCTION__, j); | 1836 | err("%s: usb_set_interface() error %d.", __func__, j); |
1835 | uvd->last_error = j; | 1837 | uvd->last_error = j; |
1836 | } | 1838 | } |
1837 | } | 1839 | } |
@@ -1955,12 +1957,12 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1955 | struct usbvideo_frame *frame = &uvd->frame[frameNum]; | 1957 | struct usbvideo_frame *frame = &uvd->frame[frameNum]; |
1956 | 1958 | ||
1957 | if (uvd->debug >= 2) | 1959 | if (uvd->debug >= 2) |
1958 | info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); | 1960 | info("%s($%p,%d.)", __func__, uvd, frameNum); |
1959 | 1961 | ||
1960 | switch (frame->frameState) { | 1962 | switch (frame->frameState) { |
1961 | case FrameState_Unused: | 1963 | case FrameState_Unused: |
1962 | if (uvd->debug >= 2) | 1964 | if (uvd->debug >= 2) |
1963 | info("%s: FrameState_Unused", __FUNCTION__); | 1965 | info("%s: FrameState_Unused", __func__); |
1964 | return -EINVAL; | 1966 | return -EINVAL; |
1965 | case FrameState_Ready: | 1967 | case FrameState_Ready: |
1966 | case FrameState_Grabbing: | 1968 | case FrameState_Grabbing: |
@@ -1970,7 +1972,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1970 | redo: | 1972 | redo: |
1971 | if (!CAMERA_IS_OPERATIONAL(uvd)) { | 1973 | if (!CAMERA_IS_OPERATIONAL(uvd)) { |
1972 | if (uvd->debug >= 2) | 1974 | if (uvd->debug >= 2) |
1973 | info("%s: Camera is not operational (1)", __FUNCTION__); | 1975 | info("%s: Camera is not operational (1)", __func__); |
1974 | return -EIO; | 1976 | return -EIO; |
1975 | } | 1977 | } |
1976 | ntries = 0; | 1978 | ntries = 0; |
@@ -1979,24 +1981,24 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1979 | signalPending = signal_pending(current); | 1981 | signalPending = signal_pending(current); |
1980 | if (!CAMERA_IS_OPERATIONAL(uvd)) { | 1982 | if (!CAMERA_IS_OPERATIONAL(uvd)) { |
1981 | if (uvd->debug >= 2) | 1983 | if (uvd->debug >= 2) |
1982 | info("%s: Camera is not operational (2)", __FUNCTION__); | 1984 | info("%s: Camera is not operational (2)", __func__); |
1983 | return -EIO; | 1985 | return -EIO; |
1984 | } | 1986 | } |
1985 | assert(uvd->fbuf != NULL); | 1987 | assert(uvd->fbuf != NULL); |
1986 | if (signalPending) { | 1988 | if (signalPending) { |
1987 | if (uvd->debug >= 2) | 1989 | if (uvd->debug >= 2) |
1988 | info("%s: Signal=$%08x", __FUNCTION__, signalPending); | 1990 | info("%s: Signal=$%08x", __func__, signalPending); |
1989 | if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) { | 1991 | if (uvd->flags & FLAGS_RETRY_VIDIOCSYNC) { |
1990 | usbvideo_TestPattern(uvd, 1, 0); | 1992 | usbvideo_TestPattern(uvd, 1, 0); |
1991 | uvd->curframe = -1; | 1993 | uvd->curframe = -1; |
1992 | uvd->stats.frame_num++; | 1994 | uvd->stats.frame_num++; |
1993 | if (uvd->debug >= 2) | 1995 | if (uvd->debug >= 2) |
1994 | info("%s: Forced test pattern screen", __FUNCTION__); | 1996 | info("%s: Forced test pattern screen", __func__); |
1995 | return 0; | 1997 | return 0; |
1996 | } else { | 1998 | } else { |
1997 | /* Standard answer: Interrupted! */ | 1999 | /* Standard answer: Interrupted! */ |
1998 | if (uvd->debug >= 2) | 2000 | if (uvd->debug >= 2) |
1999 | info("%s: Interrupted!", __FUNCTION__); | 2001 | info("%s: Interrupted!", __func__); |
2000 | return -EINTR; | 2002 | return -EINTR; |
2001 | } | 2003 | } |
2002 | } else { | 2004 | } else { |
@@ -2006,17 +2008,17 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2006 | else if (VALID_CALLBACK(uvd, processData)) | 2008 | else if (VALID_CALLBACK(uvd, processData)) |
2007 | GET_CALLBACK(uvd, processData)(uvd, frame); | 2009 | GET_CALLBACK(uvd, processData)(uvd, frame); |
2008 | else | 2010 | else |
2009 | err("%s: processData not set", __FUNCTION__); | 2011 | err("%s: processData not set", __func__); |
2010 | } | 2012 | } |
2011 | } while (frame->frameState == FrameState_Grabbing); | 2013 | } while (frame->frameState == FrameState_Grabbing); |
2012 | if (uvd->debug >= 2) { | 2014 | if (uvd->debug >= 2) { |
2013 | info("%s: Grabbing done; state=%d. (%lu. bytes)", | 2015 | info("%s: Grabbing done; state=%d. (%lu. bytes)", |
2014 | __FUNCTION__, frame->frameState, frame->seqRead_Length); | 2016 | __func__, frame->frameState, frame->seqRead_Length); |
2015 | } | 2017 | } |
2016 | if (frame->frameState == FrameState_Error) { | 2018 | if (frame->frameState == FrameState_Error) { |
2017 | int ret = usbvideo_NewFrame(uvd, frameNum); | 2019 | int ret = usbvideo_NewFrame(uvd, frameNum); |
2018 | if (ret < 0) { | 2020 | if (ret < 0) { |
2019 | err("%s: usbvideo_NewFrame() failed (%d.)", __FUNCTION__, ret); | 2021 | err("%s: usbvideo_NewFrame() failed (%d.)", __func__, ret); |
2020 | return ret; | 2022 | return ret; |
2021 | } | 2023 | } |
2022 | goto redo; | 2024 | goto redo; |
@@ -2048,7 +2050,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2048 | } | 2050 | } |
2049 | frame->frameState = FrameState_Done_Hold; | 2051 | frame->frameState = FrameState_Done_Hold; |
2050 | if (uvd->debug >= 2) | 2052 | if (uvd->debug >= 2) |
2051 | info("%s: Entered FrameState_Done_Hold state.", __FUNCTION__); | 2053 | info("%s: Entered FrameState_Done_Hold state.", __func__); |
2052 | return 0; | 2054 | return 0; |
2053 | 2055 | ||
2054 | case FrameState_Done_Hold: | 2056 | case FrameState_Done_Hold: |
@@ -2059,12 +2061,12 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2059 | * it will be released back into the wild to roam freely. | 2061 | * it will be released back into the wild to roam freely. |
2060 | */ | 2062 | */ |
2061 | if (uvd->debug >= 2) | 2063 | if (uvd->debug >= 2) |
2062 | info("%s: FrameState_Done_Hold state.", __FUNCTION__); | 2064 | info("%s: FrameState_Done_Hold state.", __func__); |
2063 | return 0; | 2065 | return 0; |
2064 | } | 2066 | } |
2065 | 2067 | ||
2066 | /* Catch-all for other cases. We shall not be here. */ | 2068 | /* Catch-all for other cases. We shall not be here. */ |
2067 | err("%s: Invalid state %d.", __FUNCTION__, frame->frameState); | 2069 | err("%s: Invalid state %d.", __func__, frame->frameState); |
2068 | frame->frameState = FrameState_Unused; | 2070 | frame->frameState = FrameState_Unused; |
2069 | return 0; | 2071 | return 0; |
2070 | } | 2072 | } |
@@ -2160,7 +2162,7 @@ static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, | |||
2160 | const int ccm = 128; /* Color correction median - see below */ | 2162 | const int ccm = 128; /* Color correction median - see below */ |
2161 | 2163 | ||
2162 | if ((uvd == NULL) || (frame == NULL)) { | 2164 | if ((uvd == NULL) || (frame == NULL)) { |
2163 | err("%s: Illegal call.", __FUNCTION__); | 2165 | err("%s: Illegal call.", __func__); |
2164 | return; | 2166 | return; |
2165 | } | 2167 | } |
2166 | adj = (uvd->vpic.contrast - 0x8000) >> 8; /* -128..+127 = -ccm..+(ccm-1)*/ | 2168 | adj = (uvd->vpic.contrast - 0x8000) >> 8; /* -128..+127 = -ccm..+(ccm-1)*/ |