diff options
author | Andy Walls <awalls@radix.net> | 2009-02-14 15:08:37 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:01 -0400 |
commit | 5811cf99df2e3c102055be3ea77508e56c9f77c6 (patch) | |
tree | 75be74b5072280edadeee2c1f6c42f5e961c208c /drivers/media/video/cx18/cx18-fileops.c | |
parent | 1a2670465ec94029e5df62e3decca9e2f7aea075 (diff) |
V4L/DVB (10756): cx18: Slim down instance handling, build names from v4l2_device.name
Convert card instance handling to a lighter weight mechanism like ivtv.
Also convert name strings and debug messages to use v4l2_device.name.
Signed-off-by: Andy Walls <awalls@radix.net>
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 | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c index 68dd50ac4bfe..757982ea3766 100644 --- a/drivers/media/video/cx18/cx18-fileops.c +++ b/drivers/media/video/cx18/cx18-fileops.c | |||
@@ -682,38 +682,15 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) | |||
682 | 682 | ||
683 | int cx18_v4l2_open(struct file *filp) | 683 | int cx18_v4l2_open(struct file *filp) |
684 | { | 684 | { |
685 | int res, x, y = 0; | 685 | int res; |
686 | struct cx18 *cx = NULL; | 686 | struct video_device *video_dev = video_devdata(filp); |
687 | struct cx18_stream *s = NULL; | 687 | struct cx18_stream *s = video_get_drvdata(video_dev); |
688 | int minor = video_devdata(filp)->minor; | 688 | struct cx18 *cx = s->cx;; |
689 | |||
690 | /* Find which card this open was on */ | ||
691 | spin_lock(&cx18_cards_lock); | ||
692 | for (x = 0; cx == NULL && x < cx18_cards_active; x++) { | ||
693 | /* find out which stream this open was on */ | ||
694 | for (y = 0; y < CX18_MAX_STREAMS; y++) { | ||
695 | if (cx18_cards[x] == NULL) | ||
696 | continue; | ||
697 | s = &cx18_cards[x]->streams[y]; | ||
698 | if (s->video_dev && s->video_dev->minor == minor) { | ||
699 | cx = cx18_cards[x]; | ||
700 | break; | ||
701 | } | ||
702 | } | ||
703 | } | ||
704 | spin_unlock(&cx18_cards_lock); | ||
705 | |||
706 | if (cx == NULL) { | ||
707 | /* Couldn't find a device registered | ||
708 | on that minor, shouldn't happen! */ | ||
709 | printk(KERN_WARNING "No cx18 device found on minor %d\n", | ||
710 | minor); | ||
711 | return -ENXIO; | ||
712 | } | ||
713 | 689 | ||
714 | mutex_lock(&cx->serialize_lock); | 690 | mutex_lock(&cx->serialize_lock); |
715 | if (cx18_init_on_first_open(cx)) { | 691 | if (cx18_init_on_first_open(cx)) { |
716 | CX18_ERR("Failed to initialize on minor %d\n", minor); | 692 | CX18_ERR("Failed to initialize on minor %d\n", |
693 | video_dev->minor); | ||
717 | mutex_unlock(&cx->serialize_lock); | 694 | mutex_unlock(&cx->serialize_lock); |
718 | return -ENXIO; | 695 | return -ENXIO; |
719 | } | 696 | } |