diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2011-03-12 04:35:33 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-22 15:38:03 -0400 |
commit | 0b5f265a88d89cbbf8abc42ca3311cb3219162ab (patch) | |
tree | 39fa5fb61e8ef8d56593d5582cc50f5831b6d34d /drivers/media | |
parent | 6e29ad50b4d688b1d18e2d255e31676c7ee46d3d (diff) |
[media] cx18: use v4l2_fh as preparation for adding core priority support
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/cx18/cx18-driver.h | 12 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-fileops.c | 18 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-ioctl.c | 72 |
3 files changed, 61 insertions, 41 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index de2457741e26..30a857473e54 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <media/v4l2-common.h> | 50 | #include <media/v4l2-common.h> |
51 | #include <media/v4l2-ioctl.h> | 51 | #include <media/v4l2-ioctl.h> |
52 | #include <media/v4l2-device.h> | 52 | #include <media/v4l2-device.h> |
53 | #include <media/v4l2-fh.h> | ||
53 | #include <media/tuner.h> | 54 | #include <media/tuner.h> |
54 | #include <media/ir-kbd-i2c.h> | 55 | #include <media/ir-kbd-i2c.h> |
55 | #include "cx18-mailbox.h" | 56 | #include "cx18-mailbox.h" |
@@ -405,12 +406,23 @@ struct cx18_stream { | |||
405 | }; | 406 | }; |
406 | 407 | ||
407 | struct cx18_open_id { | 408 | struct cx18_open_id { |
409 | struct v4l2_fh fh; | ||
408 | u32 open_id; | 410 | u32 open_id; |
409 | int type; | 411 | int type; |
410 | enum v4l2_priority prio; | 412 | enum v4l2_priority prio; |
411 | struct cx18 *cx; | 413 | struct cx18 *cx; |
412 | }; | 414 | }; |
413 | 415 | ||
416 | static inline struct cx18_open_id *fh2id(struct v4l2_fh *fh) | ||
417 | { | ||
418 | return container_of(fh, struct cx18_open_id, fh); | ||
419 | } | ||
420 | |||
421 | static inline struct cx18_open_id *file2id(struct file *file) | ||
422 | { | ||
423 | return fh2id(file->private_data); | ||
424 | } | ||
425 | |||
414 | /* forward declaration of struct defined in cx18-cards.h */ | 426 | /* forward declaration of struct defined in cx18-cards.h */ |
415 | struct cx18_card; | 427 | struct cx18_card; |
416 | 428 | ||
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c index 98ef33e4326a..1172d68925c0 100644 --- a/drivers/media/video/cx18/cx18-fileops.c +++ b/drivers/media/video/cx18/cx18-fileops.c | |||
@@ -585,7 +585,7 @@ start_failed: | |||
585 | ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, | 585 | ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, |
586 | loff_t *pos) | 586 | loff_t *pos) |
587 | { | 587 | { |
588 | struct cx18_open_id *id = filp->private_data; | 588 | struct cx18_open_id *id = file2id(filp); |
589 | struct cx18 *cx = id->cx; | 589 | struct cx18 *cx = id->cx; |
590 | struct cx18_stream *s = &cx->streams[id->type]; | 590 | struct cx18_stream *s = &cx->streams[id->type]; |
591 | int rc; | 591 | int rc; |
@@ -602,7 +602,7 @@ ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, | |||
602 | 602 | ||
603 | unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait) | 603 | unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait) |
604 | { | 604 | { |
605 | struct cx18_open_id *id = filp->private_data; | 605 | struct cx18_open_id *id = file2id(filp); |
606 | struct cx18 *cx = id->cx; | 606 | struct cx18 *cx = id->cx; |
607 | struct cx18_stream *s = &cx->streams[id->type]; | 607 | struct cx18_stream *s = &cx->streams[id->type]; |
608 | int eof = test_bit(CX18_F_S_STREAMOFF, &s->s_flags); | 608 | int eof = test_bit(CX18_F_S_STREAMOFF, &s->s_flags); |
@@ -676,13 +676,16 @@ void cx18_stop_capture(struct cx18_open_id *id, int gop_end) | |||
676 | 676 | ||
677 | int cx18_v4l2_close(struct file *filp) | 677 | int cx18_v4l2_close(struct file *filp) |
678 | { | 678 | { |
679 | struct cx18_open_id *id = filp->private_data; | 679 | struct v4l2_fh *fh = filp->private_data; |
680 | struct cx18_open_id *id = fh2id(fh); | ||
680 | struct cx18 *cx = id->cx; | 681 | struct cx18 *cx = id->cx; |
681 | struct cx18_stream *s = &cx->streams[id->type]; | 682 | struct cx18_stream *s = &cx->streams[id->type]; |
682 | 683 | ||
683 | CX18_DEBUG_IOCTL("close() of %s\n", s->name); | 684 | CX18_DEBUG_IOCTL("close() of %s\n", s->name); |
684 | 685 | ||
685 | v4l2_prio_close(&cx->prio, id->prio); | 686 | v4l2_prio_close(&cx->prio, id->prio); |
687 | v4l2_fh_del(fh); | ||
688 | v4l2_fh_exit(fh); | ||
686 | 689 | ||
687 | /* Easy case first: this stream was never claimed by us */ | 690 | /* Easy case first: this stream was never claimed by us */ |
688 | if (s->id != id->open_id) { | 691 | if (s->id != id->open_id) { |
@@ -728,22 +731,25 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) | |||
728 | CX18_DEBUG_FILE("open %s\n", s->name); | 731 | CX18_DEBUG_FILE("open %s\n", s->name); |
729 | 732 | ||
730 | /* Allocate memory */ | 733 | /* Allocate memory */ |
731 | item = kmalloc(sizeof(struct cx18_open_id), GFP_KERNEL); | 734 | item = kzalloc(sizeof(struct cx18_open_id), GFP_KERNEL); |
732 | if (NULL == item) { | 735 | if (NULL == item) { |
733 | CX18_DEBUG_WARN("nomem on v4l2 open\n"); | 736 | CX18_DEBUG_WARN("nomem on v4l2 open\n"); |
734 | return -ENOMEM; | 737 | return -ENOMEM; |
735 | } | 738 | } |
739 | v4l2_fh_init(&item->fh, s->video_dev); | ||
740 | |||
736 | item->cx = cx; | 741 | item->cx = cx; |
737 | item->type = s->type; | 742 | item->type = s->type; |
738 | v4l2_prio_open(&cx->prio, &item->prio); | 743 | v4l2_prio_open(&cx->prio, &item->prio); |
739 | 744 | ||
740 | item->open_id = cx->open_id++; | 745 | item->open_id = cx->open_id++; |
741 | filp->private_data = item; | 746 | filp->private_data = &item->fh; |
742 | 747 | ||
743 | if (item->type == CX18_ENC_STREAM_TYPE_RAD) { | 748 | if (item->type == CX18_ENC_STREAM_TYPE_RAD) { |
744 | /* Try to claim this stream */ | 749 | /* Try to claim this stream */ |
745 | if (cx18_claim_stream(item, item->type)) { | 750 | if (cx18_claim_stream(item, item->type)) { |
746 | /* No, it's already in use */ | 751 | /* No, it's already in use */ |
752 | v4l2_fh_exit(&item->fh); | ||
747 | kfree(item); | 753 | kfree(item); |
748 | return -EBUSY; | 754 | return -EBUSY; |
749 | } | 755 | } |
@@ -753,6 +759,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) | |||
753 | /* switching to radio while capture is | 759 | /* switching to radio while capture is |
754 | in progress is not polite */ | 760 | in progress is not polite */ |
755 | cx18_release_stream(s); | 761 | cx18_release_stream(s); |
762 | v4l2_fh_exit(&item->fh); | ||
756 | kfree(item); | 763 | kfree(item); |
757 | return -EBUSY; | 764 | return -EBUSY; |
758 | } | 765 | } |
@@ -769,6 +776,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) | |||
769 | /* Done! Unmute and continue. */ | 776 | /* Done! Unmute and continue. */ |
770 | cx18_unmute(cx); | 777 | cx18_unmute(cx); |
771 | } | 778 | } |
779 | v4l2_fh_add(&item->fh); | ||
772 | return 0; | 780 | return 0; |
773 | } | 781 | } |
774 | 782 | ||
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index 08ed75de1912..6624ec2419d3 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c | |||
@@ -148,7 +148,7 @@ u16 cx18_get_service_set(struct v4l2_sliced_vbi_format *fmt) | |||
148 | static int cx18_g_fmt_vid_cap(struct file *file, void *fh, | 148 | static int cx18_g_fmt_vid_cap(struct file *file, void *fh, |
149 | struct v4l2_format *fmt) | 149 | struct v4l2_format *fmt) |
150 | { | 150 | { |
151 | struct cx18_open_id *id = fh; | 151 | struct cx18_open_id *id = fh2id(fh); |
152 | struct cx18 *cx = id->cx; | 152 | struct cx18 *cx = id->cx; |
153 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; | 153 | struct v4l2_pix_format *pixfmt = &fmt->fmt.pix; |
154 | 154 | ||
@@ -173,7 +173,7 @@ static int cx18_g_fmt_vid_cap(struct file *file, void *fh, | |||
173 | static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, | 173 | static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, |
174 | struct v4l2_format *fmt) | 174 | struct v4l2_format *fmt) |
175 | { | 175 | { |
176 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 176 | struct cx18 *cx = fh2id(fh)->cx; |
177 | struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; | 177 | struct v4l2_vbi_format *vbifmt = &fmt->fmt.vbi; |
178 | 178 | ||
179 | vbifmt->sampling_rate = 27000000; | 179 | vbifmt->sampling_rate = 27000000; |
@@ -192,7 +192,7 @@ static int cx18_g_fmt_vbi_cap(struct file *file, void *fh, | |||
192 | static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh, | 192 | static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh, |
193 | struct v4l2_format *fmt) | 193 | struct v4l2_format *fmt) |
194 | { | 194 | { |
195 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 195 | struct cx18 *cx = fh2id(fh)->cx; |
196 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 196 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
197 | 197 | ||
198 | /* sane, V4L2 spec compliant, defaults */ | 198 | /* sane, V4L2 spec compliant, defaults */ |
@@ -221,7 +221,7 @@ static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh, | |||
221 | static int cx18_try_fmt_vid_cap(struct file *file, void *fh, | 221 | static int cx18_try_fmt_vid_cap(struct file *file, void *fh, |
222 | struct v4l2_format *fmt) | 222 | struct v4l2_format *fmt) |
223 | { | 223 | { |
224 | struct cx18_open_id *id = fh; | 224 | struct cx18_open_id *id = fh2id(fh); |
225 | struct cx18 *cx = id->cx; | 225 | struct cx18 *cx = id->cx; |
226 | int w = fmt->fmt.pix.width; | 226 | int w = fmt->fmt.pix.width; |
227 | int h = fmt->fmt.pix.height; | 227 | int h = fmt->fmt.pix.height; |
@@ -252,7 +252,7 @@ static int cx18_try_fmt_vbi_cap(struct file *file, void *fh, | |||
252 | static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh, | 252 | static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh, |
253 | struct v4l2_format *fmt) | 253 | struct v4l2_format *fmt) |
254 | { | 254 | { |
255 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 255 | struct cx18 *cx = fh2id(fh)->cx; |
256 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 256 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
257 | 257 | ||
258 | vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36; | 258 | vbifmt->io_size = sizeof(struct v4l2_sliced_vbi_data) * 36; |
@@ -271,7 +271,7 @@ static int cx18_try_fmt_sliced_vbi_cap(struct file *file, void *fh, | |||
271 | static int cx18_s_fmt_vid_cap(struct file *file, void *fh, | 271 | static int cx18_s_fmt_vid_cap(struct file *file, void *fh, |
272 | struct v4l2_format *fmt) | 272 | struct v4l2_format *fmt) |
273 | { | 273 | { |
274 | struct cx18_open_id *id = fh; | 274 | struct cx18_open_id *id = fh2id(fh); |
275 | struct cx18 *cx = id->cx; | 275 | struct cx18 *cx = id->cx; |
276 | struct v4l2_mbus_framefmt mbus_fmt; | 276 | struct v4l2_mbus_framefmt mbus_fmt; |
277 | int ret; | 277 | int ret; |
@@ -303,7 +303,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh, | |||
303 | static int cx18_s_fmt_vbi_cap(struct file *file, void *fh, | 303 | static int cx18_s_fmt_vbi_cap(struct file *file, void *fh, |
304 | struct v4l2_format *fmt) | 304 | struct v4l2_format *fmt) |
305 | { | 305 | { |
306 | struct cx18_open_id *id = fh; | 306 | struct cx18_open_id *id = fh2id(fh); |
307 | struct cx18 *cx = id->cx; | 307 | struct cx18 *cx = id->cx; |
308 | int ret; | 308 | int ret; |
309 | 309 | ||
@@ -337,7 +337,7 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh, | |||
337 | static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh, | 337 | static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh, |
338 | struct v4l2_format *fmt) | 338 | struct v4l2_format *fmt) |
339 | { | 339 | { |
340 | struct cx18_open_id *id = fh; | 340 | struct cx18_open_id *id = fh2id(fh); |
341 | struct cx18 *cx = id->cx; | 341 | struct cx18 *cx = id->cx; |
342 | int ret; | 342 | int ret; |
343 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; | 343 | struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced; |
@@ -372,7 +372,7 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh, | |||
372 | static int cx18_g_chip_ident(struct file *file, void *fh, | 372 | static int cx18_g_chip_ident(struct file *file, void *fh, |
373 | struct v4l2_dbg_chip_ident *chip) | 373 | struct v4l2_dbg_chip_ident *chip) |
374 | { | 374 | { |
375 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 375 | struct cx18 *cx = fh2id(fh)->cx; |
376 | int err = 0; | 376 | int err = 0; |
377 | 377 | ||
378 | chip->ident = V4L2_IDENT_NONE; | 378 | chip->ident = V4L2_IDENT_NONE; |
@@ -442,7 +442,7 @@ static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) | |||
442 | static int cx18_g_register(struct file *file, void *fh, | 442 | static int cx18_g_register(struct file *file, void *fh, |
443 | struct v4l2_dbg_register *reg) | 443 | struct v4l2_dbg_register *reg) |
444 | { | 444 | { |
445 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 445 | struct cx18 *cx = fh2id(fh)->cx; |
446 | 446 | ||
447 | if (v4l2_chip_match_host(®->match)) | 447 | if (v4l2_chip_match_host(®->match)) |
448 | return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); | 448 | return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); |
@@ -454,7 +454,7 @@ static int cx18_g_register(struct file *file, void *fh, | |||
454 | static int cx18_s_register(struct file *file, void *fh, | 454 | static int cx18_s_register(struct file *file, void *fh, |
455 | struct v4l2_dbg_register *reg) | 455 | struct v4l2_dbg_register *reg) |
456 | { | 456 | { |
457 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 457 | struct cx18 *cx = fh2id(fh)->cx; |
458 | 458 | ||
459 | if (v4l2_chip_match_host(®->match)) | 459 | if (v4l2_chip_match_host(®->match)) |
460 | return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); | 460 | return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); |
@@ -466,7 +466,7 @@ static int cx18_s_register(struct file *file, void *fh, | |||
466 | 466 | ||
467 | static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) | 467 | static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) |
468 | { | 468 | { |
469 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 469 | struct cx18 *cx = file2id(file)->cx; |
470 | 470 | ||
471 | *p = v4l2_prio_max(&cx->prio); | 471 | *p = v4l2_prio_max(&cx->prio); |
472 | return 0; | 472 | return 0; |
@@ -474,7 +474,7 @@ static int cx18_g_priority(struct file *file, void *fh, enum v4l2_priority *p) | |||
474 | 474 | ||
475 | static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio) | 475 | static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio) |
476 | { | 476 | { |
477 | struct cx18_open_id *id = fh; | 477 | struct cx18_open_id *id = file2id(file); |
478 | struct cx18 *cx = id->cx; | 478 | struct cx18 *cx = id->cx; |
479 | 479 | ||
480 | return v4l2_prio_change(&cx->prio, &id->prio, prio); | 480 | return v4l2_prio_change(&cx->prio, &id->prio, prio); |
@@ -483,7 +483,7 @@ static int cx18_s_priority(struct file *file, void *fh, enum v4l2_priority prio) | |||
483 | static int cx18_querycap(struct file *file, void *fh, | 483 | static int cx18_querycap(struct file *file, void *fh, |
484 | struct v4l2_capability *vcap) | 484 | struct v4l2_capability *vcap) |
485 | { | 485 | { |
486 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 486 | struct cx18 *cx = fh2id(fh)->cx; |
487 | 487 | ||
488 | strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); | 488 | strlcpy(vcap->driver, CX18_DRIVER_NAME, sizeof(vcap->driver)); |
489 | strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); | 489 | strlcpy(vcap->card, cx->card_name, sizeof(vcap->card)); |
@@ -496,14 +496,14 @@ static int cx18_querycap(struct file *file, void *fh, | |||
496 | 496 | ||
497 | static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin) | 497 | static int cx18_enumaudio(struct file *file, void *fh, struct v4l2_audio *vin) |
498 | { | 498 | { |
499 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 499 | struct cx18 *cx = fh2id(fh)->cx; |
500 | 500 | ||
501 | return cx18_get_audio_input(cx, vin->index, vin); | 501 | return cx18_get_audio_input(cx, vin->index, vin); |
502 | } | 502 | } |
503 | 503 | ||
504 | static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) | 504 | static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) |
505 | { | 505 | { |
506 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 506 | struct cx18 *cx = fh2id(fh)->cx; |
507 | 507 | ||
508 | vin->index = cx->audio_input; | 508 | vin->index = cx->audio_input; |
509 | return cx18_get_audio_input(cx, vin->index, vin); | 509 | return cx18_get_audio_input(cx, vin->index, vin); |
@@ -511,7 +511,7 @@ static int cx18_g_audio(struct file *file, void *fh, struct v4l2_audio *vin) | |||
511 | 511 | ||
512 | static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) | 512 | static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) |
513 | { | 513 | { |
514 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 514 | struct cx18 *cx = fh2id(fh)->cx; |
515 | 515 | ||
516 | if (vout->index >= cx->nof_audio_inputs) | 516 | if (vout->index >= cx->nof_audio_inputs) |
517 | return -EINVAL; | 517 | return -EINVAL; |
@@ -522,7 +522,7 @@ static int cx18_s_audio(struct file *file, void *fh, struct v4l2_audio *vout) | |||
522 | 522 | ||
523 | static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin) | 523 | static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin) |
524 | { | 524 | { |
525 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 525 | struct cx18 *cx = fh2id(fh)->cx; |
526 | 526 | ||
527 | /* set it to defaults from our table */ | 527 | /* set it to defaults from our table */ |
528 | return cx18_get_input(cx, vin->index, vin); | 528 | return cx18_get_input(cx, vin->index, vin); |
@@ -531,7 +531,7 @@ static int cx18_enum_input(struct file *file, void *fh, struct v4l2_input *vin) | |||
531 | static int cx18_cropcap(struct file *file, void *fh, | 531 | static int cx18_cropcap(struct file *file, void *fh, |
532 | struct v4l2_cropcap *cropcap) | 532 | struct v4l2_cropcap *cropcap) |
533 | { | 533 | { |
534 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 534 | struct cx18 *cx = fh2id(fh)->cx; |
535 | 535 | ||
536 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 536 | if (cropcap->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
537 | return -EINVAL; | 537 | return -EINVAL; |
@@ -546,7 +546,7 @@ static int cx18_cropcap(struct file *file, void *fh, | |||
546 | 546 | ||
547 | static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 547 | static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) |
548 | { | 548 | { |
549 | struct cx18_open_id *id = fh; | 549 | struct cx18_open_id *id = fh2id(fh); |
550 | struct cx18 *cx = id->cx; | 550 | struct cx18 *cx = id->cx; |
551 | int ret; | 551 | int ret; |
552 | 552 | ||
@@ -562,7 +562,7 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop) | |||
562 | 562 | ||
563 | static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) | 563 | static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) |
564 | { | 564 | { |
565 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 565 | struct cx18 *cx = fh2id(fh)->cx; |
566 | 566 | ||
567 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | 567 | if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) |
568 | return -EINVAL; | 568 | return -EINVAL; |
@@ -590,7 +590,7 @@ static int cx18_enum_fmt_vid_cap(struct file *file, void *fh, | |||
590 | 590 | ||
591 | static int cx18_g_input(struct file *file, void *fh, unsigned int *i) | 591 | static int cx18_g_input(struct file *file, void *fh, unsigned int *i) |
592 | { | 592 | { |
593 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 593 | struct cx18 *cx = fh2id(fh)->cx; |
594 | 594 | ||
595 | *i = cx->active_input; | 595 | *i = cx->active_input; |
596 | return 0; | 596 | return 0; |
@@ -598,7 +598,7 @@ static int cx18_g_input(struct file *file, void *fh, unsigned int *i) | |||
598 | 598 | ||
599 | int cx18_s_input(struct file *file, void *fh, unsigned int inp) | 599 | int cx18_s_input(struct file *file, void *fh, unsigned int inp) |
600 | { | 600 | { |
601 | struct cx18_open_id *id = fh; | 601 | struct cx18_open_id *id = fh2id(fh); |
602 | struct cx18 *cx = id->cx; | 602 | struct cx18 *cx = id->cx; |
603 | int ret; | 603 | int ret; |
604 | 604 | ||
@@ -633,7 +633,7 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp) | |||
633 | static int cx18_g_frequency(struct file *file, void *fh, | 633 | static int cx18_g_frequency(struct file *file, void *fh, |
634 | struct v4l2_frequency *vf) | 634 | struct v4l2_frequency *vf) |
635 | { | 635 | { |
636 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 636 | struct cx18 *cx = fh2id(fh)->cx; |
637 | 637 | ||
638 | if (vf->tuner != 0) | 638 | if (vf->tuner != 0) |
639 | return -EINVAL; | 639 | return -EINVAL; |
@@ -644,7 +644,7 @@ static int cx18_g_frequency(struct file *file, void *fh, | |||
644 | 644 | ||
645 | int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | 645 | int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) |
646 | { | 646 | { |
647 | struct cx18_open_id *id = fh; | 647 | struct cx18_open_id *id = fh2id(fh); |
648 | struct cx18 *cx = id->cx; | 648 | struct cx18 *cx = id->cx; |
649 | int ret; | 649 | int ret; |
650 | 650 | ||
@@ -664,7 +664,7 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf) | |||
664 | 664 | ||
665 | static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) | 665 | static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) |
666 | { | 666 | { |
667 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 667 | struct cx18 *cx = fh2id(fh)->cx; |
668 | 668 | ||
669 | *std = cx->std; | 669 | *std = cx->std; |
670 | return 0; | 670 | return 0; |
@@ -672,7 +672,7 @@ static int cx18_g_std(struct file *file, void *fh, v4l2_std_id *std) | |||
672 | 672 | ||
673 | int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std) | 673 | int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std) |
674 | { | 674 | { |
675 | struct cx18_open_id *id = fh; | 675 | struct cx18_open_id *id = fh2id(fh); |
676 | struct cx18 *cx = id->cx; | 676 | struct cx18 *cx = id->cx; |
677 | int ret; | 677 | int ret; |
678 | 678 | ||
@@ -713,7 +713,7 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std) | |||
713 | 713 | ||
714 | static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | 714 | static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) |
715 | { | 715 | { |
716 | struct cx18_open_id *id = fh; | 716 | struct cx18_open_id *id = fh2id(fh); |
717 | struct cx18 *cx = id->cx; | 717 | struct cx18 *cx = id->cx; |
718 | int ret; | 718 | int ret; |
719 | 719 | ||
@@ -730,7 +730,7 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
730 | 730 | ||
731 | static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | 731 | static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) |
732 | { | 732 | { |
733 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 733 | struct cx18 *cx = fh2id(fh)->cx; |
734 | 734 | ||
735 | if (vt->index != 0) | 735 | if (vt->index != 0) |
736 | return -EINVAL; | 736 | return -EINVAL; |
@@ -751,7 +751,7 @@ static int cx18_g_tuner(struct file *file, void *fh, struct v4l2_tuner *vt) | |||
751 | static int cx18_g_sliced_vbi_cap(struct file *file, void *fh, | 751 | static int cx18_g_sliced_vbi_cap(struct file *file, void *fh, |
752 | struct v4l2_sliced_vbi_cap *cap) | 752 | struct v4l2_sliced_vbi_cap *cap) |
753 | { | 753 | { |
754 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 754 | struct cx18 *cx = fh2id(fh)->cx; |
755 | int set = cx->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; | 755 | int set = cx->is_50hz ? V4L2_SLICED_VBI_625 : V4L2_SLICED_VBI_525; |
756 | int f, l; | 756 | int f, l; |
757 | 757 | ||
@@ -872,7 +872,7 @@ static int cx18_process_idx_data(struct cx18_stream *s, struct cx18_mdl *mdl, | |||
872 | static int cx18_g_enc_index(struct file *file, void *fh, | 872 | static int cx18_g_enc_index(struct file *file, void *fh, |
873 | struct v4l2_enc_idx *idx) | 873 | struct v4l2_enc_idx *idx) |
874 | { | 874 | { |
875 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 875 | struct cx18 *cx = fh2id(fh)->cx; |
876 | struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; | 876 | struct cx18_stream *s = &cx->streams[CX18_ENC_STREAM_TYPE_IDX]; |
877 | s32 tmp; | 877 | s32 tmp; |
878 | struct cx18_mdl *mdl; | 878 | struct cx18_mdl *mdl; |
@@ -919,7 +919,7 @@ static int cx18_g_enc_index(struct file *file, void *fh, | |||
919 | static int cx18_encoder_cmd(struct file *file, void *fh, | 919 | static int cx18_encoder_cmd(struct file *file, void *fh, |
920 | struct v4l2_encoder_cmd *enc) | 920 | struct v4l2_encoder_cmd *enc) |
921 | { | 921 | { |
922 | struct cx18_open_id *id = fh; | 922 | struct cx18_open_id *id = fh2id(fh); |
923 | struct cx18 *cx = id->cx; | 923 | struct cx18 *cx = id->cx; |
924 | u32 h; | 924 | u32 h; |
925 | 925 | ||
@@ -980,7 +980,7 @@ static int cx18_encoder_cmd(struct file *file, void *fh, | |||
980 | static int cx18_try_encoder_cmd(struct file *file, void *fh, | 980 | static int cx18_try_encoder_cmd(struct file *file, void *fh, |
981 | struct v4l2_encoder_cmd *enc) | 981 | struct v4l2_encoder_cmd *enc) |
982 | { | 982 | { |
983 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 983 | struct cx18 *cx = fh2id(fh)->cx; |
984 | 984 | ||
985 | switch (enc->cmd) { | 985 | switch (enc->cmd) { |
986 | case V4L2_ENC_CMD_START: | 986 | case V4L2_ENC_CMD_START: |
@@ -1012,7 +1012,7 @@ static int cx18_try_encoder_cmd(struct file *file, void *fh, | |||
1012 | 1012 | ||
1013 | static int cx18_log_status(struct file *file, void *fh) | 1013 | static int cx18_log_status(struct file *file, void *fh) |
1014 | { | 1014 | { |
1015 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 1015 | struct cx18 *cx = fh2id(fh)->cx; |
1016 | struct v4l2_input vidin; | 1016 | struct v4l2_input vidin; |
1017 | struct v4l2_audio audin; | 1017 | struct v4l2_audio audin; |
1018 | int i; | 1018 | int i; |
@@ -1060,7 +1060,7 @@ static int cx18_log_status(struct file *file, void *fh) | |||
1060 | static long cx18_default(struct file *file, void *fh, bool valid_prio, | 1060 | static long cx18_default(struct file *file, void *fh, bool valid_prio, |
1061 | int cmd, void *arg) | 1061 | int cmd, void *arg) |
1062 | { | 1062 | { |
1063 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 1063 | struct cx18 *cx = fh2id(fh)->cx; |
1064 | 1064 | ||
1065 | switch (cmd) { | 1065 | switch (cmd) { |
1066 | case VIDIOC_INT_RESET: { | 1066 | case VIDIOC_INT_RESET: { |
@@ -1082,7 +1082,7 @@ long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd, | |||
1082 | unsigned long arg) | 1082 | unsigned long arg) |
1083 | { | 1083 | { |
1084 | struct video_device *vfd = video_devdata(filp); | 1084 | struct video_device *vfd = video_devdata(filp); |
1085 | struct cx18_open_id *id = filp->private_data; | 1085 | struct cx18_open_id *id = file2id(filp); |
1086 | struct cx18 *cx = id->cx; | 1086 | struct cx18 *cx = id->cx; |
1087 | long res; | 1087 | long res; |
1088 | 1088 | ||