diff options
author | Devin Heitmueller <dheitmueller@linuxtv.org> | 2009-03-15 17:48:52 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:27 -0400 |
commit | 62899a28008d635f25c3408b4cc46021f0cb34d3 (patch) | |
tree | c5c92a3617aecbfb2cfe4d964b2a8bda37652d46 /drivers/media/video/au0828/au0828-video.c | |
parent | 3d62287e2c6c5b3351e04dd2c2209b2536995fdb (diff) |
V4L/DVB (11085): au0828/au8522: Codingstyle fixes
Take a pass over all of the au0828/au8522 files and cleanup all the codingstyle
issues. This patch does not make *any* functional change to the code.
Signed-off-by: Devin Heitmueller <dheitmueller@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/au0828/au0828-video.c')
-rw-r--r-- | drivers/media/video/au0828/au0828-video.c | 175 |
1 files changed, 85 insertions, 90 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 800345cbe0ef..057496414ea2 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/suspend.h> | 34 | #include <linux/suspend.h> |
35 | #include <linux/version.h> | 35 | #include <linux/version.h> |
36 | #include <linux/videodev.h> | ||
37 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
38 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
39 | #include <media/v4l2-chip-ident.h> | 38 | #include <media/v4l2-chip-ident.h> |
@@ -46,9 +45,6 @@ static DEFINE_MUTEX(au0828_sysfs_lock); | |||
46 | 45 | ||
47 | #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) | 46 | #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) |
48 | 47 | ||
49 | /* Forward declarations */ | ||
50 | void au0828_analog_stream_reset(struct au0828_dev *dev); | ||
51 | |||
52 | /* ------------------------------------------------------------------ | 48 | /* ------------------------------------------------------------------ |
53 | Videobuf operations | 49 | Videobuf operations |
54 | ------------------------------------------------------------------*/ | 50 | ------------------------------------------------------------------*/ |
@@ -107,12 +103,12 @@ static inline void print_err_status(struct au0828_dev *dev, | |||
107 | static int check_dev(struct au0828_dev *dev) | 103 | static int check_dev(struct au0828_dev *dev) |
108 | { | 104 | { |
109 | if (dev->dev_state & DEV_DISCONNECTED) { | 105 | if (dev->dev_state & DEV_DISCONNECTED) { |
110 | printk("v4l2 ioctl: device not present\n"); | 106 | printk(KERN_INFO "v4l2 ioctl: device not present\n"); |
111 | return -ENODEV; | 107 | return -ENODEV; |
112 | } | 108 | } |
113 | 109 | ||
114 | if (dev->dev_state & DEV_MISCONFIGURED) { | 110 | if (dev->dev_state & DEV_MISCONFIGURED) { |
115 | printk("v4l2 ioctl: device is misconfigured; " | 111 | printk(KERN_INFO "v4l2 ioctl: device is misconfigured; " |
116 | "close and open it again\n"); | 112 | "close and open it again\n"); |
117 | return -EIO; | 113 | return -EIO; |
118 | } | 114 | } |
@@ -373,7 +369,7 @@ static void au0828_copy_video(struct au0828_dev *dev, | |||
373 | 369 | ||
374 | if ((char *)startwrite + lencopy > (char *)outp + | 370 | if ((char *)startwrite + lencopy > (char *)outp + |
375 | buf->vb.size) { | 371 | buf->vb.size) { |
376 | au0828_isocdbg("Overflow of %zi bytes past buffer end (2)\n", | 372 | au0828_isocdbg("Overflow %zi bytes past buf end (2)\n", |
377 | ((char *)startwrite + lencopy) - | 373 | ((char *)startwrite + lencopy) - |
378 | ((char *)outp + buf->vb.size)); | 374 | ((char *)outp + buf->vb.size)); |
379 | lencopy = remain = (char *)outp + buf->vb.size - | 375 | lencopy = remain = (char *)outp + buf->vb.size - |
@@ -389,9 +385,8 @@ static void au0828_copy_video(struct au0828_dev *dev, | |||
389 | 385 | ||
390 | if (offset > 1440) { | 386 | if (offset > 1440) { |
391 | /* We have enough data to check for greenscreen */ | 387 | /* We have enough data to check for greenscreen */ |
392 | if (outp[0] < 0x60 && outp[1440] < 0x60) { | 388 | if (outp[0] < 0x60 && outp[1440] < 0x60) |
393 | dev->greenscreen_detected = 1; | 389 | dev->greenscreen_detected = 1; |
394 | } | ||
395 | } | 390 | } |
396 | 391 | ||
397 | dma_q->pos += len; | 392 | dma_q->pos += len; |
@@ -457,9 +452,9 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) | |||
457 | continue; | 452 | continue; |
458 | } | 453 | } |
459 | 454 | ||
460 | if (urb->iso_frame_desc[i].actual_length <= 0) { | 455 | if (urb->iso_frame_desc[i].actual_length <= 0) |
461 | continue; | 456 | continue; |
462 | } | 457 | |
463 | if (urb->iso_frame_desc[i].actual_length > | 458 | if (urb->iso_frame_desc[i].actual_length > |
464 | dev->max_pkt_size) { | 459 | dev->max_pkt_size) { |
465 | au0828_isocdbg("packet bigger than packet size"); | 460 | au0828_isocdbg("packet bigger than packet size"); |
@@ -480,25 +475,23 @@ static inline int au0828_isoc_copy(struct au0828_dev *dev, struct urb *urb) | |||
480 | if (buf != NULL) | 475 | if (buf != NULL) |
481 | buffer_filled(dev, dma_q, buf); | 476 | buffer_filled(dev, dma_q, buf); |
482 | get_next_buf(dma_q, &buf); | 477 | get_next_buf(dma_q, &buf); |
483 | if (buf == NULL) { | 478 | if (buf == NULL) |
484 | outp = NULL; | 479 | outp = NULL; |
485 | } else | 480 | else |
486 | outp = videobuf_to_vmalloc(&buf->vb); | 481 | outp = videobuf_to_vmalloc(&buf->vb); |
487 | } | 482 | } |
488 | 483 | ||
489 | if (buf != NULL) { | 484 | if (buf != NULL) { |
490 | if (fbyte & 0x40) { | 485 | if (fbyte & 0x40) |
491 | buf->top_field = 1; | 486 | buf->top_field = 1; |
492 | } else { | 487 | else |
493 | buf->top_field = 0; | 488 | buf->top_field = 0; |
494 | } | ||
495 | } | 489 | } |
496 | 490 | ||
497 | dma_q->pos = 0; | 491 | dma_q->pos = 0; |
498 | } | 492 | } |
499 | if (buf != NULL) { | 493 | if (buf != NULL) |
500 | au0828_copy_video(dev, dma_q, buf, p, outp, len); | 494 | au0828_copy_video(dev, dma_q, buf, p, outp, len); |
501 | } | ||
502 | } | 495 | } |
503 | return rc; | 496 | return rc; |
504 | } | 497 | } |
@@ -566,7 +559,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
566 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { | 559 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { |
567 | rc = videobuf_iolock(vq, &buf->vb, NULL); | 560 | rc = videobuf_iolock(vq, &buf->vb, NULL); |
568 | if (rc < 0) { | 561 | if (rc < 0) { |
569 | printk("videobuf_iolock failed\n"); | 562 | printk(KERN_INFO "videobuf_iolock failed\n"); |
570 | goto fail; | 563 | goto fail; |
571 | } | 564 | } |
572 | } | 565 | } |
@@ -579,7 +572,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
579 | AU0828_MAX_ISO_BUFS, dev->max_pkt_size, | 572 | AU0828_MAX_ISO_BUFS, dev->max_pkt_size, |
580 | au0828_isoc_copy); | 573 | au0828_isoc_copy); |
581 | if (rc < 0) { | 574 | if (rc < 0) { |
582 | printk("au0828_init_isoc failed\n"); | 575 | printk(KERN_INFO "au0828_init_isoc failed\n"); |
583 | goto fail; | 576 | goto fail; |
584 | } | 577 | } |
585 | } | 578 | } |
@@ -681,11 +674,11 @@ static int au0828_stream_interrupt(struct au0828_dev *dev) | |||
681 | int ret = 0; | 674 | int ret = 0; |
682 | 675 | ||
683 | dev->stream_state = STREAM_INTERRUPT; | 676 | dev->stream_state = STREAM_INTERRUPT; |
684 | if(dev->dev_state == DEV_DISCONNECTED) | 677 | if (dev->dev_state == DEV_DISCONNECTED) |
685 | return -ENODEV; | 678 | return -ENODEV; |
686 | else if(ret) { | 679 | else if (ret) { |
687 | dev->dev_state = DEV_MISCONFIGURED; | 680 | dev->dev_state = DEV_MISCONFIGURED; |
688 | dprintk(1, "%s device is misconfigured!\n", __FUNCTION__); | 681 | dprintk(1, "%s device is misconfigured!\n", __func__); |
689 | return ret; | 682 | return ret; |
690 | } | 683 | } |
691 | return 0; | 684 | return 0; |
@@ -753,23 +746,23 @@ static int au0828_v4l2_open(struct file *filp) | |||
753 | 746 | ||
754 | list_for_each(list, &au0828_devlist) { | 747 | list_for_each(list, &au0828_devlist) { |
755 | h = list_entry(list, struct au0828_dev, au0828list); | 748 | h = list_entry(list, struct au0828_dev, au0828list); |
756 | if(h->vdev->minor == minor) { | 749 | if (h->vdev->minor == minor) { |
757 | dev = h; | 750 | dev = h; |
758 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 751 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
759 | } | 752 | } |
760 | #ifdef VBI_NOT_YET_WORKING | 753 | #ifdef VBI_NOT_YET_WORKING |
761 | if(h->vbi_dev->minor == minor) { | 754 | if (h->vbi_dev->minor == minor) { |
762 | dev = h; | 755 | dev = h; |
763 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | 756 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
764 | } | 757 | } |
765 | #endif | 758 | #endif |
766 | } | 759 | } |
767 | 760 | ||
768 | if(NULL == dev) | 761 | if (NULL == dev) |
769 | return -ENODEV; | 762 | return -ENODEV; |
770 | 763 | ||
771 | fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL); | 764 | fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL); |
772 | if(NULL == fh) { | 765 | if (NULL == fh) { |
773 | dprintk(1, "Failed allocate au0828_fh struct!\n"); | 766 | dprintk(1, "Failed allocate au0828_fh struct!\n"); |
774 | return -ENOMEM; | 767 | return -ENOMEM; |
775 | } | 768 | } |
@@ -778,11 +771,11 @@ static int au0828_v4l2_open(struct file *filp) | |||
778 | fh->dev = dev; | 771 | fh->dev = dev; |
779 | filp->private_data = fh; | 772 | filp->private_data = fh; |
780 | 773 | ||
781 | if(fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { | 774 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { |
782 | /* set au0828 interface0 to AS5 here again */ | 775 | /* set au0828 interface0 to AS5 here again */ |
783 | ret = usb_set_interface(dev->usbdev, 0, 5); | 776 | ret = usb_set_interface(dev->usbdev, 0, 5); |
784 | if(ret < 0) { | 777 | if (ret < 0) { |
785 | printk("Au0828 can't set alt setting to 5!\n"); | 778 | printk(KERN_INFO "Au0828 can't set alternate to 5!\n"); |
786 | return -EBUSY; | 779 | return -EBUSY; |
787 | } | 780 | } |
788 | dev->width = NTSC_STD_W; | 781 | dev->width = NTSC_STD_W; |
@@ -821,11 +814,11 @@ static int au0828_v4l2_close(struct file *filp) | |||
821 | if (res_check(fh)) | 814 | if (res_check(fh)) |
822 | res_free(fh); | 815 | res_free(fh); |
823 | 816 | ||
824 | if(dev->users == 1) { | 817 | if (dev->users == 1) { |
825 | videobuf_stop(&fh->vb_vidq); | 818 | videobuf_stop(&fh->vb_vidq); |
826 | videobuf_mmap_free(&fh->vb_vidq); | 819 | videobuf_mmap_free(&fh->vb_vidq); |
827 | 820 | ||
828 | if(dev->dev_state & DEV_DISCONNECTED) { | 821 | if (dev->dev_state & DEV_DISCONNECTED) { |
829 | au0828_analog_unregister(dev); | 822 | au0828_analog_unregister(dev); |
830 | mutex_unlock(&dev->lock); | 823 | mutex_unlock(&dev->lock); |
831 | kfree(dev); | 824 | kfree(dev); |
@@ -839,8 +832,8 @@ static int au0828_v4l2_close(struct file *filp) | |||
839 | /* When close the device, set the usb intf0 into alt0 to free | 832 | /* When close the device, set the usb intf0 into alt0 to free |
840 | USB bandwidth */ | 833 | USB bandwidth */ |
841 | ret = usb_set_interface(dev->usbdev, 0, 0); | 834 | ret = usb_set_interface(dev->usbdev, 0, 0); |
842 | if(ret < 0) | 835 | if (ret < 0) |
843 | printk("Au0828 can't set alt setting to 0!\n"); | 836 | printk(KERN_INFO "Au0828 can't set alternate to 0!\n"); |
844 | } | 837 | } |
845 | 838 | ||
846 | kfree(fh); | 839 | kfree(fh); |
@@ -861,7 +854,7 @@ static ssize_t au0828_v4l2_read(struct file *filp, char __user *buf, | |||
861 | if (rc < 0) | 854 | if (rc < 0) |
862 | return rc; | 855 | return rc; |
863 | 856 | ||
864 | if(fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 857 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
865 | mutex_lock(&dev->lock); | 858 | mutex_lock(&dev->lock); |
866 | rc = res_get(fh); | 859 | rc = res_get(fh); |
867 | mutex_unlock(&dev->lock); | 860 | mutex_unlock(&dev->lock); |
@@ -937,28 +930,25 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, | |||
937 | maxheight = 480; | 930 | maxheight = 480; |
938 | 931 | ||
939 | #ifdef VBI_NOT_YET_WORKING | 932 | #ifdef VBI_NOT_YET_WORKING |
940 | if(format->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { | 933 | if (format->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { |
941 | dprintk(1, "VBI format set: to be supported!\n"); | 934 | dprintk(1, "VBI format set: to be supported!\n"); |
942 | return 0; | 935 | return 0; |
943 | } | 936 | } |
944 | if(format->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 937 | if (format->type == V4L2_BUF_TYPE_VBI_CAPTURE) |
945 | return 0; | 938 | return 0; |
946 | } | ||
947 | #endif | 939 | #endif |
948 | if(format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 940 | if (format->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
949 | return -EINVAL; | 941 | return -EINVAL; |
950 | } | ||
951 | 942 | ||
952 | /* If they are demanding a format other than the one we support, | 943 | /* If they are demanding a format other than the one we support, |
953 | bail out (tvtime asks for UYVY and then retries with YUYV) */ | 944 | bail out (tvtime asks for UYVY and then retries with YUYV) */ |
954 | if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) { | 945 | if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_UYVY) |
955 | return -EINVAL; | 946 | return -EINVAL; |
956 | } | ||
957 | 947 | ||
958 | /* format->fmt.pix.width only support 720 and height 480 */ | 948 | /* format->fmt.pix.width only support 720 and height 480 */ |
959 | if(width != 720) | 949 | if (width != 720) |
960 | width = 720; | 950 | width = 720; |
961 | if(height != 480) | 951 | if (height != 480) |
962 | height = 480; | 952 | height = 480; |
963 | 953 | ||
964 | format->fmt.pix.width = width; | 954 | format->fmt.pix.width = width; |
@@ -969,7 +959,7 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, | |||
969 | format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 959 | format->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
970 | format->fmt.pix.field = V4L2_FIELD_INTERLACED; | 960 | format->fmt.pix.field = V4L2_FIELD_INTERLACED; |
971 | 961 | ||
972 | if(cmd == VIDIOC_TRY_FMT) | 962 | if (cmd == VIDIOC_TRY_FMT) |
973 | return 0; | 963 | return 0; |
974 | 964 | ||
975 | /* maybe set new image format, driver current only support 720*480 */ | 965 | /* maybe set new image format, driver current only support 720*480 */ |
@@ -979,9 +969,10 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, | |||
979 | dev->field_size = width * height; | 969 | dev->field_size = width * height; |
980 | dev->bytesperline = width * 2; | 970 | dev->bytesperline = width * 2; |
981 | 971 | ||
982 | if(dev->stream_state == STREAM_ON) { | 972 | if (dev->stream_state == STREAM_ON) { |
983 | dprintk(1, "VIDIOC_SET_FMT: interrupting stream!\n"); | 973 | dprintk(1, "VIDIOC_SET_FMT: interrupting stream!\n"); |
984 | if((ret = au0828_stream_interrupt(dev))) { | 974 | ret = au0828_stream_interrupt(dev); |
975 | if (ret != 0) { | ||
985 | dprintk(1, "error interrupting video stream!\n"); | 976 | dprintk(1, "error interrupting video stream!\n"); |
986 | return ret; | 977 | return ret; |
987 | } | 978 | } |
@@ -989,8 +980,8 @@ static int au0828_set_format(struct au0828_dev *dev, unsigned int cmd, | |||
989 | 980 | ||
990 | /* set au0828 interface0 to AS5 here again */ | 981 | /* set au0828 interface0 to AS5 here again */ |
991 | ret = usb_set_interface(dev->usbdev, 0, 5); | 982 | ret = usb_set_interface(dev->usbdev, 0, 5); |
992 | if(ret < 0) { | 983 | if (ret < 0) { |
993 | printk("Au0828 can't set alt setting to 5!\n"); | 984 | printk(KERN_INFO "Au0828 can't set alt setting to 5!\n"); |
994 | return -EBUSY; | 985 | return -EBUSY; |
995 | } | 986 | } |
996 | 987 | ||
@@ -1039,7 +1030,7 @@ static int vidioc_querycap(struct file *file, void *priv, | |||
1039 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, | 1030 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
1040 | struct v4l2_fmtdesc *f) | 1031 | struct v4l2_fmtdesc *f) |
1041 | { | 1032 | { |
1042 | if(f->index) | 1033 | if (f->index) |
1043 | return -EINVAL; | 1034 | return -EINVAL; |
1044 | 1035 | ||
1045 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1036 | f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
@@ -1084,13 +1075,13 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1084 | int rc; | 1075 | int rc; |
1085 | 1076 | ||
1086 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { | 1077 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { |
1087 | printk("%s queue busy\n", __func__); | 1078 | printk(KERN_INFO "%s queue busy\n", __func__); |
1088 | rc = -EBUSY; | 1079 | rc = -EBUSY; |
1089 | goto out; | 1080 | goto out; |
1090 | } | 1081 | } |
1091 | 1082 | ||
1092 | if (dev->stream_on && !fh->stream_on) { | 1083 | if (dev->stream_on && !fh->stream_on) { |
1093 | printk("%s device in use by another fh\n", __func__); | 1084 | printk(KERN_INFO "%s device in use by another fh\n", __func__); |
1094 | rc = -EBUSY; | 1085 | rc = -EBUSY; |
1095 | goto out; | 1086 | goto out; |
1096 | } | 1087 | } |
@@ -1132,15 +1123,15 @@ static int vidioc_enum_input(struct file *file, void *priv, | |||
1132 | 1123 | ||
1133 | tmp = input->index; | 1124 | tmp = input->index; |
1134 | 1125 | ||
1135 | if(tmp > AU0828_MAX_INPUT) | 1126 | if (tmp > AU0828_MAX_INPUT) |
1136 | return -EINVAL; | 1127 | return -EINVAL; |
1137 | if(AUVI_INPUT(tmp).type == 0) | 1128 | if (AUVI_INPUT(tmp).type == 0) |
1138 | return -EINVAL; | 1129 | return -EINVAL; |
1139 | 1130 | ||
1140 | input->index = tmp; | 1131 | input->index = tmp; |
1141 | strcpy(input->name, inames[AUVI_INPUT(tmp).type]); | 1132 | strcpy(input->name, inames[AUVI_INPUT(tmp).type]); |
1142 | if((AUVI_INPUT(tmp).type == AU0828_VMUX_TELEVISION) || | 1133 | if ((AUVI_INPUT(tmp).type == AU0828_VMUX_TELEVISION) || |
1143 | (AUVI_INPUT(tmp).type == AU0828_VMUX_CABLE)) | 1134 | (AUVI_INPUT(tmp).type == AU0828_VMUX_CABLE)) |
1144 | input->type |= V4L2_INPUT_TYPE_TUNER; | 1135 | input->type |= V4L2_INPUT_TYPE_TUNER; |
1145 | else | 1136 | else |
1146 | input->type |= V4L2_INPUT_TYPE_CAMERA; | 1137 | input->type |= V4L2_INPUT_TYPE_CAMERA; |
@@ -1165,15 +1156,15 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) | |||
1165 | int i; | 1156 | int i; |
1166 | struct v4l2_routing route; | 1157 | struct v4l2_routing route; |
1167 | 1158 | ||
1168 | dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __FUNCTION__, | 1159 | dprintk(1, "VIDIOC_S_INPUT in function %s, input=%d\n", __func__, |
1169 | index); | 1160 | index); |
1170 | if(index >= AU0828_MAX_INPUT) | 1161 | if (index >= AU0828_MAX_INPUT) |
1171 | return -EINVAL; | 1162 | return -EINVAL; |
1172 | if(AUVI_INPUT(index).type == 0) | 1163 | if (AUVI_INPUT(index).type == 0) |
1173 | return -EINVAL; | 1164 | return -EINVAL; |
1174 | dev->ctrl_input = index; | 1165 | dev->ctrl_input = index; |
1175 | 1166 | ||
1176 | switch(AUVI_INPUT(index).type) { | 1167 | switch (AUVI_INPUT(index).type) { |
1177 | case AU0828_VMUX_SVIDEO: | 1168 | case AU0828_VMUX_SVIDEO: |
1178 | dev->input_type = AU0828_VMUX_SVIDEO; | 1169 | dev->input_type = AU0828_VMUX_SVIDEO; |
1179 | break; | 1170 | break; |
@@ -1195,9 +1186,8 @@ static int vidioc_s_input(struct file *file, void *priv, unsigned int index) | |||
1195 | 1186 | ||
1196 | for (i = 0; i < AU0828_MAX_INPUT; i++) { | 1187 | for (i = 0; i < AU0828_MAX_INPUT; i++) { |
1197 | int enable = 0; | 1188 | int enable = 0; |
1198 | if (AUVI_INPUT(i).audio_setup == NULL) { | 1189 | if (AUVI_INPUT(i).audio_setup == NULL) |
1199 | continue; | 1190 | continue; |
1200 | } | ||
1201 | 1191 | ||
1202 | if (i == index) | 1192 | if (i == index) |
1203 | enable = 1; | 1193 | enable = 1; |
@@ -1227,11 +1217,11 @@ static int vidioc_g_audio(struct file *file, void *priv, struct v4l2_audio *a) | |||
1227 | struct au0828_dev *dev = fh->dev; | 1217 | struct au0828_dev *dev = fh->dev; |
1228 | unsigned int index = a->index; | 1218 | unsigned int index = a->index; |
1229 | 1219 | ||
1230 | if(a->index > 1) | 1220 | if (a->index > 1) |
1231 | return -EINVAL; | 1221 | return -EINVAL; |
1232 | 1222 | ||
1233 | index = dev->ctrl_ainput; | 1223 | index = dev->ctrl_ainput; |
1234 | if(index == 0) | 1224 | if (index == 0) |
1235 | strcpy(a->name, "Television"); | 1225 | strcpy(a->name, "Television"); |
1236 | else | 1226 | else |
1237 | strcpy(a->name, "Line in"); | 1227 | strcpy(a->name, "Line in"); |
@@ -1245,7 +1235,7 @@ static int vidioc_s_audio(struct file *file, void *priv, struct v4l2_audio *a) | |||
1245 | { | 1235 | { |
1246 | struct au0828_fh *fh = priv; | 1236 | struct au0828_fh *fh = priv; |
1247 | struct au0828_dev *dev = fh->dev; | 1237 | struct au0828_dev *dev = fh->dev; |
1248 | if(a->index != dev->ctrl_ainput) | 1238 | if (a->index != dev->ctrl_ainput) |
1249 | return -EINVAL; | 1239 | return -EINVAL; |
1250 | return 0; | 1240 | return 0; |
1251 | } | 1241 | } |
@@ -1275,7 +1265,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
1275 | struct au0828_fh *fh = priv; | 1265 | struct au0828_fh *fh = priv; |
1276 | struct au0828_dev *dev = fh->dev; | 1266 | struct au0828_dev *dev = fh->dev; |
1277 | 1267 | ||
1278 | if(t->index != 0) | 1268 | if (t->index != 0) |
1279 | return -EINVAL; | 1269 | return -EINVAL; |
1280 | 1270 | ||
1281 | strcpy(t->name, "Auvitek tuner"); | 1271 | strcpy(t->name, "Auvitek tuner"); |
@@ -1290,7 +1280,7 @@ static int vidioc_s_tuner(struct file *file, void *priv, | |||
1290 | struct au0828_fh *fh = priv; | 1280 | struct au0828_fh *fh = priv; |
1291 | struct au0828_dev *dev = fh->dev; | 1281 | struct au0828_dev *dev = fh->dev; |
1292 | 1282 | ||
1293 | if(t->index != 0) | 1283 | if (t->index != 0) |
1294 | return -EINVAL; | 1284 | return -EINVAL; |
1295 | 1285 | ||
1296 | t->type = V4L2_TUNER_ANALOG_TV; | 1286 | t->type = V4L2_TUNER_ANALOG_TV; |
@@ -1318,9 +1308,9 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1318 | struct au0828_fh *fh = priv; | 1308 | struct au0828_fh *fh = priv; |
1319 | struct au0828_dev *dev = fh->dev; | 1309 | struct au0828_dev *dev = fh->dev; |
1320 | 1310 | ||
1321 | if(freq->tuner != 0) | 1311 | if (freq->tuner != 0) |
1322 | return -EINVAL; | 1312 | return -EINVAL; |
1323 | if(freq->type != V4L2_TUNER_ANALOG_TV) | 1313 | if (freq->type != V4L2_TUNER_ANALOG_TV) |
1324 | return -EINVAL; | 1314 | return -EINVAL; |
1325 | 1315 | ||
1326 | dev->ctrl_freq = freq->frequency; | 1316 | dev->ctrl_freq = freq->frequency; |
@@ -1358,7 +1348,7 @@ static int vidioc_cropcap(struct file *file, void *priv, | |||
1358 | struct au0828_fh *fh = priv; | 1348 | struct au0828_fh *fh = priv; |
1359 | struct au0828_dev *dev = fh->dev; | 1349 | struct au0828_dev *dev = fh->dev; |
1360 | 1350 | ||
1361 | if(cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 1351 | if (cc->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1362 | return -EINVAL; | 1352 | return -EINVAL; |
1363 | 1353 | ||
1364 | cc->bounds.left = 0; | 1354 | cc->bounds.left = 0; |
@@ -1422,14 +1412,14 @@ static int vidioc_streamoff(struct file *file, void *priv, | |||
1422 | 1412 | ||
1423 | if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 1413 | if (type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
1424 | au0828_call_i2c_clients(dev, VIDIOC_STREAMOFF, &b); | 1414 | au0828_call_i2c_clients(dev, VIDIOC_STREAMOFF, &b); |
1425 | if((ret = au0828_stream_interrupt(dev)) != 0) | 1415 | ret = au0828_stream_interrupt(dev); |
1416 | if (ret != 0) | ||
1426 | return ret; | 1417 | return ret; |
1427 | } | 1418 | } |
1428 | 1419 | ||
1429 | for (i = 0; i < AU0828_MAX_INPUT; i++) { | 1420 | for (i = 0; i < AU0828_MAX_INPUT; i++) { |
1430 | if (AUVI_INPUT(i).audio_setup == NULL) { | 1421 | if (AUVI_INPUT(i).audio_setup == NULL) |
1431 | continue; | 1422 | continue; |
1432 | } | ||
1433 | (AUVI_INPUT(i).audio_setup)(dev, 0); | 1423 | (AUVI_INPUT(i).audio_setup)(dev, 0); |
1434 | } | 1424 | } |
1435 | 1425 | ||
@@ -1622,27 +1612,30 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1622 | 1612 | ||
1623 | /* set au0828 usb interface0 to as5 */ | 1613 | /* set au0828 usb interface0 to as5 */ |
1624 | retval = usb_set_interface(dev->usbdev, | 1614 | retval = usb_set_interface(dev->usbdev, |
1625 | interface->cur_altsetting->desc.bInterfaceNumber, 5); | 1615 | interface->cur_altsetting->desc.bInterfaceNumber, 5); |
1626 | if (retval != 0) { | 1616 | if (retval != 0) { |
1627 | printk("Failure setting usb interface0 to as5\n"); | 1617 | printk(KERN_INFO "Failure setting usb interface0 to as5\n"); |
1628 | return retval; | 1618 | return retval; |
1629 | } | 1619 | } |
1630 | 1620 | ||
1631 | /* Figure out which endpoint has the isoc interface */ | 1621 | /* Figure out which endpoint has the isoc interface */ |
1632 | iface_desc = interface->cur_altsetting; | 1622 | iface_desc = interface->cur_altsetting; |
1633 | for(i = 0; i < iface_desc->desc.bNumEndpoints; i++){ | 1623 | for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) { |
1634 | endpoint = &iface_desc->endpoint[i].desc; | 1624 | endpoint = &iface_desc->endpoint[i].desc; |
1635 | if(((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) && | 1625 | if (((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
1636 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC)){ | 1626 | == USB_DIR_IN) && |
1627 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
1628 | == USB_ENDPOINT_XFER_ISOC)) { | ||
1637 | 1629 | ||
1638 | /* we find our isoc in endpoint */ | 1630 | /* we find our isoc in endpoint */ |
1639 | u16 tmp = le16_to_cpu(endpoint->wMaxPacketSize); | 1631 | u16 tmp = le16_to_cpu(endpoint->wMaxPacketSize); |
1640 | dev->max_pkt_size = (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1); | 1632 | dev->max_pkt_size = (tmp & 0x07ff) * |
1633 | (((tmp & 0x1800) >> 11) + 1); | ||
1641 | dev->isoc_in_endpointaddr = endpoint->bEndpointAddress; | 1634 | dev->isoc_in_endpointaddr = endpoint->bEndpointAddress; |
1642 | } | 1635 | } |
1643 | } | 1636 | } |
1644 | if(!(dev->isoc_in_endpointaddr)) { | 1637 | if (!(dev->isoc_in_endpointaddr)) { |
1645 | printk("Could not locate isoc endpoint\n"); | 1638 | printk(KERN_INFO "Could not locate isoc endpoint\n"); |
1646 | kfree(dev); | 1639 | kfree(dev); |
1647 | return -ENODEV; | 1640 | return -ENODEV; |
1648 | } | 1641 | } |
@@ -1663,14 +1656,14 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1663 | 1656 | ||
1664 | /* allocate and fill v4l2 video struct */ | 1657 | /* allocate and fill v4l2 video struct */ |
1665 | dev->vdev = video_device_alloc(); | 1658 | dev->vdev = video_device_alloc(); |
1666 | if(NULL == dev->vdev) { | 1659 | if (NULL == dev->vdev) { |
1667 | dprintk(1, "Can't allocate video_device.\n"); | 1660 | dprintk(1, "Can't allocate video_device.\n"); |
1668 | return -ENOMEM; | 1661 | return -ENOMEM; |
1669 | } | 1662 | } |
1670 | 1663 | ||
1671 | #ifdef VBI_NOT_YET_WORKING | 1664 | #ifdef VBI_NOT_YET_WORKING |
1672 | dev->vbi_dev = video_device_alloc(); | 1665 | dev->vbi_dev = video_device_alloc(); |
1673 | if(NULL == dev->vbi_dev) { | 1666 | if (NULL == dev->vbi_dev) { |
1674 | dprintk(1, "Can't allocate vbi_device.\n"); | 1667 | dprintk(1, "Can't allocate vbi_device.\n"); |
1675 | kfree(dev->vdev); | 1668 | kfree(dev->vdev); |
1676 | return -ENOMEM; | 1669 | return -ENOMEM; |
@@ -1679,14 +1672,12 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1679 | 1672 | ||
1680 | /* Fill the video capture device struct */ | 1673 | /* Fill the video capture device struct */ |
1681 | *dev->vdev = au0828_video_template; | 1674 | *dev->vdev = au0828_video_template; |
1682 | dev->vdev->vfl_type = VID_TYPE_CAPTURE | VID_TYPE_TUNER; | ||
1683 | dev->vdev->parent = &dev->usbdev->dev; | 1675 | dev->vdev->parent = &dev->usbdev->dev; |
1684 | strcpy(dev->vdev->name, "au0828a video"); | 1676 | strcpy(dev->vdev->name, "au0828a video"); |
1685 | 1677 | ||
1686 | #ifdef VBI_NOT_YET_WORKING | 1678 | #ifdef VBI_NOT_YET_WORKING |
1687 | /* Setup the VBI device */ | 1679 | /* Setup the VBI device */ |
1688 | *dev->vbi_dev = au0828_video_template; | 1680 | *dev->vbi_dev = au0828_video_template; |
1689 | dev->vbi_dev->vfl_type = VFL_TYPE_VBI; | ||
1690 | dev->vbi_dev->parent = &dev->usbdev->dev; | 1681 | dev->vbi_dev->parent = &dev->usbdev->dev; |
1691 | strcpy(dev->vbi_dev->name, "au0828a vbi"); | 1682 | strcpy(dev->vbi_dev->name, "au0828a vbi"); |
1692 | #endif | 1683 | #endif |
@@ -1694,8 +1685,10 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1694 | list_add_tail(&dev->au0828list, &au0828_devlist); | 1685 | list_add_tail(&dev->au0828list, &au0828_devlist); |
1695 | 1686 | ||
1696 | /* Register the v4l2 device */ | 1687 | /* Register the v4l2 device */ |
1697 | if((retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1)) != 0) { | 1688 | retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1); |
1698 | dprintk(1, "unable to register video device (error = %d).\n", retval); | 1689 | if (retval != 0) { |
1690 | dprintk(1, "unable to register video device (error = %d).\n", | ||
1691 | retval); | ||
1699 | list_del(&dev->au0828list); | 1692 | list_del(&dev->au0828list); |
1700 | video_device_release(dev->vdev); | 1693 | video_device_release(dev->vdev); |
1701 | return -ENODEV; | 1694 | return -ENODEV; |
@@ -1703,8 +1696,10 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1703 | 1696 | ||
1704 | #ifdef VBI_NOT_YET_WORKING | 1697 | #ifdef VBI_NOT_YET_WORKING |
1705 | /* Register the vbi device */ | 1698 | /* Register the vbi device */ |
1706 | if((retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1)) != 0) { | 1699 | retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1); |
1707 | dprintk(1, "unable to register vbi device (error = %d).\n", retval); | 1700 | if (retval != 0) { |
1701 | dprintk(1, "unable to register vbi device (error = %d).\n", | ||
1702 | retval); | ||
1708 | list_del(&dev->au0828list); | 1703 | list_del(&dev->au0828list); |
1709 | video_device_release(dev->vbi_dev); | 1704 | video_device_release(dev->vbi_dev); |
1710 | video_device_release(dev->vdev); | 1705 | video_device_release(dev->vdev); |
@@ -1712,7 +1707,7 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1712 | } | 1707 | } |
1713 | #endif | 1708 | #endif |
1714 | 1709 | ||
1715 | dprintk(1, "%s completed!\n", __FUNCTION__); | 1710 | dprintk(1, "%s completed!\n", __func__); |
1716 | 1711 | ||
1717 | return 0; | 1712 | return 0; |
1718 | } | 1713 | } |