diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2011-03-12 04:43:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 15:38:12 -0400 |
commit | 2f82441a8644287e5b647329cc30b590f6fd3714 (patch) | |
tree | 63795d3ea4a1449b6dbbd84fa0c6465798bc58a7 /drivers/media | |
parent | 6aff72f6d511bcadbc71358ed17bc87edbf90716 (diff) |
[media] ivtv: replace ugly casts with a proper container_of
ivtv-ioctl cast the 'void *fh' directly to 'ivtv_open_id *'. This should be
done properly with a contained_of since the 'void *fh' is really a
'struct v4l2_fh *'.
It worked because the v4l2_fh field is also the first field in the ivtv_open_id
struct, but it is not clean code.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index b443c03d21de..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); |
@@ -752,7 +752,7 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register | |||
752 | 752 | ||
753 | 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) |
754 | { | 754 | { |
755 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 755 | struct ivtv *itv = fh2id(fh)->itv; |
756 | 756 | ||
757 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); | 757 | strlcpy(vcap->driver, IVTV_DRIVER_NAME, sizeof(vcap->driver)); |
758 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); | 758 | strlcpy(vcap->card, itv->card_name, sizeof(vcap->card)); |
@@ -764,14 +764,14 @@ static int ivtv_querycap(struct file *file, void *fh, struct v4l2_capability *vc | |||
764 | 764 | ||
765 | 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) |
766 | { | 766 | { |
767 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 767 | struct ivtv *itv = fh2id(fh)->itv; |
768 | 768 | ||
769 | return ivtv_get_audio_input(itv, vin->index, vin); | 769 | return ivtv_get_audio_input(itv, vin->index, vin); |
770 | } | 770 | } |
771 | 771 | ||
772 | 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) |
773 | { | 773 | { |
774 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 774 | struct ivtv *itv = fh2id(fh)->itv; |
775 | 775 | ||
776 | vin->index = itv->audio_input; | 776 | vin->index = itv->audio_input; |
777 | return ivtv_get_audio_input(itv, vin->index, vin); | 777 | return ivtv_get_audio_input(itv, vin->index, vin); |
@@ -779,7 +779,7 @@ static int ivtv_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) | |||
779 | 779 | ||
780 | 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) |
781 | { | 781 | { |
782 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 782 | struct ivtv *itv = fh2id(fh)->itv; |
783 | 783 | ||
784 | if (vout->index >= itv->nof_audio_inputs) | 784 | if (vout->index >= itv->nof_audio_inputs) |
785 | return -EINVAL; | 785 | return -EINVAL; |
@@ -792,7 +792,7 @@ static int ivtv_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) | |||
792 | 792 | ||
793 | 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) |
794 | { | 794 | { |
795 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 795 | struct ivtv *itv = fh2id(fh)->itv; |
796 | 796 | ||
797 | /* set it to defaults from our table */ | 797 | /* set it to defaults from our table */ |
798 | return ivtv_get_audio_output(itv, vin->index, vin); | 798 | return ivtv_get_audio_output(itv, vin->index, vin); |
@@ -800,7 +800,7 @@ static int ivtv_enumaudout(struct file *file, void *fh, struct v4l2_audioout *vi | |||
800 | 800 | ||
801 | 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) |
802 | { | 802 | { |
803 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 803 | struct ivtv *itv = fh2id(fh)->itv; |
804 | 804 | ||
805 | vin->index = 0; | 805 | vin->index = 0; |
806 | return ivtv_get_audio_output(itv, vin->index, vin); | 806 | return ivtv_get_audio_output(itv, vin->index, vin); |
@@ -808,14 +808,14 @@ static int ivtv_g_audout(struct file *file, void *fh, struct v4l2_audioout *vin) | |||
808 | 808 | ||
809 | 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) |
810 | { | 810 | { |
811 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 811 | struct ivtv *itv = fh2id(fh)->itv; |
812 | 812 | ||
813 | return ivtv_get_audio_output(itv, vout->index, vout); | 813 | return ivtv_get_audio_output(itv, vout->index, vout); |
814 | } | 814 | } |
815 | 815 | ||
816 | 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) |
817 | { | 817 | { |
818 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 818 | struct ivtv *itv = fh2id(fh)->itv; |
819 | 819 | ||
820 | /* set it to defaults from our table */ | 820 | /* set it to defaults from our table */ |
821 | return ivtv_get_input(itv, vin->index, vin); | 821 | return ivtv_get_input(itv, vin->index, vin); |
@@ -823,14 +823,14 @@ static int ivtv_enum_input(struct file *file, void *fh, struct v4l2_input *vin) | |||
823 | 823 | ||
824 | 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) |
825 | { | 825 | { |
826 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 826 | struct ivtv *itv = fh2id(fh)->itv; |
827 | 827 | ||
828 | return ivtv_get_output(itv, vout->index, vout); | 828 | return ivtv_get_output(itv, vout->index, vout); |
829 | } | 829 | } |
830 | 830 | ||
831 | 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) |
832 | { | 832 | { |
833 | struct ivtv_open_id *id = fh; | 833 | struct ivtv_open_id *id = fh2id(fh); |
834 | struct ivtv *itv = id->itv; | 834 | struct ivtv *itv = id->itv; |
835 | struct yuv_playback_info *yi = &itv->yuv_info; | 835 | struct yuv_playback_info *yi = &itv->yuv_info; |
836 | int streamtype; | 836 | int streamtype; |
@@ -867,7 +867,7 @@ static int ivtv_cropcap(struct file *file, void *fh, struct v4l2_cropcap *cropca | |||
867 | 867 | ||
868 | 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) |
869 | { | 869 | { |
870 | struct ivtv_open_id *id = fh; | 870 | struct ivtv_open_id *id = fh2id(fh); |
871 | struct ivtv *itv = id->itv; | 871 | struct ivtv *itv = id->itv; |
872 | struct yuv_playback_info *yi = &itv->yuv_info; | 872 | struct yuv_playback_info *yi = &itv->yuv_info; |
873 | int streamtype; | 873 | int streamtype; |
@@ -893,7 +893,7 @@ static int ivtv_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
893 | 893 | ||
894 | 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) |
895 | { | 895 | { |
896 | struct ivtv_open_id *id = fh; | 896 | struct ivtv_open_id *id = fh2id(fh); |
897 | struct ivtv *itv = id->itv; | 897 | struct ivtv *itv = id->itv; |
898 | struct yuv_playback_info *yi = &itv->yuv_info; | 898 | struct yuv_playback_info *yi = &itv->yuv_info; |
899 | int streamtype; | 899 | int streamtype; |
@@ -935,7 +935,7 @@ static int ivtv_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdes | |||
935 | 935 | ||
936 | 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) |
937 | { | 937 | { |
938 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 938 | struct ivtv *itv = fh2id(fh)->itv; |
939 | 939 | ||
940 | static struct v4l2_fmtdesc formats[] = { | 940 | static struct v4l2_fmtdesc formats[] = { |
941 | { 0, 0, 0, | 941 | { 0, 0, 0, |
@@ -963,7 +963,7 @@ static int ivtv_enum_fmt_vid_out(struct file *file, void *fh, struct v4l2_fmtdes | |||
963 | 963 | ||
964 | 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) |
965 | { | 965 | { |
966 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 966 | struct ivtv *itv = fh2id(fh)->itv; |
967 | 967 | ||
968 | *i = itv->active_input; | 968 | *i = itv->active_input; |
969 | 969 | ||
@@ -972,7 +972,7 @@ static int ivtv_g_input(struct file *file, void *fh, unsigned int *i) | |||
972 | 972 | ||
973 | 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) |
974 | { | 974 | { |
975 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 975 | struct ivtv *itv = fh2id(fh)->itv; |
976 | 976 | ||
977 | if (inp < 0 || inp >= itv->nof_inputs) | 977 | if (inp < 0 || inp >= itv->nof_inputs) |
978 | return -EINVAL; | 978 | return -EINVAL; |
@@ -1006,7 +1006,7 @@ int ivtv_s_input(struct file *file, void *fh, unsigned int inp) | |||
1006 | 1006 | ||
1007 | 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) |
1008 | { | 1008 | { |
1009 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1009 | struct ivtv *itv = fh2id(fh)->itv; |
1010 | 1010 | ||
1011 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) | 1011 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) |
1012 | return -EINVAL; | 1012 | return -EINVAL; |
@@ -1018,7 +1018,7 @@ static int ivtv_g_output(struct file *file, void *fh, unsigned int *i) | |||
1018 | 1018 | ||
1019 | 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) |
1020 | { | 1020 | { |
1021 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1021 | struct ivtv *itv = fh2id(fh)->itv; |
1022 | 1022 | ||
1023 | if (outp >= itv->card->nof_outputs) | 1023 | if (outp >= itv->card->nof_outputs) |
1024 | return -EINVAL; | 1024 | return -EINVAL; |
@@ -1040,7 +1040,7 @@ static int ivtv_s_output(struct file *file, void *fh, unsigned int outp) | |||
1040 | 1040 | ||
1041 | 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) |
1042 | { | 1042 | { |
1043 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1043 | struct ivtv *itv = fh2id(fh)->itv; |
1044 | 1044 | ||
1045 | if (vf->tuner != 0) | 1045 | if (vf->tuner != 0) |
1046 | return -EINVAL; | 1046 | return -EINVAL; |
@@ -1051,7 +1051,7 @@ static int ivtv_g_frequency(struct file *file, void *fh, struct v4l2_frequency * | |||
1051 | 1051 | ||
1052 | 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) |
1053 | { | 1053 | { |
1054 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1054 | struct ivtv *itv = fh2id(fh)->itv; |
1055 | 1055 | ||
1056 | if (vf->tuner != 0) | 1056 | if (vf->tuner != 0) |
1057 | return -EINVAL; | 1057 | return -EINVAL; |
@@ -1065,7 +1065,7 @@ int ivtv_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | |||
1065 | 1065 | ||
1066 | 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) |
1067 | { | 1067 | { |
1068 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1068 | struct ivtv *itv = fh2id(fh)->itv; |
1069 | 1069 | ||
1070 | *std = itv->std; | 1070 | *std = itv->std; |
1071 | return 0; | 1071 | return 0; |
@@ -1074,7 +1074,7 @@ static int ivtv_g_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1074 | 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) |
1075 | { | 1075 | { |
1076 | DEFINE_WAIT(wait); | 1076 | DEFINE_WAIT(wait); |
1077 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1077 | struct ivtv *itv = fh2id(fh)->itv; |
1078 | struct yuv_playback_info *yi = &itv->yuv_info; | 1078 | struct yuv_playback_info *yi = &itv->yuv_info; |
1079 | int f; | 1079 | int f; |
1080 | 1080 | ||
@@ -1153,7 +1153,7 @@ int ivtv_s_std(struct file *file, void *fh, v4l2_std_id *std) | |||
1153 | 1153 | ||
1154 | 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) |
1155 | { | 1155 | { |
1156 | struct ivtv_open_id *id = fh; | 1156 | struct ivtv_open_id *id = fh2id(fh); |
1157 | struct ivtv *itv = id->itv; | 1157 | struct ivtv *itv = id->itv; |
1158 | 1158 | ||
1159 | if (vt->index != 0) | 1159 | if (vt->index != 0) |
@@ -1166,7 +1166,7 @@ static int ivtv_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
1166 | 1166 | ||
1167 | 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) |
1168 | { | 1168 | { |
1169 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1169 | struct ivtv *itv = fh2id(fh)->itv; |
1170 | 1170 | ||
1171 | if (vt->index != 0) | 1171 | if (vt->index != 0) |
1172 | return -EINVAL; | 1172 | return -EINVAL; |
@@ -1186,7 +1186,7 @@ static int ivtv_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
1186 | 1186 | ||
1187 | 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) |
1188 | { | 1188 | { |
1189 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1189 | struct ivtv *itv = fh2id(fh)->itv; |
1190 | 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; |
1191 | int f, l; | 1191 | int f, l; |
1192 | 1192 | ||
@@ -1216,7 +1216,7 @@ static int ivtv_g_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_sliced | |||
1216 | 1216 | ||
1217 | 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) |
1218 | { | 1218 | { |
1219 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1219 | struct ivtv *itv = fh2id(fh)->itv; |
1220 | struct v4l2_enc_idx_entry *e = idx->entry; | 1220 | struct v4l2_enc_idx_entry *e = idx->entry; |
1221 | int entries; | 1221 | int entries; |
1222 | int i; | 1222 | int i; |
@@ -1239,7 +1239,7 @@ static int ivtv_g_enc_index(struct file *file, void *fh, struct v4l2_enc_idx *id | |||
1239 | 1239 | ||
1240 | 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) |
1241 | { | 1241 | { |
1242 | struct ivtv_open_id *id = fh; | 1242 | struct ivtv_open_id *id = fh2id(fh); |
1243 | struct ivtv *itv = id->itv; | 1243 | struct ivtv *itv = id->itv; |
1244 | 1244 | ||
1245 | 1245 | ||
@@ -1291,7 +1291,7 @@ static int ivtv_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd | |||
1291 | 1291 | ||
1292 | 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) |
1293 | { | 1293 | { |
1294 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1294 | struct ivtv *itv = fh2id(fh)->itv; |
1295 | 1295 | ||
1296 | switch (enc->cmd) { | 1296 | switch (enc->cmd) { |
1297 | case V4L2_ENC_CMD_START: | 1297 | case V4L2_ENC_CMD_START: |
@@ -1321,7 +1321,7 @@ static int ivtv_try_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder | |||
1321 | 1321 | ||
1322 | 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) |
1323 | { | 1323 | { |
1324 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1324 | struct ivtv *itv = fh2id(fh)->itv; |
1325 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1325 | u32 data[CX2341X_MBOX_MAX_DATA]; |
1326 | struct yuv_playback_info *yi = &itv->yuv_info; | 1326 | struct yuv_playback_info *yi = &itv->yuv_info; |
1327 | 1327 | ||
@@ -1408,7 +1408,7 @@ static int ivtv_g_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1408 | 1408 | ||
1409 | 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) |
1410 | { | 1410 | { |
1411 | struct ivtv_open_id *id = fh; | 1411 | struct ivtv_open_id *id = fh2id(fh); |
1412 | struct ivtv *itv = id->itv; | 1412 | struct ivtv *itv = id->itv; |
1413 | struct yuv_playback_info *yi = &itv->yuv_info; | 1413 | struct yuv_playback_info *yi = &itv->yuv_info; |
1414 | 1414 | ||
@@ -1428,7 +1428,7 @@ static int ivtv_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *fb) | |||
1428 | 1428 | ||
1429 | 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) |
1430 | { | 1430 | { |
1431 | struct ivtv_open_id *id = fh; | 1431 | struct ivtv_open_id *id = fh2id(fh); |
1432 | struct ivtv *itv = id->itv; | 1432 | struct ivtv *itv = id->itv; |
1433 | 1433 | ||
1434 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) | 1434 | if (!(itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT_OVERLAY)) |
@@ -1453,7 +1453,7 @@ static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscripti | |||
1453 | 1453 | ||
1454 | static int ivtv_log_status(struct file *file, void *fh) | 1454 | static int ivtv_log_status(struct file *file, void *fh) |
1455 | { | 1455 | { |
1456 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1456 | struct ivtv *itv = fh2id(fh)->itv; |
1457 | u32 data[CX2341X_MBOX_MAX_DATA]; | 1457 | u32 data[CX2341X_MBOX_MAX_DATA]; |
1458 | 1458 | ||
1459 | int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT; | 1459 | int has_output = itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT; |
@@ -1781,7 +1781,7 @@ static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | |||
1781 | static long ivtv_default(struct file *file, void *fh, bool valid_prio, | 1781 | static long ivtv_default(struct file *file, void *fh, bool valid_prio, |
1782 | int cmd, void *arg) | 1782 | int cmd, void *arg) |
1783 | { | 1783 | { |
1784 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1784 | struct ivtv *itv = fh2id(fh)->itv; |
1785 | 1785 | ||
1786 | if (!valid_prio) { | 1786 | if (!valid_prio) { |
1787 | switch (cmd) { | 1787 | switch (cmd) { |