aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/cx25821/cx25821-audups11.c78
-rw-r--r--drivers/staging/cx25821/cx25821-core.c4
-rw-r--r--drivers/staging/cx25821/cx25821-video.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video.h78
-rw-r--r--drivers/staging/cx25821/cx25821-video0.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video1.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video2.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video3.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video4.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video5.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video6.c82
-rw-r--r--drivers/staging/cx25821/cx25821-video7.c82
-rw-r--r--drivers/staging/cx25821/cx25821-videoioctl.c78
-rw-r--r--drivers/staging/cx25821/cx25821-vidups10.c78
-rw-r--r--drivers/staging/cx25821/cx25821-vidups9.c78
15 files changed, 566 insertions, 566 deletions
diff --git a/drivers/staging/cx25821/cx25821-audups11.c b/drivers/staging/cx25821/cx25821-audups11.c
index e76451c309f1..9193a6eb7cf2 100644
--- a/drivers/staging/cx25821/cx25821-audups11.c
+++ b/drivers/staging/cx25821/cx25821-audups11.c
@@ -88,10 +88,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
88} 88}
89 89
90static struct videobuf_queue_ops cx25821_video_qops = { 90static struct videobuf_queue_ops cx25821_video_qops = {
91 .buf_setup = buffer_setup, 91 .buf_setup = cx25821_buffer_setup,
92 .buf_prepare = buffer_prepare, 92 .buf_prepare = cx25821_buffer_prepare,
93 .buf_queue = buffer_queue, 93 .buf_queue = buffer_queue,
94 .buf_release = buffer_release, 94 .buf_release = cx25821_buffer_release,
95}; 95};
96 96
97static int video_open(struct file *file) 97static int video_open(struct file *file)
@@ -145,7 +145,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
145 145
146 switch (fh->type) { 146 switch (fh->type) {
147 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 147 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
148 if (res_locked(fh->dev, RESOURCE_VIDEO11)) 148 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO11))
149 return -EBUSY; 149 return -EBUSY;
150 150
151 return videobuf_read_one(&fh->vidq, data, count, ppos, 151 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -163,7 +163,7 @@ static unsigned int video_poll(struct file *file,
163 struct cx25821_fh *fh = file->private_data; 163 struct cx25821_fh *fh = file->private_data;
164 struct cx25821_buffer *buf; 164 struct cx25821_buffer *buf;
165 165
166 if (res_check(fh, RESOURCE_VIDEO11)) { 166 if (cx25821_res_check(fh, RESOURCE_VIDEO11)) {
167 /* streaming capture */ 167 /* streaming capture */
168 if (list_empty(&fh->vidq.stream)) 168 if (list_empty(&fh->vidq.stream))
169 return POLLERR; 169 return POLLERR;
@@ -191,13 +191,13 @@ static int video_release(struct file *file)
191 //cx_write(channel11->dma_ctl, 0); 191 //cx_write(channel11->dma_ctl, 0);
192 192
193 /* stop video capture */ 193 /* stop video capture */
194 if (res_check(fh, RESOURCE_VIDEO11)) { 194 if (cx25821_res_check(fh, RESOURCE_VIDEO11)) {
195 videobuf_queue_cancel(&fh->vidq); 195 videobuf_queue_cancel(&fh->vidq);
196 res_free(dev, fh, RESOURCE_VIDEO11); 196 cx25821_res_free(dev, fh, RESOURCE_VIDEO11);
197 } 197 }
198 198
199 if (fh->vidq.read_buf) { 199 if (fh->vidq.read_buf) {
200 buffer_release(&fh->vidq, fh->vidq.read_buf); 200 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
201 kfree(fh->vidq.read_buf); 201 kfree(fh->vidq.read_buf);
202 } 202 }
203 203
@@ -224,7 +224,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
224 return -EINVAL; 224 return -EINVAL;
225 } 225 }
226 226
227 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO11)))) { 227 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO11)))) {
228 return -EBUSY; 228 return -EBUSY;
229 } 229 }
230 230
@@ -242,11 +242,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
242 if (i != fh->type) 242 if (i != fh->type)
243 return -EINVAL; 243 return -EINVAL;
244 244
245 res = get_resource(fh, RESOURCE_VIDEO11); 245 res = cx25821_get_resource(fh, RESOURCE_VIDEO11);
246 err = videobuf_streamoff(get_queue(fh)); 246 err = videobuf_streamoff(get_queue(fh));
247 if (err < 0) 247 if (err < 0)
248 return err; 248 return err;
249 res_free(dev, fh, res); 249 cx25821_res_free(dev, fh, res);
250 return 0; 250 return 0;
251} 251}
252 252
@@ -264,7 +264,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
264 } 264 }
265 265
266 dprintk(2, "%s()\n", __func__); 266 dprintk(2, "%s()\n", __func__);
267 err = vidioc_try_fmt_vid_cap(file, priv, f); 267 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
268 268
269 if (0 != err) 269 if (0 != err)
270 return err; 270 return err;
@@ -364,50 +364,50 @@ static const struct v4l2_file_operations video_fops = {
364 .release = video_release, 364 .release = video_release,
365 .read = video_read, 365 .read = video_read,
366 .poll = video_poll, 366 .poll = video_poll,
367 .mmap = video_mmap, 367 .mmap = cx25821_video_mmap,
368 .ioctl = video_ioctl_upstream11, 368 .ioctl = video_ioctl_upstream11,
369}; 369};
370 370
371static const struct v4l2_ioctl_ops video_ioctl_ops = { 371static const struct v4l2_ioctl_ops video_ioctl_ops = {
372 .vidioc_querycap = vidioc_querycap, 372 .vidioc_querycap = cx25821_vidioc_querycap,
373 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 373 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
374 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 374 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
375 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 375 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
376 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 376 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
377 .vidioc_reqbufs = vidioc_reqbufs, 377 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
378 .vidioc_querybuf = vidioc_querybuf, 378 .vidioc_querybuf = cx25821_vidioc_querybuf,
379 .vidioc_qbuf = vidioc_qbuf, 379 .vidioc_qbuf = cx25821_vidioc_qbuf,
380 .vidioc_dqbuf = vidioc_dqbuf, 380 .vidioc_dqbuf = vidioc_dqbuf,
381#ifdef TUNER_FLAG 381#ifdef TUNER_FLAG
382 .vidioc_s_std = vidioc_s_std, 382 .vidioc_s_std = cx25821_vidioc_s_std,
383 .vidioc_querystd = vidioc_querystd, 383 .vidioc_querystd = cx25821_vidioc_querystd,
384#endif 384#endif
385 .vidioc_cropcap = vidioc_cropcap, 385 .vidioc_cropcap = cx25821_vidioc_cropcap,
386 .vidioc_s_crop = vidioc_s_crop, 386 .vidioc_s_crop = cx25821_vidioc_s_crop,
387 .vidioc_g_crop = vidioc_g_crop, 387 .vidioc_g_crop = cx25821_vidioc_g_crop,
388 .vidioc_enum_input = vidioc_enum_input, 388 .vidioc_enum_input = cx25821_vidioc_enum_input,
389 .vidioc_g_input = vidioc_g_input, 389 .vidioc_g_input = cx25821_vidioc_g_input,
390 .vidioc_s_input = vidioc_s_input, 390 .vidioc_s_input = cx25821_vidioc_s_input,
391 .vidioc_g_ctrl = vidioc_g_ctrl, 391 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
392 .vidioc_s_ctrl = vidioc_s_ctrl, 392 .vidioc_s_ctrl = vidioc_s_ctrl,
393 .vidioc_queryctrl = vidioc_queryctrl, 393 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
394 .vidioc_streamon = vidioc_streamon, 394 .vidioc_streamon = vidioc_streamon,
395 .vidioc_streamoff = vidioc_streamoff, 395 .vidioc_streamoff = vidioc_streamoff,
396 .vidioc_log_status = vidioc_log_status, 396 .vidioc_log_status = vidioc_log_status,
397 .vidioc_g_priority = vidioc_g_priority, 397 .vidioc_g_priority = cx25821_vidioc_g_priority,
398 .vidioc_s_priority = vidioc_s_priority, 398 .vidioc_s_priority = cx25821_vidioc_s_priority,
399#ifdef CONFIG_VIDEO_V4L1_COMPAT 399#ifdef CONFIG_VIDEO_V4L1_COMPAT
400 .vidiocgmbuf = vidiocgmbuf, 400 .vidiocgmbuf = cx25821_vidiocgmbuf,
401#endif 401#endif
402#ifdef TUNER_FLAG 402#ifdef TUNER_FLAG
403 .vidioc_g_tuner = vidioc_g_tuner, 403 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
404 .vidioc_s_tuner = vidioc_s_tuner, 404 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
405 .vidioc_g_frequency = vidioc_g_frequency, 405 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
406 .vidioc_s_frequency = vidioc_s_frequency, 406 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
407#endif 407#endif
408#ifdef CONFIG_VIDEO_ADV_DEBUG 408#ifdef CONFIG_VIDEO_ADV_DEBUG
409 .vidioc_g_register = vidioc_g_register, 409 .vidioc_g_register = cx25821_vidioc_g_register,
410 .vidioc_s_register = vidioc_s_register, 410 .vidioc_s_register = cx25821_vidioc_s_register,
411#endif 411#endif
412}; 412};
413 413
diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c
index 90090f4b5e76..d90abb383fc8 100644
--- a/drivers/staging/cx25821/cx25821-core.c
+++ b/drivers/staging/cx25821/cx25821-core.c
@@ -864,7 +864,7 @@ static void cx25821_initialize(struct cx25821_dev *dev)
864 cx25821_gpio_init(dev); 864 cx25821_gpio_init(dev);
865} 865}
866 866
867static int get_resources(struct cx25821_dev *dev) 867static int cx25821_get_resources(struct cx25821_dev *dev)
868{ 868{
869 if (request_mem_region 869 if (request_mem_region
870 (pci_resource_start(dev->pci, 0), pci_resource_len(dev->pci, 0), 870 (pci_resource_start(dev->pci, 0), pci_resource_len(dev->pci, 0),
@@ -971,7 +971,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
971 dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */ 971 dev->i2c_bus[0].i2c_period = (0x07 << 24); /* 1.95MHz */
972 972
973 973
974 if (get_resources(dev) < 0) { 974 if (cx25821_get_resources(dev) < 0) {
975 printk(KERN_ERR "%s No more PCIe resources for " 975 printk(KERN_ERR "%s No more PCIe resources for "
976 "subsystem: %04x:%04x\n", 976 "subsystem: %04x:%04x\n",
977 dev->name, dev->pci->subsystem_vendor, 977 dev->name, dev->pci->subsystem_vendor,
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c
index e3dff2eccfff..91e0db2e37f9 100644
--- a/drivers/staging/cx25821/cx25821-video.c
+++ b/drivers/staging/cx25821/cx25821-video.c
@@ -81,7 +81,7 @@ struct cx25821_fmt formats[] = {
81 }, 81 },
82}; 82};
83 83
84int get_format_size(void) 84int cx25821_get_format_size(void)
85{ 85{
86 return ARRAY_SIZE(formats); 86 return ARRAY_SIZE(formats);
87} 87}
@@ -102,7 +102,7 @@ struct cx25821_fmt *format_by_fourcc(unsigned int fourcc)
102 return NULL; 102 return NULL;
103} 103}
104 104
105void dump_video_queue(struct cx25821_dev *dev, struct cx25821_dmaqueue *q) 105void cx25821_dump_video_queue(struct cx25821_dev *dev, struct cx25821_dmaqueue *q)
106{ 106{
107 struct cx25821_buffer *buf; 107 struct cx25821_buffer *buf;
108 struct list_head *item; 108 struct list_head *item;
@@ -212,7 +212,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl)
212*/ 212*/
213 213
214// resource management 214// resource management
215int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit) 215int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit)
216{ 216{
217 dprintk(1, "%s()\n", __func__); 217 dprintk(1, "%s()\n", __func__);
218 if (fh->resources & bit) 218 if (fh->resources & bit)
@@ -234,17 +234,17 @@ int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bit)
234 return 1; 234 return 1;
235} 235}
236 236
237int res_check(struct cx25821_fh *fh, unsigned int bit) 237int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit)
238{ 238{
239 return fh->resources & bit; 239 return fh->resources & bit;
240} 240}
241 241
242int res_locked(struct cx25821_dev *dev, unsigned int bit) 242int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit)
243{ 243{
244 return dev->resources & bit; 244 return dev->resources & bit;
245} 245}
246 246
247void res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bits) 247void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, unsigned int bits)
248{ 248{
249 BUG_ON((fh->resources & bits) != bits); 249 BUG_ON((fh->resources & bits) != bits);
250 dprintk(1, "%s()\n", __func__); 250 dprintk(1, "%s()\n", __func__);
@@ -506,7 +506,7 @@ int cx25821_video_register(struct cx25821_dev *dev, int chan_num,
506 return err; 506 return err;
507} 507}
508 508
509int buffer_setup(struct videobuf_queue *q, unsigned int *count, 509int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
510 unsigned int *size) 510 unsigned int *size)
511{ 511{
512 struct cx25821_fh *fh = q->priv_data; 512 struct cx25821_fh *fh = q->priv_data;
@@ -522,7 +522,7 @@ int buffer_setup(struct videobuf_queue *q, unsigned int *count,
522 return 0; 522 return 0;
523} 523}
524 524
525int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, 525int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
526 enum v4l2_field field) 526 enum v4l2_field field)
527{ 527{
528 struct cx25821_fh *fh = q->priv_data; 528 struct cx25821_fh *fh = q->priv_data;
@@ -648,7 +648,7 @@ int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
648 return rc; 648 return rc;
649} 649}
650 650
651void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) 651void cx25821_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
652{ 652{
653 struct cx25821_buffer *buf = 653 struct cx25821_buffer *buf =
654 container_of(vb, struct cx25821_buffer, vb); 654 container_of(vb, struct cx25821_buffer, vb);
@@ -667,7 +667,7 @@ struct videobuf_queue *get_queue(struct cx25821_fh *fh)
667 } 667 }
668} 668}
669 669
670int get_resource(struct cx25821_fh *fh, int resource) 670int cx25821_get_resource(struct cx25821_fh *fh, int resource)
671{ 671{
672 switch (fh->type) { 672 switch (fh->type) {
673 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 673 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
@@ -678,7 +678,7 @@ int get_resource(struct cx25821_fh *fh, int resource)
678 } 678 }
679} 679}
680 680
681int video_mmap(struct file *file, struct vm_area_struct *vma) 681int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma)
682{ 682{
683 struct cx25821_fh *fh = file->private_data; 683 struct cx25821_fh *fh = file->private_data;
684 684
@@ -686,7 +686,7 @@ int video_mmap(struct file *file, struct vm_area_struct *vma)
686} 686}
687 687
688/* VIDEO IOCTLS */ 688/* VIDEO IOCTLS */
689int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) 689int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f)
690{ 690{
691 struct cx25821_fh *fh = priv; 691 struct cx25821_fh *fh = priv;
692 692
@@ -700,7 +700,7 @@ int vidioc_g_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f)
700 return 0; 700 return 0;
701} 701}
702 702
703int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) 703int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f)
704{ 704{
705 struct cx25821_fmt *fmt; 705 struct cx25821_fmt *fmt;
706 enum v4l2_field field; 706 enum v4l2_field field;
@@ -746,7 +746,7 @@ int vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f)
746 return 0; 746 return 0;
747} 747}
748 748
749int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap) 749int cx25821_vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap)
750{ 750{
751 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 751 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
752 752
@@ -761,7 +761,7 @@ int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *cap)
761 return 0; 761 return 0;
762} 762}
763 763
764int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 764int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
765 struct v4l2_fmtdesc *f) 765 struct v4l2_fmtdesc *f)
766{ 766{
767 if (unlikely(f->index >= ARRAY_SIZE(formats))) 767 if (unlikely(f->index >= ARRAY_SIZE(formats)))
@@ -774,7 +774,7 @@ int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
774} 774}
775 775
776#ifdef CONFIG_VIDEO_V4L1_COMPAT 776#ifdef CONFIG_VIDEO_V4L1_COMPAT
777int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) 777int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
778{ 778{
779 struct cx25821_fh *fh = priv; 779 struct cx25821_fh *fh = priv;
780 struct videobuf_queue *q; 780 struct videobuf_queue *q;
@@ -801,25 +801,25 @@ int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
801} 801}
802#endif 802#endif
803 803
804int vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p) 804int cx25821_vidioc_reqbufs(struct file *file, void *priv, struct v4l2_requestbuffers *p)
805{ 805{
806 struct cx25821_fh *fh = priv; 806 struct cx25821_fh *fh = priv;
807 return videobuf_reqbufs(get_queue(fh), p); 807 return videobuf_reqbufs(get_queue(fh), p);
808} 808}
809 809
810int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p) 810int cx25821_vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *p)
811{ 811{
812 struct cx25821_fh *fh = priv; 812 struct cx25821_fh *fh = priv;
813 return videobuf_querybuf(get_queue(fh), p); 813 return videobuf_querybuf(get_queue(fh), p);
814} 814}
815 815
816int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p) 816int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
817{ 817{
818 struct cx25821_fh *fh = priv; 818 struct cx25821_fh *fh = priv;
819 return videobuf_qbuf(get_queue(fh), p); 819 return videobuf_qbuf(get_queue(fh), p);
820} 820}
821 821
822int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p) 822int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
823{ 823{
824 struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; 824 struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev;
825 825
@@ -828,7 +828,7 @@ int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
828 return 0; 828 return 0;
829} 829}
830 830
831int vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio) 831int cx25821_vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio)
832{ 832{
833 struct cx25821_fh *fh = f; 833 struct cx25821_fh *fh = f;
834 struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; 834 struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev;
@@ -837,7 +837,7 @@ int vidioc_s_priority(struct file *file, void *f, enum v4l2_priority prio)
837} 837}
838 838
839#ifdef TUNER_FLAG 839#ifdef TUNER_FLAG
840int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms) 840int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms)
841{ 841{
842 struct cx25821_fh *fh = priv; 842 struct cx25821_fh *fh = priv;
843 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 843 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
@@ -891,14 +891,14 @@ int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i)
891 return 0; 891 return 0;
892} 892}
893 893
894int vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i) 894int cx25821_vidioc_enum_input(struct file *file, void *priv, struct v4l2_input *i)
895{ 895{
896 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 896 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
897 dprintk(1, "%s()\n", __func__); 897 dprintk(1, "%s()\n", __func__);
898 return cx25821_enum_input(dev, i); 898 return cx25821_enum_input(dev, i);
899} 899}
900 900
901int vidioc_g_input(struct file *file, void *priv, unsigned int *i) 901int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
902{ 902{
903 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 903 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
904 904
@@ -907,7 +907,7 @@ int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
907 return 0; 907 return 0;
908} 908}
909 909
910int vidioc_s_input(struct file *file, void *priv, unsigned int i) 910int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
911{ 911{
912 struct cx25821_fh *fh = priv; 912 struct cx25821_fh *fh = priv;
913 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 913 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
@@ -933,7 +933,7 @@ int vidioc_s_input(struct file *file, void *priv, unsigned int i)
933} 933}
934 934
935#ifdef TUNER_FLAG 935#ifdef TUNER_FLAG
936int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) 936int cx25821_vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f)
937{ 937{
938 struct cx25821_fh *fh = priv; 938 struct cx25821_fh *fh = priv;
939 struct cx25821_dev *dev = fh->dev; 939 struct cx25821_dev *dev = fh->dev;
@@ -960,7 +960,7 @@ int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f)
960 return 0; 960 return 0;
961} 961}
962 962
963int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) 963int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f)
964{ 964{
965 struct cx25821_fh *fh = priv; 965 struct cx25821_fh *fh = priv;
966 struct cx25821_dev *dev; 966 struct cx25821_dev *dev;
@@ -978,7 +978,7 @@ int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f)
978#endif 978#endif
979 979
980#ifdef CONFIG_VIDEO_ADV_DEBUG 980#ifdef CONFIG_VIDEO_ADV_DEBUG
981int vidioc_g_register(struct file *file, void *fh, 981int cx25821_vidioc_g_register(struct file *file, void *fh,
982 struct v4l2_dbg_register *reg) 982 struct v4l2_dbg_register *reg)
983{ 983{
984 struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; 984 struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev;
@@ -991,7 +991,7 @@ int vidioc_g_register(struct file *file, void *fh,
991 return 0; 991 return 0;
992} 992}
993 993
994int vidioc_s_register(struct file *file, void *fh, 994int cx25821_vidioc_s_register(struct file *file, void *fh,
995 struct v4l2_dbg_register *reg) 995 struct v4l2_dbg_register *reg)
996{ 996{
997 struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev; 997 struct cx25821_dev *dev = ((struct cx25821_fh *)fh)->dev;
@@ -1007,7 +1007,7 @@ int vidioc_s_register(struct file *file, void *fh,
1007#endif 1007#endif
1008 1008
1009#ifdef TUNER_FLAG 1009#ifdef TUNER_FLAG
1010int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) 1010int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1011{ 1011{
1012 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 1012 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1013 1013
@@ -1025,7 +1025,7 @@ int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1025 return 0; 1025 return 0;
1026} 1026}
1027 1027
1028int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) 1028int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
1029{ 1029{
1030 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 1030 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1031 struct cx25821_fh *fh = priv; 1031 struct cx25821_fh *fh = priv;
@@ -1108,7 +1108,7 @@ static int cx25821_ctrl_query(struct v4l2_queryctrl *qctrl)
1108 return 0; 1108 return 0;
1109} 1109}
1110 1110
1111int vidioc_queryctrl(struct file *file, void *priv, 1111int cx25821_vidioc_queryctrl(struct file *file, void *priv,
1112 struct v4l2_queryctrl *qctrl) 1112 struct v4l2_queryctrl *qctrl)
1113{ 1113{
1114 return cx25821_ctrl_query(qctrl); 1114 return cx25821_ctrl_query(qctrl);
@@ -1127,7 +1127,7 @@ static const struct v4l2_queryctrl *ctrl_by_id(unsigned int id)
1127 return NULL; 1127 return NULL;
1128} 1128}
1129 1129
1130int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctl) 1130int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctl)
1131{ 1131{
1132 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 1132 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1133 1133
@@ -1216,7 +1216,7 @@ static void init_controls(struct cx25821_dev *dev, int chan_num)
1216 } 1216 }
1217} 1217}
1218 1218
1219int vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap) 1219int cx25821_vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap)
1220{ 1220{
1221 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 1221 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1222 1222
@@ -1233,7 +1233,7 @@ int vidioc_cropcap(struct file *file, void *priv, struct v4l2_cropcap *cropcap)
1233 return 0; 1233 return 0;
1234} 1234}
1235 1235
1236int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) 1236int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop)
1237{ 1237{
1238 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; 1238 struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
1239 struct cx25821_fh *fh = priv; 1239 struct cx25821_fh *fh = priv;
@@ -1244,17 +1244,17 @@ int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop)
1244 if (0 != err) 1244 if (0 != err)
1245 return err; 1245 return err;
1246 } 1246 }
1247 // vidioc_s_crop not supported 1247 // cx25821_vidioc_s_crop not supported
1248 return -EINVAL; 1248 return -EINVAL;
1249} 1249}
1250 1250
1251int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop) 1251int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop)
1252{ 1252{
1253 // vidioc_g_crop not supported 1253 // cx25821_vidioc_g_crop not supported
1254 return -EINVAL; 1254 return -EINVAL;
1255} 1255}
1256 1256
1257int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm) 1257int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm)
1258{ 1258{
1259 // medusa does not support video standard sensing of current input 1259 // medusa does not support video standard sensing of current input
1260 *norm = CX25821_NORMS; 1260 *norm = CX25821_NORMS;
@@ -1262,7 +1262,7 @@ int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm)
1262 return 0; 1262 return 0;
1263} 1263}
1264 1264
1265int is_valid_width(u32 width, v4l2_std_id tvnorm) 1265int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm)
1266{ 1266{
1267 if (tvnorm == V4L2_STD_PAL_BG) { 1267 if (tvnorm == V4L2_STD_PAL_BG) {
1268 if (width == 352 || width == 720) 1268 if (width == 352 || width == 720)
@@ -1280,7 +1280,7 @@ int is_valid_width(u32 width, v4l2_std_id tvnorm)
1280 return 0; 1280 return 0;
1281} 1281}
1282 1282
1283int is_valid_height(u32 height, v4l2_std_id tvnorm) 1283int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm)
1284{ 1284{
1285 if (tvnorm == V4L2_STD_PAL_BG) { 1285 if (tvnorm == V4L2_STD_PAL_BG) {
1286 if (height == 576 || height == 288) 1286 if (height == 576 || height == 288)
diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h
index 4417ff5d90d4..0bddc02be57d 100644
--- a/drivers/staging/cx25821/cx25821-video.h
+++ b/drivers/staging/cx25821/cx25821-video.h
@@ -101,7 +101,7 @@ extern struct cx25821_fmt formats[];
101extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); 101extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc);
102extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; 102extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM];
103 103
104extern void dump_video_queue(struct cx25821_dev *dev, 104extern void cx25821_dump_video_queue(struct cx25821_dev *dev,
105 struct cx25821_dmaqueue *q); 105 struct cx25821_dmaqueue *q);
106extern void cx25821_video_wakeup(struct cx25821_dev *dev, 106extern void cx25821_video_wakeup(struct cx25821_dev *dev,
107 struct cx25821_dmaqueue *q, u32 count); 107 struct cx25821_dmaqueue *q, u32 count);
@@ -110,11 +110,11 @@ extern void cx25821_video_wakeup(struct cx25821_dev *dev,
110extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm); 110extern int cx25821_set_tvnorm(struct cx25821_dev *dev, v4l2_std_id norm);
111#endif 111#endif
112 112
113extern int res_get(struct cx25821_dev *dev, struct cx25821_fh *fh, 113extern int cx25821_res_get(struct cx25821_dev *dev, struct cx25821_fh *fh,
114 unsigned int bit); 114 unsigned int bit);
115extern int res_check(struct cx25821_fh *fh, unsigned int bit); 115extern int cx25821_res_check(struct cx25821_fh *fh, unsigned int bit);
116extern int res_locked(struct cx25821_dev *dev, unsigned int bit); 116extern int cx25821_res_locked(struct cx25821_dev *dev, unsigned int bit);
117extern void res_free(struct cx25821_dev *dev, struct cx25821_fh *fh, 117extern void cx25821_res_free(struct cx25821_dev *dev, struct cx25821_fh *fh,
118 unsigned int bits); 118 unsigned int bits);
119extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input); 119extern int cx25821_video_mux(struct cx25821_dev *dev, unsigned int input);
120extern int cx25821_start_video_dma(struct cx25821_dev *dev, 120extern int cx25821_start_video_dma(struct cx25821_dev *dev,
@@ -128,67 +128,67 @@ extern int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status);
128extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num); 128extern void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num);
129extern int cx25821_video_register(struct cx25821_dev *dev, int chan_num, 129extern int cx25821_video_register(struct cx25821_dev *dev, int chan_num,
130 struct video_device *video_template); 130 struct video_device *video_template);
131extern int get_format_size(void); 131extern int cx25821_get_format_size(void);
132 132
133extern int buffer_setup(struct videobuf_queue *q, unsigned int *count, 133extern int cx25821_buffer_setup(struct videobuf_queue *q, unsigned int *count,
134 unsigned int *size); 134 unsigned int *size);
135extern int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, 135extern int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
136 enum v4l2_field field); 136 enum v4l2_field field);
137extern void buffer_release(struct videobuf_queue *q, 137extern void cx25821_buffer_release(struct videobuf_queue *q,
138 struct videobuf_buffer *vb); 138 struct videobuf_buffer *vb);
139extern struct videobuf_queue *get_queue(struct cx25821_fh *fh); 139extern struct videobuf_queue *get_queue(struct cx25821_fh *fh);
140extern int get_resource(struct cx25821_fh *fh, int resource); 140extern int cx25821_get_resource(struct cx25821_fh *fh, int resource);
141extern int video_mmap(struct file *file, struct vm_area_struct *vma); 141extern int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma);
142extern int vidioc_try_fmt_vid_cap(struct file *file, void *priv, 142extern int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
143 struct v4l2_format *f); 143 struct v4l2_format *f);
144extern int vidioc_querycap(struct file *file, void *priv, 144extern int cx25821_vidioc_querycap(struct file *file, void *priv,
145 struct v4l2_capability *cap); 145 struct v4l2_capability *cap);
146extern int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 146extern int cx25821_vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
147 struct v4l2_fmtdesc *f); 147 struct v4l2_fmtdesc *f);
148extern int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf); 148extern int cx25821_vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf);
149extern int vidioc_reqbufs(struct file *file, void *priv, 149extern int cx25821_vidioc_reqbufs(struct file *file, void *priv,
150 struct v4l2_requestbuffers *p); 150 struct v4l2_requestbuffers *p);
151extern int vidioc_querybuf(struct file *file, void *priv, 151extern int cx25821_vidioc_querybuf(struct file *file, void *priv,
152 struct v4l2_buffer *p); 152 struct v4l2_buffer *p);
153extern int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p); 153extern int cx25821_vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *p);
154extern int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms); 154extern int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms);
155extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i); 155extern int cx25821_enum_input(struct cx25821_dev *dev, struct v4l2_input *i);
156extern int vidioc_enum_input(struct file *file, void *priv, 156extern int cx25821_vidioc_enum_input(struct file *file, void *priv,
157 struct v4l2_input *i); 157 struct v4l2_input *i);
158extern int vidioc_g_input(struct file *file, void *priv, unsigned int *i); 158extern int cx25821_vidioc_g_input(struct file *file, void *priv, unsigned int *i);
159extern int vidioc_s_input(struct file *file, void *priv, unsigned int i); 159extern int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i);
160extern int vidioc_g_ctrl(struct file *file, void *priv, 160extern int cx25821_vidioc_g_ctrl(struct file *file, void *priv,
161 struct v4l2_control *ctl); 161 struct v4l2_control *ctl);
162extern int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 162extern int cx25821_vidioc_g_fmt_vid_cap(struct file *file, void *priv,
163 struct v4l2_format *f); 163 struct v4l2_format *f);
164extern int vidioc_g_frequency(struct file *file, void *priv, 164extern int cx25821_vidioc_g_frequency(struct file *file, void *priv,
165 struct v4l2_frequency *f); 165 struct v4l2_frequency *f);
166extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f); 166extern int cx25821_set_freq(struct cx25821_dev *dev, struct v4l2_frequency *f);
167extern int vidioc_s_frequency(struct file *file, void *priv, 167extern int cx25821_vidioc_s_frequency(struct file *file, void *priv,
168 struct v4l2_frequency *f); 168 struct v4l2_frequency *f);
169extern int vidioc_g_register(struct file *file, void *fh, 169extern int cx25821_vidioc_g_register(struct file *file, void *fh,
170 struct v4l2_dbg_register *reg); 170 struct v4l2_dbg_register *reg);
171extern int vidioc_s_register(struct file *file, void *fh, 171extern int cx25821_vidioc_s_register(struct file *file, void *fh,
172 struct v4l2_dbg_register *reg); 172 struct v4l2_dbg_register *reg);
173extern int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t); 173extern int cx25821_vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
174extern int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t); 174extern int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
175 175
176extern int is_valid_width(u32 width, v4l2_std_id tvnorm); 176extern int cx25821_is_valid_width(u32 width, v4l2_std_id tvnorm);
177extern int is_valid_height(u32 height, v4l2_std_id tvnorm); 177extern int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm);
178 178
179extern int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p); 179extern int cx25821_vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p);
180extern int vidioc_s_priority(struct file *file, void *f, 180extern int cx25821_vidioc_s_priority(struct file *file, void *f,
181 enum v4l2_priority prio); 181 enum v4l2_priority prio);
182 182
183extern int vidioc_queryctrl(struct file *file, void *priv, 183extern int cx25821_vidioc_queryctrl(struct file *file, void *priv,
184 struct v4l2_queryctrl *qctrl); 184 struct v4l2_queryctrl *qctrl);
185extern int cx25821_set_control(struct cx25821_dev *dev, 185extern int cx25821_set_control(struct cx25821_dev *dev,
186 struct v4l2_control *ctrl, int chan_num); 186 struct v4l2_control *ctrl, int chan_num);
187 187
188extern int vidioc_cropcap(struct file *file, void *fh, 188extern int cx25821_vidioc_cropcap(struct file *file, void *fh,
189 struct v4l2_cropcap *cropcap); 189 struct v4l2_cropcap *cropcap);
190extern int vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop); 190extern int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop);
191extern int vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop); 191extern int cx25821_vidioc_g_crop(struct file *file, void *priv, struct v4l2_crop *crop);
192 192
193extern int vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm); 193extern int cx25821_vidioc_querystd(struct file *file, void *priv, v4l2_std_id * norm);
194#endif 194#endif
diff --git a/drivers/staging/cx25821/cx25821-video0.c b/drivers/staging/cx25821/cx25821-video0.c
index ad7a69129118..1f95ddba8499 100644
--- a/drivers/staging/cx25821/cx25821-video0.c
+++ b/drivers/staging/cx25821/cx25821-video0.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO0)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO0))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO0)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,13 +207,13 @@ static int video_release(struct file *file)
207 cx_write(channel0->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel0->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO0)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO0); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO0);
213 } 213 }
214 214
215 if (fh->vidq.read_buf) { 215 if (fh->vidq.read_buf) {
216 buffer_release(&fh->vidq, fh->vidq.read_buf); 216 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
217 kfree(fh->vidq.read_buf); 217 kfree(fh->vidq.read_buf);
218 } 218 }
219 219
@@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
239 return -EINVAL; 239 return -EINVAL;
240 } 240 }
241 241
242 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO0)))) { 242 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO0)))) {
243 return -EBUSY; 243 return -EBUSY;
244 } 244 }
245 245
@@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
257 if (i != fh->type) 257 if (i != fh->type)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 res = get_resource(fh, RESOURCE_VIDEO0); 260 res = cx25821_get_resource(fh, RESOURCE_VIDEO0);
261 err = videobuf_streamoff(get_queue(fh)); 261 err = videobuf_streamoff(get_queue(fh));
262 if (err < 0) 262 if (err < 0)
263 return err; 263 return err;
264 res_free(dev, fh, res); 264 cx25821_res_free(dev, fh, res);
265 return 0; 265 return 0;
266} 266}
267 267
@@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
280 } 280 }
281 281
282 dprintk(2, "%s()\n", __func__); 282 dprintk(2, "%s()\n", __func__);
283 err = vidioc_try_fmt_vid_cap(file, priv, f); 283 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
284 284
285 if (0 != err) 285 if (0 != err)
286 return err; 286 return err;
@@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
289 fh->vidq.field = f->fmt.pix.field; 289 fh->vidq.field = f->fmt.pix.field;
290 290
291 // check if width and height is valid based on set standard 291 // check if width and height is valid based on set standard
292 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 292 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
293 fh->width = f->fmt.pix.width; 293 fh->width = f->fmt.pix.width;
294 } 294 }
295 295
296 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 296 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
297 fh->height = f->fmt.pix.height; 297 fh->height = f->fmt.pix.height;
298 } 298 }
299 299
@@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = {
378 .release = video_release, 378 .release = video_release,
379 .read = video_read, 379 .read = video_read,
380 .poll = video_poll, 380 .poll = video_poll,
381 .mmap = video_mmap, 381 .mmap = cx25821_video_mmap,
382 .ioctl = video_ioctl2, 382 .ioctl = video_ioctl2,
383}; 383};
384 384
385static const struct v4l2_ioctl_ops video_ioctl_ops = { 385static const struct v4l2_ioctl_ops video_ioctl_ops = {
386 .vidioc_querycap = vidioc_querycap, 386 .vidioc_querycap = cx25821_vidioc_querycap,
387 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 387 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
388 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 388 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
389 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 389 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
391 .vidioc_reqbufs = vidioc_reqbufs, 391 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
392 .vidioc_querybuf = vidioc_querybuf, 392 .vidioc_querybuf = cx25821_vidioc_querybuf,
393 .vidioc_qbuf = vidioc_qbuf, 393 .vidioc_qbuf = cx25821_vidioc_qbuf,
394 .vidioc_dqbuf = vidioc_dqbuf, 394 .vidioc_dqbuf = vidioc_dqbuf,
395#ifdef TUNER_FLAG 395#ifdef TUNER_FLAG
396 .vidioc_s_std = vidioc_s_std, 396 .vidioc_s_std = cx25821_vidioc_s_std,
397 .vidioc_querystd = vidioc_querystd, 397 .vidioc_querystd = cx25821_vidioc_querystd,
398#endif 398#endif
399 .vidioc_cropcap = vidioc_cropcap, 399 .vidioc_cropcap = cx25821_vidioc_cropcap,
400 .vidioc_s_crop = vidioc_s_crop, 400 .vidioc_s_crop = cx25821_vidioc_s_crop,
401 .vidioc_g_crop = vidioc_g_crop, 401 .vidioc_g_crop = cx25821_vidioc_g_crop,
402 .vidioc_enum_input = vidioc_enum_input, 402 .vidioc_enum_input = cx25821_vidioc_enum_input,
403 .vidioc_g_input = vidioc_g_input, 403 .vidioc_g_input = cx25821_vidioc_g_input,
404 .vidioc_s_input = vidioc_s_input, 404 .vidioc_s_input = cx25821_vidioc_s_input,
405 .vidioc_g_ctrl = vidioc_g_ctrl, 405 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
406 .vidioc_s_ctrl = vidioc_s_ctrl, 406 .vidioc_s_ctrl = vidioc_s_ctrl,
407 .vidioc_queryctrl = vidioc_queryctrl, 407 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
408 .vidioc_streamon = vidioc_streamon, 408 .vidioc_streamon = vidioc_streamon,
409 .vidioc_streamoff = vidioc_streamoff, 409 .vidioc_streamoff = vidioc_streamoff,
410 .vidioc_log_status = vidioc_log_status, 410 .vidioc_log_status = vidioc_log_status,
411 .vidioc_g_priority = vidioc_g_priority, 411 .vidioc_g_priority = cx25821_vidioc_g_priority,
412 .vidioc_s_priority = vidioc_s_priority, 412 .vidioc_s_priority = cx25821_vidioc_s_priority,
413#ifdef CONFIG_VIDEO_V4L1_COMPAT 413#ifdef CONFIG_VIDEO_V4L1_COMPAT
414 .vidiocgmbuf = vidiocgmbuf, 414 .vidiocgmbuf = cx25821_vidiocgmbuf,
415#endif 415#endif
416#ifdef TUNER_FLAG 416#ifdef TUNER_FLAG
417 .vidioc_g_tuner = vidioc_g_tuner, 417 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 418 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
419 .vidioc_g_frequency = vidioc_g_frequency, 419 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
420 .vidioc_s_frequency = vidioc_s_frequency, 420 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
421#endif 421#endif
422#ifdef CONFIG_VIDEO_ADV_DEBUG 422#ifdef CONFIG_VIDEO_ADV_DEBUG
423 .vidioc_g_register = vidioc_g_register, 423 .vidioc_g_register = cx25821_vidioc_g_register,
424 .vidioc_s_register = vidioc_s_register, 424 .vidioc_s_register = cx25821_vidioc_s_register,
425#endif 425#endif
426}; 426};
427 427
diff --git a/drivers/staging/cx25821/cx25821-video1.c b/drivers/staging/cx25821/cx25821-video1.c
index e3f3c4ac7908..9b94462a62cf 100644
--- a/drivers/staging/cx25821/cx25821-video1.c
+++ b/drivers/staging/cx25821/cx25821-video1.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO1)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO1))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO1)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO1)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,13 +207,13 @@ static int video_release(struct file *file)
207 cx_write(channel1->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel1->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO1)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO1)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO1); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO1);
213 } 213 }
214 214
215 if (fh->vidq.read_buf) { 215 if (fh->vidq.read_buf) {
216 buffer_release(&fh->vidq, fh->vidq.read_buf); 216 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
217 kfree(fh->vidq.read_buf); 217 kfree(fh->vidq.read_buf);
218 } 218 }
219 219
@@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
239 return -EINVAL; 239 return -EINVAL;
240 } 240 }
241 241
242 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO1)))) { 242 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO1)))) {
243 return -EBUSY; 243 return -EBUSY;
244 } 244 }
245 245
@@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
257 if (i != fh->type) 257 if (i != fh->type)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 res = get_resource(fh, RESOURCE_VIDEO1); 260 res = cx25821_get_resource(fh, RESOURCE_VIDEO1);
261 err = videobuf_streamoff(get_queue(fh)); 261 err = videobuf_streamoff(get_queue(fh));
262 if (err < 0) 262 if (err < 0)
263 return err; 263 return err;
264 res_free(dev, fh, res); 264 cx25821_res_free(dev, fh, res);
265 return 0; 265 return 0;
266} 266}
267 267
@@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
280 } 280 }
281 281
282 dprintk(2, "%s()\n", __func__); 282 dprintk(2, "%s()\n", __func__);
283 err = vidioc_try_fmt_vid_cap(file, priv, f); 283 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
284 284
285 if (0 != err) 285 if (0 != err)
286 return err; 286 return err;
@@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
289 fh->vidq.field = f->fmt.pix.field; 289 fh->vidq.field = f->fmt.pix.field;
290 290
291 // check if width and height is valid based on set standard 291 // check if width and height is valid based on set standard
292 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 292 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
293 fh->width = f->fmt.pix.width; 293 fh->width = f->fmt.pix.width;
294 } 294 }
295 295
296 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 296 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
297 fh->height = f->fmt.pix.height; 297 fh->height = f->fmt.pix.height;
298 } 298 }
299 299
@@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = {
378 .release = video_release, 378 .release = video_release,
379 .read = video_read, 379 .read = video_read,
380 .poll = video_poll, 380 .poll = video_poll,
381 .mmap = video_mmap, 381 .mmap = cx25821_video_mmap,
382 .ioctl = video_ioctl2, 382 .ioctl = video_ioctl2,
383}; 383};
384 384
385static const struct v4l2_ioctl_ops video_ioctl_ops = { 385static const struct v4l2_ioctl_ops video_ioctl_ops = {
386 .vidioc_querycap = vidioc_querycap, 386 .vidioc_querycap = cx25821_vidioc_querycap,
387 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 387 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
388 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 388 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
389 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 389 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
391 .vidioc_reqbufs = vidioc_reqbufs, 391 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
392 .vidioc_querybuf = vidioc_querybuf, 392 .vidioc_querybuf = cx25821_vidioc_querybuf,
393 .vidioc_qbuf = vidioc_qbuf, 393 .vidioc_qbuf = cx25821_vidioc_qbuf,
394 .vidioc_dqbuf = vidioc_dqbuf, 394 .vidioc_dqbuf = vidioc_dqbuf,
395#ifdef TUNER_FLAG 395#ifdef TUNER_FLAG
396 .vidioc_s_std = vidioc_s_std, 396 .vidioc_s_std = cx25821_vidioc_s_std,
397 .vidioc_querystd = vidioc_querystd, 397 .vidioc_querystd = cx25821_vidioc_querystd,
398#endif 398#endif
399 .vidioc_cropcap = vidioc_cropcap, 399 .vidioc_cropcap = cx25821_vidioc_cropcap,
400 .vidioc_s_crop = vidioc_s_crop, 400 .vidioc_s_crop = cx25821_vidioc_s_crop,
401 .vidioc_g_crop = vidioc_g_crop, 401 .vidioc_g_crop = cx25821_vidioc_g_crop,
402 .vidioc_enum_input = vidioc_enum_input, 402 .vidioc_enum_input = cx25821_vidioc_enum_input,
403 .vidioc_g_input = vidioc_g_input, 403 .vidioc_g_input = cx25821_vidioc_g_input,
404 .vidioc_s_input = vidioc_s_input, 404 .vidioc_s_input = cx25821_vidioc_s_input,
405 .vidioc_g_ctrl = vidioc_g_ctrl, 405 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
406 .vidioc_s_ctrl = vidioc_s_ctrl, 406 .vidioc_s_ctrl = vidioc_s_ctrl,
407 .vidioc_queryctrl = vidioc_queryctrl, 407 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
408 .vidioc_streamon = vidioc_streamon, 408 .vidioc_streamon = vidioc_streamon,
409 .vidioc_streamoff = vidioc_streamoff, 409 .vidioc_streamoff = vidioc_streamoff,
410 .vidioc_log_status = vidioc_log_status, 410 .vidioc_log_status = vidioc_log_status,
411 .vidioc_g_priority = vidioc_g_priority, 411 .vidioc_g_priority = cx25821_vidioc_g_priority,
412 .vidioc_s_priority = vidioc_s_priority, 412 .vidioc_s_priority = cx25821_vidioc_s_priority,
413#ifdef CONFIG_VIDEO_V4L1_COMPAT 413#ifdef CONFIG_VIDEO_V4L1_COMPAT
414 .vidiocgmbuf = vidiocgmbuf, 414 .vidiocgmbuf = cx25821_vidiocgmbuf,
415#endif 415#endif
416#ifdef TUNER_FLAG 416#ifdef TUNER_FLAG
417 .vidioc_g_tuner = vidioc_g_tuner, 417 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 418 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
419 .vidioc_g_frequency = vidioc_g_frequency, 419 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
420 .vidioc_s_frequency = vidioc_s_frequency, 420 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
421#endif 421#endif
422#ifdef CONFIG_VIDEO_ADV_DEBUG 422#ifdef CONFIG_VIDEO_ADV_DEBUG
423 .vidioc_g_register = vidioc_g_register, 423 .vidioc_g_register = cx25821_vidioc_g_register,
424 .vidioc_s_register = vidioc_s_register, 424 .vidioc_s_register = cx25821_vidioc_s_register,
425#endif 425#endif
426}; 426};
427 427
diff --git a/drivers/staging/cx25821/cx25821-video2.c b/drivers/staging/cx25821/cx25821-video2.c
index 36fb855a497e..31c46aa2e563 100644
--- a/drivers/staging/cx25821/cx25821-video2.c
+++ b/drivers/staging/cx25821/cx25821-video2.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO2)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO2))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO2)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO2)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,13 +207,13 @@ static int video_release(struct file *file)
207 cx_write(channel2->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel2->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO2)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO2)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO2); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO2);
213 } 213 }
214 214
215 if (fh->vidq.read_buf) { 215 if (fh->vidq.read_buf) {
216 buffer_release(&fh->vidq, fh->vidq.read_buf); 216 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
217 kfree(fh->vidq.read_buf); 217 kfree(fh->vidq.read_buf);
218 } 218 }
219 219
@@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
239 return -EINVAL; 239 return -EINVAL;
240 } 240 }
241 241
242 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO2)))) { 242 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO2)))) {
243 return -EBUSY; 243 return -EBUSY;
244 } 244 }
245 245
@@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
257 if (i != fh->type) 257 if (i != fh->type)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 res = get_resource(fh, RESOURCE_VIDEO2); 260 res = cx25821_get_resource(fh, RESOURCE_VIDEO2);
261 err = videobuf_streamoff(get_queue(fh)); 261 err = videobuf_streamoff(get_queue(fh));
262 if (err < 0) 262 if (err < 0)
263 return err; 263 return err;
264 res_free(dev, fh, res); 264 cx25821_res_free(dev, fh, res);
265 return 0; 265 return 0;
266} 266}
267 267
@@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
280 } 280 }
281 281
282 dprintk(2, "%s()\n", __func__); 282 dprintk(2, "%s()\n", __func__);
283 err = vidioc_try_fmt_vid_cap(file, priv, f); 283 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
284 284
285 if (0 != err) 285 if (0 != err)
286 return err; 286 return err;
@@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
289 fh->vidq.field = f->fmt.pix.field; 289 fh->vidq.field = f->fmt.pix.field;
290 290
291 // check if width and height is valid based on set standard 291 // check if width and height is valid based on set standard
292 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 292 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
293 fh->width = f->fmt.pix.width; 293 fh->width = f->fmt.pix.width;
294 } 294 }
295 295
296 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 296 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
297 fh->height = f->fmt.pix.height; 297 fh->height = f->fmt.pix.height;
298 } 298 }
299 299
@@ -380,50 +380,50 @@ static const struct v4l2_file_operations video_fops = {
380 .release = video_release, 380 .release = video_release,
381 .read = video_read, 381 .read = video_read,
382 .poll = video_poll, 382 .poll = video_poll,
383 .mmap = video_mmap, 383 .mmap = cx25821_video_mmap,
384 .ioctl = video_ioctl2, 384 .ioctl = video_ioctl2,
385}; 385};
386 386
387static const struct v4l2_ioctl_ops video_ioctl_ops = { 387static const struct v4l2_ioctl_ops video_ioctl_ops = {
388 .vidioc_querycap = vidioc_querycap, 388 .vidioc_querycap = cx25821_vidioc_querycap,
389 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 389 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
390 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 390 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
391 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 391 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
392 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 392 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
393 .vidioc_reqbufs = vidioc_reqbufs, 393 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
394 .vidioc_querybuf = vidioc_querybuf, 394 .vidioc_querybuf = cx25821_vidioc_querybuf,
395 .vidioc_qbuf = vidioc_qbuf, 395 .vidioc_qbuf = cx25821_vidioc_qbuf,
396 .vidioc_dqbuf = vidioc_dqbuf, 396 .vidioc_dqbuf = vidioc_dqbuf,
397#ifdef TUNER_FLAG 397#ifdef TUNER_FLAG
398 .vidioc_s_std = vidioc_s_std, 398 .vidioc_s_std = cx25821_vidioc_s_std,
399 .vidioc_querystd = vidioc_querystd, 399 .vidioc_querystd = cx25821_vidioc_querystd,
400#endif 400#endif
401 .vidioc_cropcap = vidioc_cropcap, 401 .vidioc_cropcap = cx25821_vidioc_cropcap,
402 .vidioc_s_crop = vidioc_s_crop, 402 .vidioc_s_crop = cx25821_vidioc_s_crop,
403 .vidioc_g_crop = vidioc_g_crop, 403 .vidioc_g_crop = cx25821_vidioc_g_crop,
404 .vidioc_enum_input = vidioc_enum_input, 404 .vidioc_enum_input = cx25821_vidioc_enum_input,
405 .vidioc_g_input = vidioc_g_input, 405 .vidioc_g_input = cx25821_vidioc_g_input,
406 .vidioc_s_input = vidioc_s_input, 406 .vidioc_s_input = cx25821_vidioc_s_input,
407 .vidioc_g_ctrl = vidioc_g_ctrl, 407 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
408 .vidioc_s_ctrl = vidioc_s_ctrl, 408 .vidioc_s_ctrl = vidioc_s_ctrl,
409 .vidioc_queryctrl = vidioc_queryctrl, 409 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
410 .vidioc_streamon = vidioc_streamon, 410 .vidioc_streamon = vidioc_streamon,
411 .vidioc_streamoff = vidioc_streamoff, 411 .vidioc_streamoff = vidioc_streamoff,
412 .vidioc_log_status = vidioc_log_status, 412 .vidioc_log_status = vidioc_log_status,
413 .vidioc_g_priority = vidioc_g_priority, 413 .vidioc_g_priority = cx25821_vidioc_g_priority,
414 .vidioc_s_priority = vidioc_s_priority, 414 .vidioc_s_priority = cx25821_vidioc_s_priority,
415#ifdef CONFIG_VIDEO_V4L1_COMPAT 415#ifdef CONFIG_VIDEO_V4L1_COMPAT
416 .vidiocgmbuf = vidiocgmbuf, 416 .vidiocgmbuf = cx25821_vidiocgmbuf,
417#endif 417#endif
418#ifdef TUNER_FLAG 418#ifdef TUNER_FLAG
419 .vidioc_g_tuner = vidioc_g_tuner, 419 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
420 .vidioc_s_tuner = vidioc_s_tuner, 420 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
421 .vidioc_g_frequency = vidioc_g_frequency, 421 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
422 .vidioc_s_frequency = vidioc_s_frequency, 422 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
423#endif 423#endif
424#ifdef CONFIG_VIDEO_ADV_DEBUG 424#ifdef CONFIG_VIDEO_ADV_DEBUG
425 .vidioc_g_register = vidioc_g_register, 425 .vidioc_g_register = cx25821_vidioc_g_register,
426 .vidioc_s_register = vidioc_s_register, 426 .vidioc_s_register = cx25821_vidioc_s_register,
427#endif 427#endif
428}; 428};
429 429
diff --git a/drivers/staging/cx25821/cx25821-video3.c b/drivers/staging/cx25821/cx25821-video3.c
index 1e0f10abdbcd..cbc5cad24a08 100644
--- a/drivers/staging/cx25821/cx25821-video3.c
+++ b/drivers/staging/cx25821/cx25821-video3.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO3)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO3))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO3)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO3)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,13 +207,13 @@ static int video_release(struct file *file)
207 cx_write(channel3->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel3->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO3)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO3)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO3); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO3);
213 } 213 }
214 214
215 if (fh->vidq.read_buf) { 215 if (fh->vidq.read_buf) {
216 buffer_release(&fh->vidq, fh->vidq.read_buf); 216 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
217 kfree(fh->vidq.read_buf); 217 kfree(fh->vidq.read_buf);
218 } 218 }
219 219
@@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
239 return -EINVAL; 239 return -EINVAL;
240 } 240 }
241 241
242 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO3)))) { 242 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO3)))) {
243 return -EBUSY; 243 return -EBUSY;
244 } 244 }
245 245
@@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
257 if (i != fh->type) 257 if (i != fh->type)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 res = get_resource(fh, RESOURCE_VIDEO3); 260 res = cx25821_get_resource(fh, RESOURCE_VIDEO3);
261 err = videobuf_streamoff(get_queue(fh)); 261 err = videobuf_streamoff(get_queue(fh));
262 if (err < 0) 262 if (err < 0)
263 return err; 263 return err;
264 res_free(dev, fh, res); 264 cx25821_res_free(dev, fh, res);
265 return 0; 265 return 0;
266} 266}
267 267
@@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
280 } 280 }
281 281
282 dprintk(2, "%s()\n", __func__); 282 dprintk(2, "%s()\n", __func__);
283 err = vidioc_try_fmt_vid_cap(file, priv, f); 283 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
284 284
285 if (0 != err) 285 if (0 != err)
286 return err; 286 return err;
@@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
289 fh->vidq.field = f->fmt.pix.field; 289 fh->vidq.field = f->fmt.pix.field;
290 290
291 // check if width and height is valid based on set standard 291 // check if width and height is valid based on set standard
292 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 292 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
293 fh->width = f->fmt.pix.width; 293 fh->width = f->fmt.pix.width;
294 } 294 }
295 295
296 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 296 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
297 fh->height = f->fmt.pix.height; 297 fh->height = f->fmt.pix.height;
298 } 298 }
299 299
@@ -379,50 +379,50 @@ static const struct v4l2_file_operations video_fops = {
379 .release = video_release, 379 .release = video_release,
380 .read = video_read, 380 .read = video_read,
381 .poll = video_poll, 381 .poll = video_poll,
382 .mmap = video_mmap, 382 .mmap = cx25821_video_mmap,
383 .ioctl = video_ioctl2, 383 .ioctl = video_ioctl2,
384}; 384};
385 385
386static const struct v4l2_ioctl_ops video_ioctl_ops = { 386static const struct v4l2_ioctl_ops video_ioctl_ops = {
387 .vidioc_querycap = vidioc_querycap, 387 .vidioc_querycap = cx25821_vidioc_querycap,
388 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 388 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
389 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 389 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
390 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 390 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
391 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 391 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
392 .vidioc_reqbufs = vidioc_reqbufs, 392 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
393 .vidioc_querybuf = vidioc_querybuf, 393 .vidioc_querybuf = cx25821_vidioc_querybuf,
394 .vidioc_qbuf = vidioc_qbuf, 394 .vidioc_qbuf = cx25821_vidioc_qbuf,
395 .vidioc_dqbuf = vidioc_dqbuf, 395 .vidioc_dqbuf = vidioc_dqbuf,
396#ifdef TUNER_FLAG 396#ifdef TUNER_FLAG
397 .vidioc_s_std = vidioc_s_std, 397 .vidioc_s_std = cx25821_vidioc_s_std,
398 .vidioc_querystd = vidioc_querystd, 398 .vidioc_querystd = cx25821_vidioc_querystd,
399#endif 399#endif
400 .vidioc_cropcap = vidioc_cropcap, 400 .vidioc_cropcap = cx25821_vidioc_cropcap,
401 .vidioc_s_crop = vidioc_s_crop, 401 .vidioc_s_crop = cx25821_vidioc_s_crop,
402 .vidioc_g_crop = vidioc_g_crop, 402 .vidioc_g_crop = cx25821_vidioc_g_crop,
403 .vidioc_enum_input = vidioc_enum_input, 403 .vidioc_enum_input = cx25821_vidioc_enum_input,
404 .vidioc_g_input = vidioc_g_input, 404 .vidioc_g_input = cx25821_vidioc_g_input,
405 .vidioc_s_input = vidioc_s_input, 405 .vidioc_s_input = cx25821_vidioc_s_input,
406 .vidioc_g_ctrl = vidioc_g_ctrl, 406 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
407 .vidioc_s_ctrl = vidioc_s_ctrl, 407 .vidioc_s_ctrl = vidioc_s_ctrl,
408 .vidioc_queryctrl = vidioc_queryctrl, 408 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
409 .vidioc_streamon = vidioc_streamon, 409 .vidioc_streamon = vidioc_streamon,
410 .vidioc_streamoff = vidioc_streamoff, 410 .vidioc_streamoff = vidioc_streamoff,
411 .vidioc_log_status = vidioc_log_status, 411 .vidioc_log_status = vidioc_log_status,
412 .vidioc_g_priority = vidioc_g_priority, 412 .vidioc_g_priority = cx25821_vidioc_g_priority,
413 .vidioc_s_priority = vidioc_s_priority, 413 .vidioc_s_priority = cx25821_vidioc_s_priority,
414#ifdef CONFIG_VIDEO_V4L1_COMPAT 414#ifdef CONFIG_VIDEO_V4L1_COMPAT
415 .vidiocgmbuf = vidiocgmbuf, 415 .vidiocgmbuf = cx25821_vidiocgmbuf,
416#endif 416#endif
417#ifdef TUNER_FLAG 417#ifdef TUNER_FLAG
418 .vidioc_g_tuner = vidioc_g_tuner, 418 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
419 .vidioc_s_tuner = vidioc_s_tuner, 419 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
420 .vidioc_g_frequency = vidioc_g_frequency, 420 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
421 .vidioc_s_frequency = vidioc_s_frequency, 421 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
422#endif 422#endif
423#ifdef CONFIG_VIDEO_ADV_DEBUG 423#ifdef CONFIG_VIDEO_ADV_DEBUG
424 .vidioc_g_register = vidioc_g_register, 424 .vidioc_g_register = cx25821_vidioc_g_register,
425 .vidioc_s_register = vidioc_s_register, 425 .vidioc_s_register = cx25821_vidioc_s_register,
426#endif 426#endif
427}; 427};
428 428
diff --git a/drivers/staging/cx25821/cx25821-video4.c b/drivers/staging/cx25821/cx25821-video4.c
index 0cbe7a79d8c0..101074ad742c 100644
--- a/drivers/staging/cx25821/cx25821-video4.c
+++ b/drivers/staging/cx25821/cx25821-video4.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -146,7 +146,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
146 146
147 switch (fh->type) { 147 switch (fh->type) {
148 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 148 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
149 if (res_locked(fh->dev, RESOURCE_VIDEO4)) 149 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO4))
150 return -EBUSY; 150 return -EBUSY;
151 151
152 return videobuf_read_one(&fh->vidq, data, count, ppos, 152 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -164,7 +164,7 @@ static unsigned int video_poll(struct file *file,
164 struct cx25821_fh *fh = file->private_data; 164 struct cx25821_fh *fh = file->private_data;
165 struct cx25821_buffer *buf; 165 struct cx25821_buffer *buf;
166 166
167 if (res_check(fh, RESOURCE_VIDEO4)) { 167 if (cx25821_res_check(fh, RESOURCE_VIDEO4)) {
168 /* streaming capture */ 168 /* streaming capture */
169 if (list_empty(&fh->vidq.stream)) 169 if (list_empty(&fh->vidq.stream))
170 return POLLERR; 170 return POLLERR;
@@ -206,13 +206,13 @@ static int video_release(struct file *file)
206 cx_write(channel4->dma_ctl, 0); /* FIFO and RISC disable */ 206 cx_write(channel4->dma_ctl, 0); /* FIFO and RISC disable */
207 207
208 /* stop video capture */ 208 /* stop video capture */
209 if (res_check(fh, RESOURCE_VIDEO4)) { 209 if (cx25821_res_check(fh, RESOURCE_VIDEO4)) {
210 videobuf_queue_cancel(&fh->vidq); 210 videobuf_queue_cancel(&fh->vidq);
211 res_free(dev, fh, RESOURCE_VIDEO4); 211 cx25821_res_free(dev, fh, RESOURCE_VIDEO4);
212 } 212 }
213 213
214 if (fh->vidq.read_buf) { 214 if (fh->vidq.read_buf) {
215 buffer_release(&fh->vidq, fh->vidq.read_buf); 215 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
216 kfree(fh->vidq.read_buf); 216 kfree(fh->vidq.read_buf);
217 } 217 }
218 218
@@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
240 240
241 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO4)))) { 241 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO4)))) {
242 return -EBUSY; 242 return -EBUSY;
243 } 243 }
244 244
@@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
256 if (i != fh->type) 256 if (i != fh->type)
257 return -EINVAL; 257 return -EINVAL;
258 258
259 res = get_resource(fh, RESOURCE_VIDEO4); 259 res = cx25821_get_resource(fh, RESOURCE_VIDEO4);
260 err = videobuf_streamoff(get_queue(fh)); 260 err = videobuf_streamoff(get_queue(fh));
261 if (err < 0) 261 if (err < 0)
262 return err; 262 return err;
263 res_free(dev, fh, res); 263 cx25821_res_free(dev, fh, res);
264 return 0; 264 return 0;
265} 265}
266 266
@@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
279 return err; 279 return err;
280 } 280 }
281 dprintk(2, "%s()\n", __func__); 281 dprintk(2, "%s()\n", __func__);
282 err = vidioc_try_fmt_vid_cap(file, priv, f); 282 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
283 283
284 if (0 != err) 284 if (0 != err)
285 return err; 285 return err;
@@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
288 fh->vidq.field = f->fmt.pix.field; 288 fh->vidq.field = f->fmt.pix.field;
289 289
290 // check if width and height is valid based on set standard 290 // check if width and height is valid based on set standard
291 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 291 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
292 fh->width = f->fmt.pix.width; 292 fh->width = f->fmt.pix.width;
293 } 293 }
294 294
295 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 295 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
296 fh->height = f->fmt.pix.height; 296 fh->height = f->fmt.pix.height;
297 } 297 }
298 298
@@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = {
378 .release = video_release, 378 .release = video_release,
379 .read = video_read, 379 .read = video_read,
380 .poll = video_poll, 380 .poll = video_poll,
381 .mmap = video_mmap, 381 .mmap = cx25821_video_mmap,
382 .ioctl = video_ioctl2, 382 .ioctl = video_ioctl2,
383}; 383};
384 384
385static const struct v4l2_ioctl_ops video_ioctl_ops = { 385static const struct v4l2_ioctl_ops video_ioctl_ops = {
386 .vidioc_querycap = vidioc_querycap, 386 .vidioc_querycap = cx25821_vidioc_querycap,
387 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 387 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
388 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 388 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
389 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 389 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
391 .vidioc_reqbufs = vidioc_reqbufs, 391 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
392 .vidioc_querybuf = vidioc_querybuf, 392 .vidioc_querybuf = cx25821_vidioc_querybuf,
393 .vidioc_qbuf = vidioc_qbuf, 393 .vidioc_qbuf = cx25821_vidioc_qbuf,
394 .vidioc_dqbuf = vidioc_dqbuf, 394 .vidioc_dqbuf = vidioc_dqbuf,
395#ifdef TUNER_FLAG 395#ifdef TUNER_FLAG
396 .vidioc_s_std = vidioc_s_std, 396 .vidioc_s_std = cx25821_vidioc_s_std,
397 .vidioc_querystd = vidioc_querystd, 397 .vidioc_querystd = cx25821_vidioc_querystd,
398#endif 398#endif
399 .vidioc_cropcap = vidioc_cropcap, 399 .vidioc_cropcap = cx25821_vidioc_cropcap,
400 .vidioc_s_crop = vidioc_s_crop, 400 .vidioc_s_crop = cx25821_vidioc_s_crop,
401 .vidioc_g_crop = vidioc_g_crop, 401 .vidioc_g_crop = cx25821_vidioc_g_crop,
402 .vidioc_enum_input = vidioc_enum_input, 402 .vidioc_enum_input = cx25821_vidioc_enum_input,
403 .vidioc_g_input = vidioc_g_input, 403 .vidioc_g_input = cx25821_vidioc_g_input,
404 .vidioc_s_input = vidioc_s_input, 404 .vidioc_s_input = cx25821_vidioc_s_input,
405 .vidioc_g_ctrl = vidioc_g_ctrl, 405 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
406 .vidioc_s_ctrl = vidioc_s_ctrl, 406 .vidioc_s_ctrl = vidioc_s_ctrl,
407 .vidioc_queryctrl = vidioc_queryctrl, 407 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
408 .vidioc_streamon = vidioc_streamon, 408 .vidioc_streamon = vidioc_streamon,
409 .vidioc_streamoff = vidioc_streamoff, 409 .vidioc_streamoff = vidioc_streamoff,
410 .vidioc_log_status = vidioc_log_status, 410 .vidioc_log_status = vidioc_log_status,
411 .vidioc_g_priority = vidioc_g_priority, 411 .vidioc_g_priority = cx25821_vidioc_g_priority,
412 .vidioc_s_priority = vidioc_s_priority, 412 .vidioc_s_priority = cx25821_vidioc_s_priority,
413#ifdef CONFIG_VIDEO_V4L1_COMPAT 413#ifdef CONFIG_VIDEO_V4L1_COMPAT
414 .vidiocgmbuf = vidiocgmbuf, 414 .vidiocgmbuf = cx25821_vidiocgmbuf,
415#endif 415#endif
416#ifdef TUNER_FLAG 416#ifdef TUNER_FLAG
417 .vidioc_g_tuner = vidioc_g_tuner, 417 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 418 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
419 .vidioc_g_frequency = vidioc_g_frequency, 419 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
420 .vidioc_s_frequency = vidioc_s_frequency, 420 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
421#endif 421#endif
422#ifdef CONFIG_VIDEO_ADV_DEBUG 422#ifdef CONFIG_VIDEO_ADV_DEBUG
423 .vidioc_g_register = vidioc_g_register, 423 .vidioc_g_register = cx25821_vidioc_g_register,
424 .vidioc_s_register = vidioc_s_register, 424 .vidioc_s_register = cx25821_vidioc_s_register,
425#endif 425#endif
426}; 426};
427 427
diff --git a/drivers/staging/cx25821/cx25821-video5.c b/drivers/staging/cx25821/cx25821-video5.c
index 5dc08adc12e8..2019c5e3ea14 100644
--- a/drivers/staging/cx25821/cx25821-video5.c
+++ b/drivers/staging/cx25821/cx25821-video5.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO5)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO5))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO5)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO5)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,13 +207,13 @@ static int video_release(struct file *file)
207 cx_write(channel5->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel5->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO5)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO5)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO5); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO5);
213 } 213 }
214 214
215 if (fh->vidq.read_buf) { 215 if (fh->vidq.read_buf) {
216 buffer_release(&fh->vidq, fh->vidq.read_buf); 216 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
217 kfree(fh->vidq.read_buf); 217 kfree(fh->vidq.read_buf);
218 } 218 }
219 219
@@ -239,7 +239,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
239 return -EINVAL; 239 return -EINVAL;
240 } 240 }
241 241
242 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO5)))) { 242 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO5)))) {
243 return -EBUSY; 243 return -EBUSY;
244 } 244 }
245 245
@@ -257,11 +257,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
257 if (i != fh->type) 257 if (i != fh->type)
258 return -EINVAL; 258 return -EINVAL;
259 259
260 res = get_resource(fh, RESOURCE_VIDEO5); 260 res = cx25821_get_resource(fh, RESOURCE_VIDEO5);
261 err = videobuf_streamoff(get_queue(fh)); 261 err = videobuf_streamoff(get_queue(fh));
262 if (err < 0) 262 if (err < 0)
263 return err; 263 return err;
264 res_free(dev, fh, res); 264 cx25821_res_free(dev, fh, res);
265 return 0; 265 return 0;
266} 266}
267 267
@@ -280,7 +280,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
280 } 280 }
281 281
282 dprintk(2, "%s()\n", __func__); 282 dprintk(2, "%s()\n", __func__);
283 err = vidioc_try_fmt_vid_cap(file, priv, f); 283 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
284 284
285 if (0 != err) 285 if (0 != err)
286 return err; 286 return err;
@@ -289,11 +289,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
289 fh->vidq.field = f->fmt.pix.field; 289 fh->vidq.field = f->fmt.pix.field;
290 290
291 // check if width and height is valid based on set standard 291 // check if width and height is valid based on set standard
292 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 292 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
293 fh->width = f->fmt.pix.width; 293 fh->width = f->fmt.pix.width;
294 } 294 }
295 295
296 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 296 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
297 fh->height = f->fmt.pix.height; 297 fh->height = f->fmt.pix.height;
298 } 298 }
299 299
@@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = {
378 .release = video_release, 378 .release = video_release,
379 .read = video_read, 379 .read = video_read,
380 .poll = video_poll, 380 .poll = video_poll,
381 .mmap = video_mmap, 381 .mmap = cx25821_video_mmap,
382 .ioctl = video_ioctl2, 382 .ioctl = video_ioctl2,
383}; 383};
384 384
385static const struct v4l2_ioctl_ops video_ioctl_ops = { 385static const struct v4l2_ioctl_ops video_ioctl_ops = {
386 .vidioc_querycap = vidioc_querycap, 386 .vidioc_querycap = cx25821_vidioc_querycap,
387 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 387 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
388 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 388 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
389 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 389 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
391 .vidioc_reqbufs = vidioc_reqbufs, 391 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
392 .vidioc_querybuf = vidioc_querybuf, 392 .vidioc_querybuf = cx25821_vidioc_querybuf,
393 .vidioc_qbuf = vidioc_qbuf, 393 .vidioc_qbuf = cx25821_vidioc_qbuf,
394 .vidioc_dqbuf = vidioc_dqbuf, 394 .vidioc_dqbuf = vidioc_dqbuf,
395#ifdef TUNER_FLAG 395#ifdef TUNER_FLAG
396 .vidioc_s_std = vidioc_s_std, 396 .vidioc_s_std = cx25821_vidioc_s_std,
397 .vidioc_querystd = vidioc_querystd, 397 .vidioc_querystd = cx25821_vidioc_querystd,
398#endif 398#endif
399 .vidioc_cropcap = vidioc_cropcap, 399 .vidioc_cropcap = cx25821_vidioc_cropcap,
400 .vidioc_s_crop = vidioc_s_crop, 400 .vidioc_s_crop = cx25821_vidioc_s_crop,
401 .vidioc_g_crop = vidioc_g_crop, 401 .vidioc_g_crop = cx25821_vidioc_g_crop,
402 .vidioc_enum_input = vidioc_enum_input, 402 .vidioc_enum_input = cx25821_vidioc_enum_input,
403 .vidioc_g_input = vidioc_g_input, 403 .vidioc_g_input = cx25821_vidioc_g_input,
404 .vidioc_s_input = vidioc_s_input, 404 .vidioc_s_input = cx25821_vidioc_s_input,
405 .vidioc_g_ctrl = vidioc_g_ctrl, 405 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
406 .vidioc_s_ctrl = vidioc_s_ctrl, 406 .vidioc_s_ctrl = vidioc_s_ctrl,
407 .vidioc_queryctrl = vidioc_queryctrl, 407 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
408 .vidioc_streamon = vidioc_streamon, 408 .vidioc_streamon = vidioc_streamon,
409 .vidioc_streamoff = vidioc_streamoff, 409 .vidioc_streamoff = vidioc_streamoff,
410 .vidioc_log_status = vidioc_log_status, 410 .vidioc_log_status = vidioc_log_status,
411 .vidioc_g_priority = vidioc_g_priority, 411 .vidioc_g_priority = cx25821_vidioc_g_priority,
412 .vidioc_s_priority = vidioc_s_priority, 412 .vidioc_s_priority = cx25821_vidioc_s_priority,
413#ifdef CONFIG_VIDEO_V4L1_COMPAT 413#ifdef CONFIG_VIDEO_V4L1_COMPAT
414 .vidiocgmbuf = vidiocgmbuf, 414 .vidiocgmbuf = cx25821_vidiocgmbuf,
415#endif 415#endif
416#ifdef TUNER_FLAG 416#ifdef TUNER_FLAG
417 .vidioc_g_tuner = vidioc_g_tuner, 417 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 418 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
419 .vidioc_g_frequency = vidioc_g_frequency, 419 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
420 .vidioc_s_frequency = vidioc_s_frequency, 420 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
421#endif 421#endif
422#ifdef CONFIG_VIDEO_ADV_DEBUG 422#ifdef CONFIG_VIDEO_ADV_DEBUG
423 .vidioc_g_register = vidioc_g_register, 423 .vidioc_g_register = cx25821_vidioc_g_register,
424 .vidioc_s_register = vidioc_s_register, 424 .vidioc_s_register = cx25821_vidioc_s_register,
425#endif 425#endif
426}; 426};
427 427
diff --git a/drivers/staging/cx25821/cx25821-video6.c b/drivers/staging/cx25821/cx25821-video6.c
index 2938ad3ad3c5..d19c786e5a5f 100644
--- a/drivers/staging/cx25821/cx25821-video6.c
+++ b/drivers/staging/cx25821/cx25821-video6.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -147,7 +147,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
147 147
148 switch (fh->type) { 148 switch (fh->type) {
149 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 149 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
150 if (res_locked(fh->dev, RESOURCE_VIDEO6)) 150 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO6))
151 return -EBUSY; 151 return -EBUSY;
152 152
153 return videobuf_read_one(&fh->vidq, data, count, ppos, 153 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -165,7 +165,7 @@ static unsigned int video_poll(struct file *file,
165 struct cx25821_fh *fh = file->private_data; 165 struct cx25821_fh *fh = file->private_data;
166 struct cx25821_buffer *buf; 166 struct cx25821_buffer *buf;
167 167
168 if (res_check(fh, RESOURCE_VIDEO6)) { 168 if (cx25821_res_check(fh, RESOURCE_VIDEO6)) {
169 /* streaming capture */ 169 /* streaming capture */
170 if (list_empty(&fh->vidq.stream)) 170 if (list_empty(&fh->vidq.stream))
171 return POLLERR; 171 return POLLERR;
@@ -207,12 +207,12 @@ static int video_release(struct file *file)
207 cx_write(channel6->dma_ctl, 0); /* FIFO and RISC disable */ 207 cx_write(channel6->dma_ctl, 0); /* FIFO and RISC disable */
208 208
209 /* stop video capture */ 209 /* stop video capture */
210 if (res_check(fh, RESOURCE_VIDEO6)) { 210 if (cx25821_res_check(fh, RESOURCE_VIDEO6)) {
211 videobuf_queue_cancel(&fh->vidq); 211 videobuf_queue_cancel(&fh->vidq);
212 res_free(dev, fh, RESOURCE_VIDEO6); 212 cx25821_res_free(dev, fh, RESOURCE_VIDEO6);
213 } 213 }
214 if (fh->vidq.read_buf) { 214 if (fh->vidq.read_buf) {
215 buffer_release(&fh->vidq, fh->vidq.read_buf); 215 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
216 kfree(fh->vidq.read_buf); 216 kfree(fh->vidq.read_buf);
217 } 217 }
218 218
@@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
240 240
241 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO6)))) { 241 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO6)))) {
242 return -EBUSY; 242 return -EBUSY;
243 } 243 }
244 244
@@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
256 if (i != fh->type) 256 if (i != fh->type)
257 return -EINVAL; 257 return -EINVAL;
258 258
259 res = get_resource(fh, RESOURCE_VIDEO6); 259 res = cx25821_get_resource(fh, RESOURCE_VIDEO6);
260 err = videobuf_streamoff(get_queue(fh)); 260 err = videobuf_streamoff(get_queue(fh));
261 if (err < 0) 261 if (err < 0)
262 return err; 262 return err;
263 res_free(dev, fh, res); 263 cx25821_res_free(dev, fh, res);
264 return 0; 264 return 0;
265} 265}
266 266
@@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
279 } 279 }
280 280
281 dprintk(2, "%s()\n", __func__); 281 dprintk(2, "%s()\n", __func__);
282 err = vidioc_try_fmt_vid_cap(file, priv, f); 282 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
283 283
284 if (0 != err) 284 if (0 != err)
285 return err; 285 return err;
@@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
288 fh->vidq.field = f->fmt.pix.field; 288 fh->vidq.field = f->fmt.pix.field;
289 289
290 // check if width and height is valid based on set standard 290 // check if width and height is valid based on set standard
291 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 291 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
292 fh->width = f->fmt.pix.width; 292 fh->width = f->fmt.pix.width;
293 } 293 }
294 294
295 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 295 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
296 fh->height = f->fmt.pix.height; 296 fh->height = f->fmt.pix.height;
297 } 297 }
298 298
@@ -378,50 +378,50 @@ static const struct v4l2_file_operations video_fops = {
378 .release = video_release, 378 .release = video_release,
379 .read = video_read, 379 .read = video_read,
380 .poll = video_poll, 380 .poll = video_poll,
381 .mmap = video_mmap, 381 .mmap = cx25821_video_mmap,
382 .ioctl = video_ioctl2, 382 .ioctl = video_ioctl2,
383}; 383};
384 384
385static const struct v4l2_ioctl_ops video_ioctl_ops = { 385static const struct v4l2_ioctl_ops video_ioctl_ops = {
386 .vidioc_querycap = vidioc_querycap, 386 .vidioc_querycap = cx25821_vidioc_querycap,
387 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 387 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
388 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 388 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
389 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 389 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 390 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
391 .vidioc_reqbufs = vidioc_reqbufs, 391 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
392 .vidioc_querybuf = vidioc_querybuf, 392 .vidioc_querybuf = cx25821_vidioc_querybuf,
393 .vidioc_qbuf = vidioc_qbuf, 393 .vidioc_qbuf = cx25821_vidioc_qbuf,
394 .vidioc_dqbuf = vidioc_dqbuf, 394 .vidioc_dqbuf = vidioc_dqbuf,
395#ifdef TUNER_FLAG 395#ifdef TUNER_FLAG
396 .vidioc_s_std = vidioc_s_std, 396 .vidioc_s_std = cx25821_vidioc_s_std,
397 .vidioc_querystd = vidioc_querystd, 397 .vidioc_querystd = cx25821_vidioc_querystd,
398#endif 398#endif
399 .vidioc_cropcap = vidioc_cropcap, 399 .vidioc_cropcap = cx25821_vidioc_cropcap,
400 .vidioc_s_crop = vidioc_s_crop, 400 .vidioc_s_crop = cx25821_vidioc_s_crop,
401 .vidioc_g_crop = vidioc_g_crop, 401 .vidioc_g_crop = cx25821_vidioc_g_crop,
402 .vidioc_enum_input = vidioc_enum_input, 402 .vidioc_enum_input = cx25821_vidioc_enum_input,
403 .vidioc_g_input = vidioc_g_input, 403 .vidioc_g_input = cx25821_vidioc_g_input,
404 .vidioc_s_input = vidioc_s_input, 404 .vidioc_s_input = cx25821_vidioc_s_input,
405 .vidioc_g_ctrl = vidioc_g_ctrl, 405 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
406 .vidioc_s_ctrl = vidioc_s_ctrl, 406 .vidioc_s_ctrl = vidioc_s_ctrl,
407 .vidioc_queryctrl = vidioc_queryctrl, 407 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
408 .vidioc_streamon = vidioc_streamon, 408 .vidioc_streamon = vidioc_streamon,
409 .vidioc_streamoff = vidioc_streamoff, 409 .vidioc_streamoff = vidioc_streamoff,
410 .vidioc_log_status = vidioc_log_status, 410 .vidioc_log_status = vidioc_log_status,
411 .vidioc_g_priority = vidioc_g_priority, 411 .vidioc_g_priority = cx25821_vidioc_g_priority,
412 .vidioc_s_priority = vidioc_s_priority, 412 .vidioc_s_priority = cx25821_vidioc_s_priority,
413#ifdef CONFIG_VIDEO_V4L1_COMPAT 413#ifdef CONFIG_VIDEO_V4L1_COMPAT
414 .vidiocgmbuf = vidiocgmbuf, 414 .vidiocgmbuf = cx25821_vidiocgmbuf,
415#endif 415#endif
416#ifdef TUNER_FLAG 416#ifdef TUNER_FLAG
417 .vidioc_g_tuner = vidioc_g_tuner, 417 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
418 .vidioc_s_tuner = vidioc_s_tuner, 418 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
419 .vidioc_g_frequency = vidioc_g_frequency, 419 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
420 .vidioc_s_frequency = vidioc_s_frequency, 420 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
421#endif 421#endif
422#ifdef CONFIG_VIDEO_ADV_DEBUG 422#ifdef CONFIG_VIDEO_ADV_DEBUG
423 .vidioc_g_register = vidioc_g_register, 423 .vidioc_g_register = cx25821_vidioc_g_register,
424 .vidioc_s_register = vidioc_s_register, 424 .vidioc_s_register = cx25821_vidioc_s_register,
425#endif 425#endif
426}; 426};
427 427
diff --git a/drivers/staging/cx25821/cx25821-video7.c b/drivers/staging/cx25821/cx25821-video7.c
index 458e525d72af..8a7c854a0fc8 100644
--- a/drivers/staging/cx25821/cx25821-video7.c
+++ b/drivers/staging/cx25821/cx25821-video7.c
@@ -85,10 +85,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
85} 85}
86 86
87static struct videobuf_queue_ops cx25821_video_qops = { 87static struct videobuf_queue_ops cx25821_video_qops = {
88 .buf_setup = buffer_setup, 88 .buf_setup = cx25821_buffer_setup,
89 .buf_prepare = buffer_prepare, 89 .buf_prepare = cx25821_buffer_prepare,
90 .buf_queue = buffer_queue, 90 .buf_queue = buffer_queue,
91 .buf_release = buffer_release, 91 .buf_release = cx25821_buffer_release,
92}; 92};
93 93
94static int video_open(struct file *file) 94static int video_open(struct file *file)
@@ -146,7 +146,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
146 146
147 switch (fh->type) { 147 switch (fh->type) {
148 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 148 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
149 if (res_locked(fh->dev, RESOURCE_VIDEO7)) 149 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO7))
150 return -EBUSY; 150 return -EBUSY;
151 151
152 return videobuf_read_one(&fh->vidq, data, count, ppos, 152 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -164,7 +164,7 @@ static unsigned int video_poll(struct file *file,
164 struct cx25821_fh *fh = file->private_data; 164 struct cx25821_fh *fh = file->private_data;
165 struct cx25821_buffer *buf; 165 struct cx25821_buffer *buf;
166 166
167 if (res_check(fh, RESOURCE_VIDEO7)) { 167 if (cx25821_res_check(fh, RESOURCE_VIDEO7)) {
168 /* streaming capture */ 168 /* streaming capture */
169 if (list_empty(&fh->vidq.stream)) 169 if (list_empty(&fh->vidq.stream))
170 return POLLERR; 170 return POLLERR;
@@ -206,13 +206,13 @@ static int video_release(struct file *file)
206 cx_write(channel7->dma_ctl, 0); /* FIFO and RISC disable */ 206 cx_write(channel7->dma_ctl, 0); /* FIFO and RISC disable */
207 207
208 /* stop video capture */ 208 /* stop video capture */
209 if (res_check(fh, RESOURCE_VIDEO7)) { 209 if (cx25821_res_check(fh, RESOURCE_VIDEO7)) {
210 videobuf_queue_cancel(&fh->vidq); 210 videobuf_queue_cancel(&fh->vidq);
211 res_free(dev, fh, RESOURCE_VIDEO7); 211 cx25821_res_free(dev, fh, RESOURCE_VIDEO7);
212 } 212 }
213 213
214 if (fh->vidq.read_buf) { 214 if (fh->vidq.read_buf) {
215 buffer_release(&fh->vidq, fh->vidq.read_buf); 215 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
216 kfree(fh->vidq.read_buf); 216 kfree(fh->vidq.read_buf);
217 } 217 }
218 218
@@ -238,7 +238,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
238 return -EINVAL; 238 return -EINVAL;
239 } 239 }
240 240
241 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO7)))) { 241 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO7)))) {
242 return -EBUSY; 242 return -EBUSY;
243 } 243 }
244 244
@@ -256,11 +256,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
256 if (i != fh->type) 256 if (i != fh->type)
257 return -EINVAL; 257 return -EINVAL;
258 258
259 res = get_resource(fh, RESOURCE_VIDEO7); 259 res = cx25821_get_resource(fh, RESOURCE_VIDEO7);
260 err = videobuf_streamoff(get_queue(fh)); 260 err = videobuf_streamoff(get_queue(fh));
261 if (err < 0) 261 if (err < 0)
262 return err; 262 return err;
263 res_free(dev, fh, res); 263 cx25821_res_free(dev, fh, res);
264 return 0; 264 return 0;
265} 265}
266 266
@@ -279,7 +279,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
279 } 279 }
280 280
281 dprintk(2, "%s()\n", __func__); 281 dprintk(2, "%s()\n", __func__);
282 err = vidioc_try_fmt_vid_cap(file, priv, f); 282 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
283 283
284 if (0 != err) 284 if (0 != err)
285 return err; 285 return err;
@@ -288,11 +288,11 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
288 fh->vidq.field = f->fmt.pix.field; 288 fh->vidq.field = f->fmt.pix.field;
289 289
290 // check if width and height is valid based on set standard 290 // check if width and height is valid based on set standard
291 if (is_valid_width(f->fmt.pix.width, dev->tvnorm)) { 291 if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) {
292 fh->width = f->fmt.pix.width; 292 fh->width = f->fmt.pix.width;
293 } 293 }
294 294
295 if (is_valid_height(f->fmt.pix.height, dev->tvnorm)) { 295 if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) {
296 fh->height = f->fmt.pix.height; 296 fh->height = f->fmt.pix.height;
297 } 297 }
298 298
@@ -377,50 +377,50 @@ static const struct v4l2_file_operations video_fops = {
377 .release = video_release, 377 .release = video_release,
378 .read = video_read, 378 .read = video_read,
379 .poll = video_poll, 379 .poll = video_poll,
380 .mmap = video_mmap, 380 .mmap = cx25821_video_mmap,
381 .ioctl = video_ioctl2, 381 .ioctl = video_ioctl2,
382}; 382};
383 383
384static const struct v4l2_ioctl_ops video_ioctl_ops = { 384static const struct v4l2_ioctl_ops video_ioctl_ops = {
385 .vidioc_querycap = vidioc_querycap, 385 .vidioc_querycap = cx25821_vidioc_querycap,
386 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 386 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
387 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 387 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
388 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 388 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
389 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 389 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
390 .vidioc_reqbufs = vidioc_reqbufs, 390 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
391 .vidioc_querybuf = vidioc_querybuf, 391 .vidioc_querybuf = cx25821_vidioc_querybuf,
392 .vidioc_qbuf = vidioc_qbuf, 392 .vidioc_qbuf = cx25821_vidioc_qbuf,
393 .vidioc_dqbuf = vidioc_dqbuf, 393 .vidioc_dqbuf = vidioc_dqbuf,
394#ifdef TUNER_FLAG 394#ifdef TUNER_FLAG
395 .vidioc_s_std = vidioc_s_std, 395 .vidioc_s_std = cx25821_vidioc_s_std,
396 .vidioc_querystd = vidioc_querystd, 396 .vidioc_querystd = cx25821_vidioc_querystd,
397#endif 397#endif
398 .vidioc_cropcap = vidioc_cropcap, 398 .vidioc_cropcap = cx25821_vidioc_cropcap,
399 .vidioc_s_crop = vidioc_s_crop, 399 .vidioc_s_crop = cx25821_vidioc_s_crop,
400 .vidioc_g_crop = vidioc_g_crop, 400 .vidioc_g_crop = cx25821_vidioc_g_crop,
401 .vidioc_enum_input = vidioc_enum_input, 401 .vidioc_enum_input = cx25821_vidioc_enum_input,
402 .vidioc_g_input = vidioc_g_input, 402 .vidioc_g_input = cx25821_vidioc_g_input,
403 .vidioc_s_input = vidioc_s_input, 403 .vidioc_s_input = cx25821_vidioc_s_input,
404 .vidioc_g_ctrl = vidioc_g_ctrl, 404 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
405 .vidioc_s_ctrl = vidioc_s_ctrl, 405 .vidioc_s_ctrl = vidioc_s_ctrl,
406 .vidioc_queryctrl = vidioc_queryctrl, 406 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
407 .vidioc_streamon = vidioc_streamon, 407 .vidioc_streamon = vidioc_streamon,
408 .vidioc_streamoff = vidioc_streamoff, 408 .vidioc_streamoff = vidioc_streamoff,
409 .vidioc_log_status = vidioc_log_status, 409 .vidioc_log_status = vidioc_log_status,
410 .vidioc_g_priority = vidioc_g_priority, 410 .vidioc_g_priority = cx25821_vidioc_g_priority,
411 .vidioc_s_priority = vidioc_s_priority, 411 .vidioc_s_priority = cx25821_vidioc_s_priority,
412#ifdef CONFIG_VIDEO_V4L1_COMPAT 412#ifdef CONFIG_VIDEO_V4L1_COMPAT
413 .vidiocgmbuf = vidiocgmbuf, 413 .vidiocgmbuf = cx25821_vidiocgmbuf,
414#endif 414#endif
415#ifdef TUNER_FLAG 415#ifdef TUNER_FLAG
416 .vidioc_g_tuner = vidioc_g_tuner, 416 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
417 .vidioc_s_tuner = vidioc_s_tuner, 417 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
418 .vidioc_g_frequency = vidioc_g_frequency, 418 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
419 .vidioc_s_frequency = vidioc_s_frequency, 419 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
420#endif 420#endif
421#ifdef CONFIG_VIDEO_ADV_DEBUG 421#ifdef CONFIG_VIDEO_ADV_DEBUG
422 .vidioc_g_register = vidioc_g_register, 422 .vidioc_g_register = cx25821_vidioc_g_register,
423 .vidioc_s_register = vidioc_s_register, 423 .vidioc_s_register = cx25821_vidioc_s_register,
424#endif 424#endif
425}; 425};
426 426
diff --git a/drivers/staging/cx25821/cx25821-videoioctl.c b/drivers/staging/cx25821/cx25821-videoioctl.c
index 1da52b54a454..840714a9415f 100644
--- a/drivers/staging/cx25821/cx25821-videoioctl.c
+++ b/drivers/staging/cx25821/cx25821-videoioctl.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -145,7 +145,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
145 145
146 switch (fh->type) { 146 switch (fh->type) {
147 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 147 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
148 if (res_locked(fh->dev, RESOURCE_VIDEO_IOCTL)) 148 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO_IOCTL))
149 return -EBUSY; 149 return -EBUSY;
150 150
151 return videobuf_read_one(&fh->vidq, data, count, ppos, 151 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -163,7 +163,7 @@ static unsigned int video_poll(struct file *file,
163 struct cx25821_fh *fh = file->private_data; 163 struct cx25821_fh *fh = file->private_data;
164 struct cx25821_buffer *buf; 164 struct cx25821_buffer *buf;
165 165
166 if (res_check(fh, RESOURCE_VIDEO_IOCTL)) { 166 if (cx25821_res_check(fh, RESOURCE_VIDEO_IOCTL)) {
167 /* streaming capture */ 167 /* streaming capture */
168 if (list_empty(&fh->vidq.stream)) 168 if (list_empty(&fh->vidq.stream))
169 return POLLERR; 169 return POLLERR;
@@ -189,13 +189,13 @@ static int video_release(struct file *file)
189 struct cx25821_dev *dev = fh->dev; 189 struct cx25821_dev *dev = fh->dev;
190 190
191 /* stop video capture */ 191 /* stop video capture */
192 if (res_check(fh, RESOURCE_VIDEO_IOCTL)) { 192 if (cx25821_res_check(fh, RESOURCE_VIDEO_IOCTL)) {
193 videobuf_queue_cancel(&fh->vidq); 193 videobuf_queue_cancel(&fh->vidq);
194 res_free(dev, fh, RESOURCE_VIDEO_IOCTL); 194 cx25821_res_free(dev, fh, RESOURCE_VIDEO_IOCTL);
195 } 195 }
196 196
197 if (fh->vidq.read_buf) { 197 if (fh->vidq.read_buf) {
198 buffer_release(&fh->vidq, fh->vidq.read_buf); 198 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
199 kfree(fh->vidq.read_buf); 199 kfree(fh->vidq.read_buf);
200 } 200 }
201 201
@@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
222 return -EINVAL; 222 return -EINVAL;
223 } 223 }
224 224
225 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO_IOCTL)))) { 225 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO_IOCTL)))) {
226 return -EBUSY; 226 return -EBUSY;
227 } 227 }
228 228
@@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
240 if (i != fh->type) 240 if (i != fh->type)
241 return -EINVAL; 241 return -EINVAL;
242 242
243 res = get_resource(fh, RESOURCE_VIDEO_IOCTL); 243 res = cx25821_get_resource(fh, RESOURCE_VIDEO_IOCTL);
244 err = videobuf_streamoff(get_queue(fh)); 244 err = videobuf_streamoff(get_queue(fh));
245 if (err < 0) 245 if (err < 0)
246 return err; 246 return err;
247 res_free(dev, fh, res); 247 cx25821_res_free(dev, fh, res);
248 return 0; 248 return 0;
249} 249}
250 250
@@ -262,7 +262,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
262 } 262 }
263 263
264 dprintk(2, "%s()\n", __func__); 264 dprintk(2, "%s()\n", __func__);
265 err = vidioc_try_fmt_vid_cap(file, priv, f); 265 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
266 266
267 if (0 != err) 267 if (0 != err)
268 return err; 268 return err;
@@ -424,50 +424,50 @@ static const struct v4l2_file_operations video_fops = {
424 .release = video_release, 424 .release = video_release,
425 .read = video_read, 425 .read = video_read,
426 .poll = video_poll, 426 .poll = video_poll,
427 .mmap = video_mmap, 427 .mmap = cx25821_video_mmap,
428 .ioctl = video_ioctl_set, 428 .ioctl = video_ioctl_set,
429}; 429};
430 430
431static const struct v4l2_ioctl_ops video_ioctl_ops = { 431static const struct v4l2_ioctl_ops video_ioctl_ops = {
432 .vidioc_querycap = vidioc_querycap, 432 .vidioc_querycap = cx25821_vidioc_querycap,
433 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 433 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
434 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 434 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
435 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 435 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
436 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 436 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
437 .vidioc_reqbufs = vidioc_reqbufs, 437 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
438 .vidioc_querybuf = vidioc_querybuf, 438 .vidioc_querybuf = cx25821_vidioc_querybuf,
439 .vidioc_qbuf = vidioc_qbuf, 439 .vidioc_qbuf = cx25821_vidioc_qbuf,
440 .vidioc_dqbuf = vidioc_dqbuf, 440 .vidioc_dqbuf = vidioc_dqbuf,
441#ifdef TUNER_FLAG 441#ifdef TUNER_FLAG
442 .vidioc_s_std = vidioc_s_std, 442 .vidioc_s_std = cx25821_vidioc_s_std,
443 .vidioc_querystd = vidioc_querystd, 443 .vidioc_querystd = cx25821_vidioc_querystd,
444#endif 444#endif
445 .vidioc_cropcap = vidioc_cropcap, 445 .vidioc_cropcap = cx25821_vidioc_cropcap,
446 .vidioc_s_crop = vidioc_s_crop, 446 .vidioc_s_crop = cx25821_vidioc_s_crop,
447 .vidioc_g_crop = vidioc_g_crop, 447 .vidioc_g_crop = cx25821_vidioc_g_crop,
448 .vidioc_enum_input = vidioc_enum_input, 448 .vidioc_enum_input = cx25821_vidioc_enum_input,
449 .vidioc_g_input = vidioc_g_input, 449 .vidioc_g_input = cx25821_vidioc_g_input,
450 .vidioc_s_input = vidioc_s_input, 450 .vidioc_s_input = cx25821_vidioc_s_input,
451 .vidioc_g_ctrl = vidioc_g_ctrl, 451 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
452 .vidioc_s_ctrl = vidioc_s_ctrl, 452 .vidioc_s_ctrl = vidioc_s_ctrl,
453 .vidioc_queryctrl = vidioc_queryctrl, 453 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
454 .vidioc_streamon = vidioc_streamon, 454 .vidioc_streamon = vidioc_streamon,
455 .vidioc_streamoff = vidioc_streamoff, 455 .vidioc_streamoff = vidioc_streamoff,
456 .vidioc_log_status = vidioc_log_status, 456 .vidioc_log_status = vidioc_log_status,
457 .vidioc_g_priority = vidioc_g_priority, 457 .vidioc_g_priority = cx25821_vidioc_g_priority,
458 .vidioc_s_priority = vidioc_s_priority, 458 .vidioc_s_priority = cx25821_vidioc_s_priority,
459#ifdef CONFIG_VIDEO_V4L1_COMPAT 459#ifdef CONFIG_VIDEO_V4L1_COMPAT
460 .vidiocgmbuf = vidiocgmbuf, 460 .vidiocgmbuf = cx25821_vidiocgmbuf,
461#endif 461#endif
462#ifdef TUNER_FLAG 462#ifdef TUNER_FLAG
463 .vidioc_g_tuner = vidioc_g_tuner, 463 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
464 .vidioc_s_tuner = vidioc_s_tuner, 464 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
465 .vidioc_g_frequency = vidioc_g_frequency, 465 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
466 .vidioc_s_frequency = vidioc_s_frequency, 466 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
467#endif 467#endif
468#ifdef CONFIG_VIDEO_ADV_DEBUG 468#ifdef CONFIG_VIDEO_ADV_DEBUG
469 .vidioc_g_register = vidioc_g_register, 469 .vidioc_g_register = cx25821_vidioc_g_register,
470 .vidioc_s_register = vidioc_s_register, 470 .vidioc_s_register = cx25821_vidioc_s_register,
471#endif 471#endif
472}; 472};
473 473
diff --git a/drivers/staging/cx25821/cx25821-vidups10.c b/drivers/staging/cx25821/cx25821-vidups10.c
index b76d9f62c3d1..89c8592e5f02 100644
--- a/drivers/staging/cx25821/cx25821-vidups10.c
+++ b/drivers/staging/cx25821/cx25821-vidups10.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -143,7 +143,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
143 143
144 switch (fh->type) { 144 switch (fh->type) {
145 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 145 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
146 if (res_locked(fh->dev, RESOURCE_VIDEO10)) 146 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO10))
147 return -EBUSY; 147 return -EBUSY;
148 148
149 return videobuf_read_one(&fh->vidq, data, count, ppos, 149 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -161,7 +161,7 @@ static unsigned int video_poll(struct file *file,
161 struct cx25821_fh *fh = file->private_data; 161 struct cx25821_fh *fh = file->private_data;
162 struct cx25821_buffer *buf; 162 struct cx25821_buffer *buf;
163 163
164 if (res_check(fh, RESOURCE_VIDEO10)) { 164 if (cx25821_res_check(fh, RESOURCE_VIDEO10)) {
165 /* streaming capture */ 165 /* streaming capture */
166 if (list_empty(&fh->vidq.stream)) 166 if (list_empty(&fh->vidq.stream))
167 return POLLERR; 167 return POLLERR;
@@ -189,13 +189,13 @@ static int video_release(struct file *file)
189 //cx_write(channel10->dma_ctl, 0); 189 //cx_write(channel10->dma_ctl, 0);
190 190
191 /* stop video capture */ 191 /* stop video capture */
192 if (res_check(fh, RESOURCE_VIDEO10)) { 192 if (cx25821_res_check(fh, RESOURCE_VIDEO10)) {
193 videobuf_queue_cancel(&fh->vidq); 193 videobuf_queue_cancel(&fh->vidq);
194 res_free(dev, fh, RESOURCE_VIDEO10); 194 cx25821_res_free(dev, fh, RESOURCE_VIDEO10);
195 } 195 }
196 196
197 if (fh->vidq.read_buf) { 197 if (fh->vidq.read_buf) {
198 buffer_release(&fh->vidq, fh->vidq.read_buf); 198 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
199 kfree(fh->vidq.read_buf); 199 kfree(fh->vidq.read_buf);
200 } 200 }
201 201
@@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
222 return -EINVAL; 222 return -EINVAL;
223 } 223 }
224 224
225 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO10)))) { 225 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO10)))) {
226 return -EBUSY; 226 return -EBUSY;
227 } 227 }
228 228
@@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
240 if (i != fh->type) 240 if (i != fh->type)
241 return -EINVAL; 241 return -EINVAL;
242 242
243 res = get_resource(fh, RESOURCE_VIDEO10); 243 res = cx25821_get_resource(fh, RESOURCE_VIDEO10);
244 err = videobuf_streamoff(get_queue(fh)); 244 err = videobuf_streamoff(get_queue(fh));
245 if (err < 0) 245 if (err < 0)
246 return err; 246 return err;
247 res_free(dev, fh, res); 247 cx25821_res_free(dev, fh, res);
248 return 0; 248 return 0;
249} 249}
250 250
@@ -305,7 +305,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
305 } 305 }
306 306
307 dprintk(2, "%s()\n", __func__); 307 dprintk(2, "%s()\n", __func__);
308 err = vidioc_try_fmt_vid_cap(file, priv, f); 308 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
309 309
310 if (0 != err) 310 if (0 != err)
311 return err; 311 return err;
@@ -362,50 +362,50 @@ static const struct v4l2_file_operations video_fops = {
362 .release = video_release, 362 .release = video_release,
363 .read = video_read, 363 .read = video_read,
364 .poll = video_poll, 364 .poll = video_poll,
365 .mmap = video_mmap, 365 .mmap = cx25821_video_mmap,
366 .ioctl = video_ioctl_upstream10, 366 .ioctl = video_ioctl_upstream10,
367}; 367};
368 368
369static const struct v4l2_ioctl_ops video_ioctl_ops = { 369static const struct v4l2_ioctl_ops video_ioctl_ops = {
370 .vidioc_querycap = vidioc_querycap, 370 .vidioc_querycap = cx25821_vidioc_querycap,
371 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 371 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
372 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 372 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
373 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 373 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
374 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 374 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
375 .vidioc_reqbufs = vidioc_reqbufs, 375 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
376 .vidioc_querybuf = vidioc_querybuf, 376 .vidioc_querybuf = cx25821_vidioc_querybuf,
377 .vidioc_qbuf = vidioc_qbuf, 377 .vidioc_qbuf = cx25821_vidioc_qbuf,
378 .vidioc_dqbuf = vidioc_dqbuf, 378 .vidioc_dqbuf = vidioc_dqbuf,
379#ifdef TUNER_FLAG 379#ifdef TUNER_FLAG
380 .vidioc_s_std = vidioc_s_std, 380 .vidioc_s_std = cx25821_vidioc_s_std,
381 .vidioc_querystd = vidioc_querystd, 381 .vidioc_querystd = cx25821_vidioc_querystd,
382#endif 382#endif
383 .vidioc_cropcap = vidioc_cropcap, 383 .vidioc_cropcap = cx25821_vidioc_cropcap,
384 .vidioc_s_crop = vidioc_s_crop, 384 .vidioc_s_crop = cx25821_vidioc_s_crop,
385 .vidioc_g_crop = vidioc_g_crop, 385 .vidioc_g_crop = cx25821_vidioc_g_crop,
386 .vidioc_enum_input = vidioc_enum_input, 386 .vidioc_enum_input = cx25821_vidioc_enum_input,
387 .vidioc_g_input = vidioc_g_input, 387 .vidioc_g_input = cx25821_vidioc_g_input,
388 .vidioc_s_input = vidioc_s_input, 388 .vidioc_s_input = cx25821_vidioc_s_input,
389 .vidioc_g_ctrl = vidioc_g_ctrl, 389 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
390 .vidioc_s_ctrl = vidioc_s_ctrl, 390 .vidioc_s_ctrl = vidioc_s_ctrl,
391 .vidioc_queryctrl = vidioc_queryctrl, 391 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
392 .vidioc_streamon = vidioc_streamon, 392 .vidioc_streamon = vidioc_streamon,
393 .vidioc_streamoff = vidioc_streamoff, 393 .vidioc_streamoff = vidioc_streamoff,
394 .vidioc_log_status = vidioc_log_status, 394 .vidioc_log_status = vidioc_log_status,
395 .vidioc_g_priority = vidioc_g_priority, 395 .vidioc_g_priority = cx25821_vidioc_g_priority,
396 .vidioc_s_priority = vidioc_s_priority, 396 .vidioc_s_priority = cx25821_vidioc_s_priority,
397#ifdef CONFIG_VIDEO_V4L1_COMPAT 397#ifdef CONFIG_VIDEO_V4L1_COMPAT
398 .vidiocgmbuf = vidiocgmbuf, 398 .vidiocgmbuf = cx25821_vidiocgmbuf,
399#endif 399#endif
400#ifdef TUNER_FLAG 400#ifdef TUNER_FLAG
401 .vidioc_g_tuner = vidioc_g_tuner, 401 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
402 .vidioc_s_tuner = vidioc_s_tuner, 402 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
403 .vidioc_g_frequency = vidioc_g_frequency, 403 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
404 .vidioc_s_frequency = vidioc_s_frequency, 404 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
405#endif 405#endif
406#ifdef CONFIG_VIDEO_ADV_DEBUG 406#ifdef CONFIG_VIDEO_ADV_DEBUG
407 .vidioc_g_register = vidioc_g_register, 407 .vidioc_g_register = cx25821_vidioc_g_register,
408 .vidioc_s_register = vidioc_s_register, 408 .vidioc_s_register = cx25821_vidioc_s_register,
409#endif 409#endif
410}; 410};
411 411
diff --git a/drivers/staging/cx25821/cx25821-vidups9.c b/drivers/staging/cx25821/cx25821-vidups9.c
index 1580da3b29aa..c8e8083c7934 100644
--- a/drivers/staging/cx25821/cx25821-vidups9.c
+++ b/drivers/staging/cx25821/cx25821-vidups9.c
@@ -86,10 +86,10 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
86} 86}
87 87
88static struct videobuf_queue_ops cx25821_video_qops = { 88static struct videobuf_queue_ops cx25821_video_qops = {
89 .buf_setup = buffer_setup, 89 .buf_setup = cx25821_buffer_setup,
90 .buf_prepare = buffer_prepare, 90 .buf_prepare = cx25821_buffer_prepare,
91 .buf_queue = buffer_queue, 91 .buf_queue = buffer_queue,
92 .buf_release = buffer_release, 92 .buf_release = cx25821_buffer_release,
93}; 93};
94 94
95static int video_open(struct file *file) 95static int video_open(struct file *file)
@@ -143,7 +143,7 @@ static ssize_t video_read(struct file *file, char __user * data, size_t count,
143 143
144 switch (fh->type) { 144 switch (fh->type) {
145 case V4L2_BUF_TYPE_VIDEO_CAPTURE: 145 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
146 if (res_locked(fh->dev, RESOURCE_VIDEO9)) 146 if (cx25821_res_locked(fh->dev, RESOURCE_VIDEO9))
147 return -EBUSY; 147 return -EBUSY;
148 148
149 return videobuf_read_one(&fh->vidq, data, count, ppos, 149 return videobuf_read_one(&fh->vidq, data, count, ppos,
@@ -161,7 +161,7 @@ static unsigned int video_poll(struct file *file,
161 struct cx25821_fh *fh = file->private_data; 161 struct cx25821_fh *fh = file->private_data;
162 struct cx25821_buffer *buf; 162 struct cx25821_buffer *buf;
163 163
164 if (res_check(fh, RESOURCE_VIDEO9)) { 164 if (cx25821_res_check(fh, RESOURCE_VIDEO9)) {
165 /* streaming capture */ 165 /* streaming capture */
166 if (list_empty(&fh->vidq.stream)) 166 if (list_empty(&fh->vidq.stream))
167 return POLLERR; 167 return POLLERR;
@@ -189,13 +189,13 @@ static int video_release(struct file *file)
189 //cx_write(channel9->dma_ctl, 0); 189 //cx_write(channel9->dma_ctl, 0);
190 190
191 /* stop video capture */ 191 /* stop video capture */
192 if (res_check(fh, RESOURCE_VIDEO9)) { 192 if (cx25821_res_check(fh, RESOURCE_VIDEO9)) {
193 videobuf_queue_cancel(&fh->vidq); 193 videobuf_queue_cancel(&fh->vidq);
194 res_free(dev, fh, RESOURCE_VIDEO9); 194 cx25821_res_free(dev, fh, RESOURCE_VIDEO9);
195 } 195 }
196 196
197 if (fh->vidq.read_buf) { 197 if (fh->vidq.read_buf) {
198 buffer_release(&fh->vidq, fh->vidq.read_buf); 198 cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
199 kfree(fh->vidq.read_buf); 199 kfree(fh->vidq.read_buf);
200 } 200 }
201 201
@@ -222,7 +222,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
222 return -EINVAL; 222 return -EINVAL;
223 } 223 }
224 224
225 if (unlikely(!res_get(dev, fh, get_resource(fh, RESOURCE_VIDEO9)))) { 225 if (unlikely(!cx25821_res_get(dev, fh, cx25821_get_resource(fh, RESOURCE_VIDEO9)))) {
226 return -EBUSY; 226 return -EBUSY;
227 } 227 }
228 228
@@ -240,11 +240,11 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
240 if (i != fh->type) 240 if (i != fh->type)
241 return -EINVAL; 241 return -EINVAL;
242 242
243 res = get_resource(fh, RESOURCE_VIDEO9); 243 res = cx25821_get_resource(fh, RESOURCE_VIDEO9);
244 err = videobuf_streamoff(get_queue(fh)); 244 err = videobuf_streamoff(get_queue(fh));
245 if (err < 0) 245 if (err < 0)
246 return err; 246 return err;
247 res_free(dev, fh, res); 247 cx25821_res_free(dev, fh, res);
248 return 0; 248 return 0;
249} 249}
250 250
@@ -305,7 +305,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
305 } 305 }
306 306
307 dprintk(2, "%s()\n", __func__); 307 dprintk(2, "%s()\n", __func__);
308 err = vidioc_try_fmt_vid_cap(file, priv, f); 308 err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
309 309
310 if (0 != err) 310 if (0 != err)
311 return err; 311 return err;
@@ -360,50 +360,50 @@ static const struct v4l2_file_operations video_fops = {
360 .release = video_release, 360 .release = video_release,
361 .read = video_read, 361 .read = video_read,
362 .poll = video_poll, 362 .poll = video_poll,
363 .mmap = video_mmap, 363 .mmap = cx25821_video_mmap,
364 .ioctl = video_ioctl_upstream9, 364 .ioctl = video_ioctl_upstream9,
365}; 365};
366 366
367static const struct v4l2_ioctl_ops video_ioctl_ops = { 367static const struct v4l2_ioctl_ops video_ioctl_ops = {
368 .vidioc_querycap = vidioc_querycap, 368 .vidioc_querycap = cx25821_vidioc_querycap,
369 .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, 369 .vidioc_enum_fmt_vid_cap = cx25821_vidioc_enum_fmt_vid_cap,
370 .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, 370 .vidioc_g_fmt_vid_cap = cx25821_vidioc_g_fmt_vid_cap,
371 .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, 371 .vidioc_try_fmt_vid_cap = cx25821_vidioc_try_fmt_vid_cap,
372 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, 372 .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap,
373 .vidioc_reqbufs = vidioc_reqbufs, 373 .vidioc_reqbufs = cx25821_vidioc_reqbufs,
374 .vidioc_querybuf = vidioc_querybuf, 374 .vidioc_querybuf = cx25821_vidioc_querybuf,
375 .vidioc_qbuf = vidioc_qbuf, 375 .vidioc_qbuf = cx25821_vidioc_qbuf,
376 .vidioc_dqbuf = vidioc_dqbuf, 376 .vidioc_dqbuf = vidioc_dqbuf,
377#ifdef TUNER_FLAG 377#ifdef TUNER_FLAG
378 .vidioc_s_std = vidioc_s_std, 378 .vidioc_s_std = cx25821_vidioc_s_std,
379 .vidioc_querystd = vidioc_querystd, 379 .vidioc_querystd = cx25821_vidioc_querystd,
380#endif 380#endif
381 .vidioc_cropcap = vidioc_cropcap, 381 .vidioc_cropcap = cx25821_vidioc_cropcap,
382 .vidioc_s_crop = vidioc_s_crop, 382 .vidioc_s_crop = cx25821_vidioc_s_crop,
383 .vidioc_g_crop = vidioc_g_crop, 383 .vidioc_g_crop = cx25821_vidioc_g_crop,
384 .vidioc_enum_input = vidioc_enum_input, 384 .vidioc_enum_input = cx25821_vidioc_enum_input,
385 .vidioc_g_input = vidioc_g_input, 385 .vidioc_g_input = cx25821_vidioc_g_input,
386 .vidioc_s_input = vidioc_s_input, 386 .vidioc_s_input = cx25821_vidioc_s_input,
387 .vidioc_g_ctrl = vidioc_g_ctrl, 387 .vidioc_g_ctrl = cx25821_vidioc_g_ctrl,
388 .vidioc_s_ctrl = vidioc_s_ctrl, 388 .vidioc_s_ctrl = vidioc_s_ctrl,
389 .vidioc_queryctrl = vidioc_queryctrl, 389 .vidioc_queryctrl = cx25821_vidioc_queryctrl,
390 .vidioc_streamon = vidioc_streamon, 390 .vidioc_streamon = vidioc_streamon,
391 .vidioc_streamoff = vidioc_streamoff, 391 .vidioc_streamoff = vidioc_streamoff,
392 .vidioc_log_status = vidioc_log_status, 392 .vidioc_log_status = vidioc_log_status,
393 .vidioc_g_priority = vidioc_g_priority, 393 .vidioc_g_priority = cx25821_vidioc_g_priority,
394 .vidioc_s_priority = vidioc_s_priority, 394 .vidioc_s_priority = cx25821_vidioc_s_priority,
395#ifdef CONFIG_VIDEO_V4L1_COMPAT 395#ifdef CONFIG_VIDEO_V4L1_COMPAT
396 .vidiocgmbuf = vidiocgmbuf, 396 .vidiocgmbuf = cx25821_vidiocgmbuf,
397#endif 397#endif
398#ifdef TUNER_FLAG 398#ifdef TUNER_FLAG
399 .vidioc_g_tuner = vidioc_g_tuner, 399 .vidioc_g_tuner = cx25821_vidioc_g_tuner,
400 .vidioc_s_tuner = vidioc_s_tuner, 400 .vidioc_s_tuner = cx25821_vidioc_s_tuner,
401 .vidioc_g_frequency = vidioc_g_frequency, 401 .vidioc_g_frequency = cx25821_vidioc_g_frequency,
402 .vidioc_s_frequency = vidioc_s_frequency, 402 .vidioc_s_frequency = cx25821_vidioc_s_frequency,
403#endif 403#endif
404#ifdef CONFIG_VIDEO_ADV_DEBUG 404#ifdef CONFIG_VIDEO_ADV_DEBUG
405 .vidioc_g_register = vidioc_g_register, 405 .vidioc_g_register = cx25821_vidioc_g_register,
406 .vidioc_s_register = vidioc_s_register, 406 .vidioc_s_register = cx25821_vidioc_s_register,
407#endif 407#endif
408}; 408};
409 409