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/video/cx18/cx18-fileops.c | |
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/video/cx18/cx18-fileops.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-fileops.c | 18 |
1 files changed, 13 insertions, 5 deletions
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 | ||