diff options
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 159 |
1 files changed, 67 insertions, 92 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index b686da5e4326..1689783cd19a 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -313,7 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id, | |||
313 | 313 | ||
314 | static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_format *fmt) | 314 | static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_format *fmt) |
315 | { | 315 | { |
316 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 316 | struct ivtv *itv = fh2id(fh)->itv; |
317 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 317 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
318 | 318 | ||
319 | vbifmt->reserved[0] = 0; | 319 | vbifmt->reserved[0] = 0; |
@@ -334,7 +334,7 @@ static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_fo | |||
334 | 334 | ||
335 | static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 335 | static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
336 | { | 336 | { |
337 | struct ivtv_open_id *id = fh; | 337 | struct ivtv_open_id *id = fh2id(fh); |
338 | struct ivtv *itv = id->itv; | 338 | struct ivtv *itv = id->itv; |
339 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; | 339 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; |
340 | 340 | ||
@@ -358,7 +358,7 @@ static int ivtv_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f | |||
358 | 358 | ||
359 | static int ivtv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 359 | static int ivtv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
360 | { | 360 | { |
361 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 361 | struct ivtv *itv = fh2id(fh)->itv; |
362 | struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; | 362 | struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; |
363 | 363 | ||
364 | vbifmt->sampling_rate = 27000000; | 364 | vbifmt->sampling_rate = 27000000; |
@@ -377,7 +377,7 @@ static int ivtv_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f | |||
377 | static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 377 | static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
378 | { | 378 | { |
379 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 379 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
380 | struct ivtv_open_id *id = fh; | 380 | struct ivtv_open_id *id = fh2id(fh); |
381 | struct ivtv *itv = id->itv; | 381 | struct ivtv *itv = id->itv; |
382 | 382 | ||
383 | vbifmt->reserved[0] = 0; | 383 | vbifmt->reserved[0] = 0; |
@@ -398,7 +398,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo | |||
398 | 398 | ||
399 | static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) | 399 | static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) |
400 | { | 400 | { |
401 | struct ivtv_open_id *id = fh; | 401 | struct ivtv_open_id *id = fh2id(fh); |
402 | struct ivtv *itv = id->itv; | 402 | struct ivtv *itv = id->itv; |
403 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; | 403 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; |
404 | 404 | ||
@@ -439,7 +439,7 @@ static int ivtv_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f | |||
439 | 439 | ||
440 | static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) | 440 | static int ivtv_g_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) |
441 | { | 441 | { |
442 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 442 | struct ivtv *itv = fh2id(fh)->itv; |
443 | struct v4l2_window *winfmt = &fmt->fmt.win; | 443 | struct v4l2_window *winfmt = &fmt->fmt.win; |
444 | 444 | ||
445 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 445 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) |
@@ -463,7 +463,7 @@ static int ivtv_try_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_ | |||
463 | 463 | ||
464 | static int ivtv_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 464 | static int ivtv_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
465 | { | 465 | { |
466 | struct ivtv_open_id *id = fh; | 466 | struct ivtv_open_id *id = fh2id(fh); |
467 | struct ivtv *itv = id->itv; | 467 | struct ivtv *itv = id->itv; |
468 | int w = fmt->fmt.pix.width; | 468 | int w = fmt->fmt.pix.width; |
469 | int h = fmt->fmt.pix.height; | 469 | int h = fmt->fmt.pix.height; |
@@ -492,7 +492,7 @@ static int ivtv_try_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format | |||
492 | static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 492 | static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
493 | { | 493 | { |
494 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 494 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
495 | struct ivtv_open_id *id = fh; | 495 | struct ivtv_open_id *id = fh2id(fh); |
496 | struct ivtv *itv = id->itv; | 496 | struct ivtv *itv = id->itv; |
497 | 497 | ||
498 | if (id->type == IVTV_DEC_STREAM_TYPE_VBI) | 498 | if (id->type == IVTV_DEC_STREAM_TYPE_VBI) |
@@ -512,7 +512,7 @@ static int ivtv_try_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_ | |||
512 | 512 | ||
513 | static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) | 513 | static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) |
514 | { | 514 | { |
515 | struct ivtv_open_id *id = fh; | 515 | struct ivtv_open_id *id = fh2id(fh); |
516 | s32 w = fmt->fmt.pix.width; | 516 | s32 w = fmt->fmt.pix.width; |
517 | s32 h = fmt->fmt.pix.height; | 517 | s32 h = fmt->fmt.pix.height; |
518 | int field = fmt->fmt.pix.field; | 518 | int field = fmt->fmt.pix.field; |
@@ -546,7 +546,7 @@ static int ivtv_try_fmt_vid_out(struct file *file, void *fh, struct v4l2_format | |||
546 | 546 | ||
547 | static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) | 547 | static int ivtv_try_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) |
548 | { | 548 | { |
549 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 549 | struct ivtv *itv = fh2id(fh)->itv; |
550 | u32 chromakey = fmt->fmt.win.chromakey; | 550 | u32 chromakey = fmt->fmt.win.chromakey; |
551 | u8 global_alpha = fmt->fmt.win.global_alpha; | 551 | u8 global_alpha = fmt->fmt.win.global_alpha; |
552 | 552 | ||
@@ -565,7 +565,7 @@ static int ivtv_s_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_fo | |||
565 | 565 | ||
566 | static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 566 | static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
567 | { | 567 | { |
568 | struct ivtv_open_id *id = fh; | 568 | struct ivtv_open_id *id = fh2id(fh); |
569 | struct ivtv *itv = id->itv; | 569 | struct ivtv *itv = id->itv; |
570 | struct v4l2_mbus_framefmt mbus_fmt; | 570 | struct v4l2_mbus_framefmt mbus_fmt; |
571 | int ret = ivtv_try_fmt_vid_cap(file, fh, fmt); | 571 | int ret = ivtv_try_fmt_vid_cap(file, fh, fmt); |
@@ -594,7 +594,7 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f | |||
594 | 594 | ||
595 | static int ivtv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 595 | static int ivtv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
596 | { | 596 | { |
597 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 597 | struct ivtv *itv = fh2id(fh)->itv; |
598 | 598 | ||
599 | if (!ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0) | 599 | if (!ivtv_raw_vbi(itv) && atomic_read(&itv->capturing) > 0) |
600 | return -EBUSY; | 600 | return -EBUSY; |
@@ -607,7 +607,7 @@ static int ivtv_s_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f | |||
607 | static int ivtv_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) | 607 | static int ivtv_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_format *fmt) |
608 | { | 608 | { |
609 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 609 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
610 | struct ivtv_open_id *id = fh; | 610 | struct ivtv_open_id *id = fh2id(fh); |
611 | struct ivtv *itv = id->itv; | 611 | struct ivtv *itv = id->itv; |
612 | int ret = ivtv_try_fmt_sliced_vbi_cap(file, fh, fmt); | 612 | int ret = ivtv_try_fmt_sliced_vbi_cap(file, fh, fmt); |
613 | 613 | ||
@@ -625,7 +625,7 @@ static int ivtv_s_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo | |||
625 | 625 | ||
626 | static int ivtv_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) | 626 | static int ivtv_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *fmt) |
627 | { | 627 | { |
628 | struct ivtv_open_id *id = fh; | 628 | struct ivtv_open_id *id = fh2id(fh); |
629 | struct ivtv *itv = id->itv; | 629 | struct ivtv *itv = id->itv; |
630 | struct yuv_playback_info *yi = &itv->yuv_info; | 630 | struct yuv_playback_info *yi = &itv->yuv_info; |
631 | int ret = ivtv_try_fmt_vid_out(file, fh, fmt); | 631 | int ret = ivtv_try_fmt_vid_out(file, fh, fmt); |
@@ -670,7 +670,7 @@ static int ivtv_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f | |||
670 | 670 | ||
671 | static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) | 671 | static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_format *fmt) |
672 | { | 672 | { |
673 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 673 | struct ivtv *itv = fh2id(fh)->itv; |
674 | int ret = ivtv_try_fmt_vid_out_overlay(file, fh, fmt); | 674 | int ret = ivtv_try_fmt_vid_out_overlay(file, fh, fmt); |
675 | 675 | ||
676 | if (ret == 0) { | 676 | if (ret == 0) { |
@@ -683,7 +683,7 @@ static int ivtv_s_fmt_vid_out_overlay(struct file *file, void *fh, struct v4l2_f | |||
683 | 683 | ||
684 | static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip) | 684 | static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip) |
685 | { | 685 | { |
686 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 686 | struct ivtv *itv = fh2id(fh)->itv; |
687 | 687 | ||
688 | chip->ident = V4L2_IDENT_NONE; | 688 | chip->ident = V4L2_IDENT_NONE; |
689 | chip->revision = 0; | 689 | chip->revision = 0; |
@@ -727,7 +727,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) | |||
727 | 727 | ||
728 | static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) | 728 | static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) |
729 | { | 729 | { |
730 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 730 | struct ivtv *itv = fh2id(fh)->itv; |
731 | 731 | ||
732 | if (v4l2_chip_match_host(®->match)) | 732 | if (v4l2_chip_match_host(®->match)) |
733 | return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); | 733 | return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); |
@@ -739,7 +739,7 @@ static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register | |||
739 | 739 | ||
740 | static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) | 740 | static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) |
741 | { | 741 | { |
742 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 742 | struct ivtv *itv = fh2id(fh)->itv; |
743 | 743 | ||
744 | if (v4l2_chip_match_host(®->match)) | 744 | if (v4l2_chip_match_host(®->match)) |
745 | return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); | 745 | return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); |
@@ -750,26 +750,9 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register | |||
750 | } | 750 | } |
751 | #endif | 751 | #endif |
752 | 752 | ||
753 | static int ivtv_g_priority(struct file *file, void *fh, enum v4l2_priority *p) | ||
754 | { | ||
755 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | ||
756 | |||
757 | *p = v4l2_prio_max(&itv->prio); | ||
758 | |||
759 | return 0; | ||
760 | } | ||
761 | |||
762 | static int ivtv_s_priority(struct file *file, void *fh, enum v4l2_priority prio) | ||
763 | { | ||
764 | struct ivtv_open_id *id = fh; | ||
765 | struct ivtv *itv = id->itv; | ||
766 | |||
767 | return v4l2_prio_change(&itv->prio, &id->prio, prio); | ||
768 | } | ||
769 | |||
770 | static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap) | 753 | static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vcap) |
771 | { | 754 | { |
772 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 755 | struct ivtv *itv = fh2id(fh)->itv; |
773 | 756 | ||
774 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); | 757 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); |
775 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); | 758 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); |
@@ -781,14 +764,14 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc | |||
781 | 764 | ||
782 | static int ivtv_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin) | 765 | static int ivtv_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin) |
783 | { | 766 | { |
784 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 767 | struct ivtv *itv = fh2id(fh)->itv; |
785 | 768 | ||
786 | return ivtv_get_audio_input(itv, vin->index, vin); | 769 | return ivtv_get_audio_input(itv, vin->index, vin); |
787 | } | 770 | } |
788 | 771 | ||
789 | static int ivtv_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) | 772 | static int ivtv_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) |
790 | { | 773 | { |
791 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 774 | struct ivtv *itv = fh2id(fh)->itv; |
792 | 775 | ||
793 | vin->index = itv->audio_input; | 776 | vin->index = itv->audio_input; |
794 | return ivtv_get_audio_input(itv, vin->index, vin); | 777 | return ivtv_get_audio_input(itv, vin->index, vin); |
@@ -796,7 +779,7 @@ static int ivtv_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) | |||
796 | 779 | ||
797 | static int ivtv_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) | 780 | static int ivtv_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) |
798 | { | 781 | { |
799 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 782 | struct ivtv *itv = fh2id(fh)->itv; |
800 | 783 | ||
801 | if (vout->index >= itv->nof_audio_inputs) | 784 | if (vout->index >= itv->nof_audio_inputs) |
802 | return -EINVAL; | 785 | return -EINVAL; |
@@ -809,7 +792,7 @@ static int ivtv_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) | |||
809 | 792 | ||
810 | static int ivtv_enumaudout(struct file *file, void *fh, struct v4l2_audioout *vin) | 793 | static int ivtv_enumaudout(struct file *file, void *fh, struct v4l2_audioout *vin) |
811 | { | 794 | { |
812 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 795 | struct ivtv *itv = fh2id(fh)->itv; |
813 | 796 | ||
814 | /* set it to defaults from our table */ | 797 | /* set it to defaults from our table */ |
815 | return ivtv_get_audio_output(itv, vin->index, vin); | 798 | return ivtv_get_audio_output(itv, vin->index, vin); |
@@ -817,7 +800,7 @@ static int ivtv_enumaudout(struct file *file, void *fh, struct v4l2_audioout *vi | |||
817 | 800 | ||
818 | static int ivtv_g_audout(struct file *file, void *fh, struct v4l2_audioout *vin) | 801 | static int ivtv_g_audout(struct file *file, void *fh, struct v4l2_audioout *vin) |
819 | { | 802 | { |
820 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 803 | struct ivtv *itv = fh2id(fh)->itv; |
821 | 804 | ||
822 | vin->index = 0; | 805 | vin->index = 0; |
823 | return ivtv_get_audio_output(itv, vin->index, vin); | 806 | return ivtv_get_audio_output(itv, vin->index, vin); |
@@ -825,14 +808,14 @@ static int ivtv_g_audout(struct file *file, void *fh, struct v4l2_audioout *vin) | |||
825 | 808 | ||
826 | static int ivtv_s_audout(struct file *file, void *fh, struct v4l2_audioout *vout) | 809 | static int ivtv_s_audout(struct file *file, void *fh, struct v4l2_audioout *vout) |
827 | { | 810 | { |
828 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 811 | struct ivtv *itv = fh2id(fh)->itv; |
829 | 812 | ||
830 | return ivtv_get_audio_output(itv, vout->index, vout); | 813 | return ivtv_get_audio_output(itv, vout->index, vout); |
831 | } | 814 | } |
832 | 815 | ||
833 | static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input *vin) | 816 | static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input *vin) |
834 | { | 817 | { |
835 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 818 | struct ivtv *itv = fh2id(fh)->itv; |
836 | 819 | ||
837 | /* set it to defaults from our table */ | 820 | /* set it to defaults from our table */ |
838 | return ivtv_get_input(itv, vin->index, vin); | 821 | return ivtv_get_input(itv, vin->index, vin); |
@@ -840,14 +823,14 @@ static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input *vin) | |||
840 | 823 | ||
841 | static int ivtv_enum_output(struct file *file, void *fh, struct v4l2_output *vout) | 824 | static int ivtv_enum_output(struct file *file, void *fh, struct v4l2_output *vout) |
842 | { | 825 | { |
843 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 826 | struct ivtv *itv = fh2id(fh)->itv; |
844 | 827 | ||
845 | return ivtv_get_output(itv, vout->index, vout); | 828 | return ivtv_get_output(itv, vout->index, vout); |
846 | } | 829 | } |
847 | 830 | ||
848 | static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap) | 831 | static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropcap) |
849 | { | 832 | { |
850 | struct ivtv_open_id *id = fh; | 833 | struct ivtv_open_id *id = fh2id(fh); |
851 | struct ivtv *itv = id->itv; | 834 | struct ivtv *itv = id->itv; |
852 | struct yuv_playback_info *yi = &itv->yuv_info; | 835 | struct yuv_playback_info *yi = &itv->yuv_info; |
853 | int streamtype; | 836 | int streamtype; |
@@ -884,7 +867,7 @@ static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropca | |||
884 | 867 | ||
885 | static int ivtv_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 868 | static int ivtv_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) |
886 | { | 869 | { |
887 | struct ivtv_open_id *id = fh; | 870 | struct ivtv_open_id *id = fh2id(fh); |
888 | struct ivtv *itv = id->itv; | 871 | struct ivtv *itv = id->itv; |
889 | struct yuv_playback_info *yi = &itv->yuv_info; | 872 | struct yuv_playback_info *yi = &itv->yuv_info; |
890 | int streamtype; | 873 | int streamtype; |
@@ -910,7 +893,7 @@ static int ivtv_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
910 | 893 | ||
911 | static int ivtv_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 894 | static int ivtv_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) |
912 | { | 895 | { |
913 | struct ivtv_open_id *id = fh; | 896 | struct ivtv_open_id *id = fh2id(fh); |
914 | struct ivtv *itv = id->itv; | 897 | struct ivtv *itv = id->itv; |
915 | struct yuv_playback_info *yi = &itv->yuv_info; | 898 | struct yuv_playback_info *yi = &itv->yuv_info; |
916 | int streamtype; | 899 | int streamtype; |
@@ -952,7 +935,7 @@ static int ivtv_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes | |||
952 | 935 | ||
953 | static int ivtv_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) | 936 | static int ivtv_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdesc *fmt) |
954 | { | 937 | { |
955 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 938 | struct ivtv *itv = fh2id(fh)->itv; |
956 | 939 | ||
957 | static struct v4l2_fmtdesc formats[] = { | 940 | static struct v4l2_fmtdesc formats[] = { |
958 | { 0, 0, 0, | 941 | { 0, 0, 0, |
@@ -980,7 +963,7 @@ static int ivtv_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdes | |||
980 | 963 | ||
981 | static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) | 964 | static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) |
982 | { | 965 | { |
983 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 966 | struct ivtv *itv = fh2id(fh)->itv; |
984 | 967 | ||
985 | *i = itv->active_input; | 968 | *i = itv->active_input; |
986 | 969 | ||
@@ -989,7 +972,7 @@ static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) | |||
989 | 972 | ||
990 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp) | 973 | int ivtv_s_input(struct file *file, void *fh, unsigned int inp) |
991 | { | 974 | { |
992 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 975 | struct ivtv *itv = fh2id(fh)->itv; |
993 | 976 | ||
994 | if (inp < 0 || inp >= itv->nof_inputs) | 977 | if (inp < 0 || inp >= itv->nof_inputs) |
995 | return -EINVAL; | 978 | return -EINVAL; |
@@ -1023,7 +1006,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp) | |||
1023 | 1006 | ||
1024 | static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) | 1007 | static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) |
1025 | { | 1008 | { |
1026 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1009 | struct ivtv *itv = fh2id(fh)->itv; |
1027 | 1010 | ||
1028 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 1011 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) |
1029 | return -EINVAL; | 1012 | return -EINVAL; |
@@ -1035,7 +1018,7 @@ static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) | |||
1035 | 1018 | ||
1036 | static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) | 1019 | static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) |
1037 | { | 1020 | { |
1038 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1021 | struct ivtv *itv = fh2id(fh)->itv; |
1039 | 1022 | ||
1040 | if (outp >= itv->card->nof_outputs) | 1023 | if (outp >= itv->card->nof_outputs) |
1041 | return -EINVAL; | 1024 | return -EINVAL; |
@@ -1057,7 +1040,7 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) | |||
1057 | 1040 | ||
1058 | static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | 1041 | static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) |
1059 | { | 1042 | { |
1060 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1043 | struct ivtv *itv = fh2id(fh)->itv; |
1061 | 1044 | ||
1062 | if (vf->tuner != 0) | 1045 | if (vf->tuner != 0) |
1063 | return -EINVAL; | 1046 | return -EINVAL; |
@@ -1068,7 +1051,7 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency * | |||
1068 | 1051 | ||
1069 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | 1052 | int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) |
1070 | { | 1053 | { |
1071 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1054 | struct ivtv *itv = fh2id(fh)->itv; |
1072 | 1055 | ||
1073 | if (vf->tuner != 0) | 1056 | if (vf->tuner != 0) |
1074 | return -EINVAL; | 1057 | return -EINVAL; |
@@ -1082,7 +1065,7 @@ int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | |||
1082 | 1065 | ||
1083 | static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) | 1066 | static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) |
1084 | { | 1067 | { |
1085 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1068 | struct ivtv *itv = fh2id(fh)->itv; |
1086 | 1069 | ||
1087 | *std = itv->std; | 1070 | *std = itv->std; |
1088 | return 0; | 1071 | return 0; |
@@ -1091,7 +1074,7 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1091 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | 1074 | int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) |
1092 | { | 1075 | { |
1093 | DEFINE_WAIT(wait); | 1076 | DEFINE_WAIT(wait); |
1094 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1077 | struct ivtv *itv = fh2id(fh)->itv; |
1095 | struct yuv_playback_info *yi = &itv->yuv_info; | 1078 | struct yuv_playback_info *yi = &itv->yuv_info; |
1096 | int f; | 1079 | int f; |
1097 | 1080 | ||
@@ -1170,7 +1153,7 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1170 | 1153 | ||
1171 | static int ivtv_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | 1154 | static int ivtv_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) |
1172 | { | 1155 | { |
1173 | struct ivtv_open_id *id = fh; | 1156 | struct ivtv_open_id *id = fh2id(fh); |
1174 | struct ivtv *itv = id->itv; | 1157 | struct ivtv *itv = id->itv; |
1175 | 1158 | ||
1176 | if (vt->index != 0) | 1159 | if (vt->index != 0) |
@@ -1183,7 +1166,7 @@ static int ivtv_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
1183 | 1166 | ||
1184 | static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | 1167 | static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) |
1185 | { | 1168 | { |
1186 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1169 | struct ivtv *itv = fh2id(fh)->itv; |
1187 | 1170 | ||
1188 | if (vt->index != 0) | 1171 | if (vt->index != 0) |
1189 | return -EINVAL; | 1172 | return -EINVAL; |
@@ -1203,7 +1186,7 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
1203 | 1186 | ||
1204 | static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced_vbi_cap *cap) | 1187 | static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced_vbi_cap *cap) |
1205 | { | 1188 | { |
1206 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1189 | struct ivtv *itv = fh2id(fh)->itv; |
1207 | int set = itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; | 1190 | int set = itv->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; |
1208 | int f, l; | 1191 | int f, l; |
1209 | 1192 | ||
@@ -1233,7 +1216,7 @@ static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced | |||
1233 | 1216 | ||
1234 | static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *idx) | 1217 | static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *idx) |
1235 | { | 1218 | { |
1236 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1219 | struct ivtv *itv = fh2id(fh)->itv; |
1237 | struct v4l2_enc_idx_entry *e = idx->entry; | 1220 | struct v4l2_enc_idx_entry *e = idx->entry; |
1238 | int entries; | 1221 | int entries; |
1239 | int i; | 1222 | int i; |
@@ -1256,7 +1239,7 @@ static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *id | |||
1256 | 1239 | ||
1257 | static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) | 1240 | static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) |
1258 | { | 1241 | { |
1259 | struct ivtv_open_id *id = fh; | 1242 | struct ivtv_open_id *id = fh2id(fh); |
1260 | struct ivtv *itv = id->itv; | 1243 | struct ivtv *itv = id->itv; |
1261 | 1244 | ||
1262 | 1245 | ||
@@ -1308,7 +1291,7 @@ static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd | |||
1308 | 1291 | ||
1309 | static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) | 1292 | static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *enc) |
1310 | { | 1293 | { |
1311 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1294 | struct ivtv *itv = fh2id(fh)->itv; |
1312 | 1295 | ||
1313 | switch (enc->cmd) { | 1296 | switch (enc->cmd) { |
1314 | case V4L2_ENC_CMD_START: | 1297 | case V4L2_ENC_CMD_START: |
@@ -1338,7 +1321,7 @@ static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder | |||
1338 | 1321 | ||
1339 | static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | 1322 | static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) |
1340 | { | 1323 | { |
1341 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1324 | struct ivtv *itv = fh2id(fh)->itv; |
1342 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1325 | u32 data[CX2341X_MBOX_MAX_DATA]; |
1343 | struct yuv_playback_info *yi = &itv->yuv_info; | 1326 | struct yuv_playback_info *yi = &itv->yuv_info; |
1344 | 1327 | ||
@@ -1425,7 +1408,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1425 | 1408 | ||
1426 | static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | 1409 | static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) |
1427 | { | 1410 | { |
1428 | struct ivtv_open_id *id = fh; | 1411 | struct ivtv_open_id *id = fh2id(fh); |
1429 | struct ivtv *itv = id->itv; | 1412 | struct ivtv *itv = id->itv; |
1430 | struct yuv_playback_info *yi = &itv->yuv_info; | 1413 | struct yuv_playback_info *yi = &itv->yuv_info; |
1431 | 1414 | ||
@@ -1445,7 +1428,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1445 | 1428 | ||
1446 | static int ivtv_overlay(struct file *file, void *fh, unsigned int on) | 1429 | static int ivtv_overlay(struct file *file, void *fh, unsigned int on) |
1447 | { | 1430 | { |
1448 | struct ivtv_open_id *id = fh; | 1431 | struct ivtv_open_id *id = fh2id(fh); |
1449 | struct ivtv *itv = id->itv; | 1432 | struct ivtv *itv = id->itv; |
1450 | 1433 | ||
1451 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1434 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
@@ -1470,7 +1453,7 @@ static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscripti | |||
1470 | 1453 | ||
1471 | static int ivtv_log_status(struct file *file, void *fh) | 1454 | static int ivtv_log_status(struct file *file, void *fh) |
1472 | { | 1455 | { |
1473 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1456 | struct ivtv *itv = fh2id(fh)->itv; |
1474 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1457 | u32 data[CX2341X_MBOX_MAX_DATA]; |
1475 | 1458 | ||
1476 | int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT; | 1459 | int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT; |
@@ -1795,9 +1778,25 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1795 | return 0; | 1778 | return 0; |
1796 | } | 1779 | } |
1797 | 1780 | ||
1798 | static long ivtv_default(struct file *file, void *fh, int cmd, void *arg) | 1781 | static long ivtv_default(struct file *file, void *fh, bool valid_prio, |
1782 | int cmd, void *arg) | ||
1799 | { | 1783 | { |
1800 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1784 | struct ivtv *itv = fh2id(fh)->itv; |
1785 | |||
1786 | if (!valid_prio) { | ||
1787 | switch (cmd) { | ||
1788 | case VIDEO_PLAY: | ||
1789 | case VIDEO_STOP: | ||
1790 | case VIDEO_FREEZE: | ||
1791 | case VIDEO_CONTINUE: | ||
1792 | case VIDEO_COMMAND: | ||
1793 | case VIDEO_SELECT_SOURCE: | ||
1794 | case AUDIO_SET_MUTE: | ||
1795 | case AUDIO_CHANNEL_SELECT: | ||
1796 | case AUDIO_BILINGUAL_CHANNEL_SELECT: | ||
1797 | return -EBUSY; | ||
1798 | } | ||
1799 | } | ||
1801 | 1800 | ||
1802 | switch (cmd) { | 1801 | switch (cmd) { |
1803 | case VIDIOC_INT_RESET: { | 1802 | case VIDIOC_INT_RESET: { |
@@ -1836,30 +1835,8 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1836 | unsigned int cmd, unsigned long arg) | 1835 | unsigned int cmd, unsigned long arg) |
1837 | { | 1836 | { |
1838 | struct video_device *vfd = video_devdata(filp); | 1837 | struct video_device *vfd = video_devdata(filp); |
1839 | struct ivtv_open_id *id = fh2id(filp->private_data); | ||
1840 | long ret; | 1838 | long ret; |
1841 | 1839 | ||
1842 | /* check priority */ | ||
1843 | switch (cmd) { | ||
1844 | case VIDIOC_S_CTRL: | ||
1845 | case VIDIOC_S_STD: | ||
1846 | case VIDIOC_S_INPUT: | ||
1847 | case VIDIOC_S_OUTPUT: | ||
1848 | case VIDIOC_S_TUNER: | ||
1849 | case VIDIOC_S_FREQUENCY: | ||
1850 | case VIDIOC_S_FMT: | ||
1851 | case VIDIOC_S_CROP: | ||
1852 | case VIDIOC_S_AUDIO: | ||
1853 | case VIDIOC_S_AUDOUT: | ||
1854 | case VIDIOC_S_EXT_CTRLS: | ||
1855 | case VIDIOC_S_FBUF: | ||
1856 | case VIDIOC_S_PRIORITY: | ||
1857 | case VIDIOC_OVERLAY: | ||
1858 | ret = v4l2_prio_check(&itv->prio, id->prio); | ||
1859 | if (ret) | ||
1860 | return ret; | ||
1861 | } | ||
1862 | |||
1863 | if (ivtv_debug & IVTV_DBGFLG_IOCTL) | 1840 | if (ivtv_debug & IVTV_DBGFLG_IOCTL) |
1864 | vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; | 1841 | vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; |
1865 | ret = video_ioctl2(filp, cmd, arg); | 1842 | ret = video_ioctl2(filp, cmd, arg); |
@@ -1884,8 +1861,6 @@ long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
1884 | 1861 | ||
1885 | static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { | 1862 | static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { |
1886 | .vidioc_querycap = ivtv_querycap, | 1863 | .vidioc_querycap = ivtv_querycap, |
1887 | .vidioc_g_priority = ivtv_g_priority, | ||
1888 | .vidioc_s_priority = ivtv_s_priority, | ||
1889 | .vidioc_s_audio = ivtv_s_audio, | 1864 | .vidioc_s_audio = ivtv_s_audio, |
1890 | .vidioc_g_audio = ivtv_g_audio, | 1865 | .vidioc_g_audio = ivtv_g_audio, |
1891 | .vidioc_enumaudio = ivtv_enumaudio, | 1866 | .vidioc_enumaudio = ivtv_enumaudio, |