diff options
Diffstat (limited to 'drivers/media/video/au0828/au0828-video.c')
-rw-r--r-- | drivers/media/video/au0828/au0828-video.c | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 1485aee18d58..13a8a1db5349 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include "au0828.h" | 40 | #include "au0828.h" |
41 | #include "au0828-reg.h" | 41 | #include "au0828-reg.h" |
42 | 42 | ||
43 | static LIST_HEAD(au0828_devlist); | ||
44 | static DEFINE_MUTEX(au0828_sysfs_lock); | 43 | static DEFINE_MUTEX(au0828_sysfs_lock); |
45 | 44 | ||
46 | #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) | 45 | #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1) |
@@ -693,10 +692,8 @@ void au0828_analog_unregister(struct au0828_dev *dev) | |||
693 | dprintk(1, "au0828_release_resources called\n"); | 692 | dprintk(1, "au0828_release_resources called\n"); |
694 | mutex_lock(&au0828_sysfs_lock); | 693 | mutex_lock(&au0828_sysfs_lock); |
695 | 694 | ||
696 | if (dev->vdev) { | 695 | if (dev->vdev) |
697 | list_del(&dev->au0828list); | ||
698 | video_unregister_device(dev->vdev); | 696 | video_unregister_device(dev->vdev); |
699 | } | ||
700 | if (dev->vbi_dev) | 697 | if (dev->vbi_dev) |
701 | video_unregister_device(dev->vbi_dev); | 698 | video_unregister_device(dev->vbi_dev); |
702 | 699 | ||
@@ -737,29 +734,15 @@ static void res_free(struct au0828_fh *fh) | |||
737 | 734 | ||
738 | static int au0828_v4l2_open(struct file *filp) | 735 | static int au0828_v4l2_open(struct file *filp) |
739 | { | 736 | { |
740 | int minor = video_devdata(filp)->minor; | ||
741 | int ret = 0; | 737 | int ret = 0; |
742 | struct au0828_dev *h, *dev = NULL; | 738 | struct au0828_dev *dev = video_drvdata(filp); |
743 | struct au0828_fh *fh; | 739 | struct au0828_fh *fh; |
744 | int type = 0; | 740 | int type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
745 | struct list_head *list; | 741 | |
746 | |||
747 | list_for_each(list, &au0828_devlist) { | ||
748 | h = list_entry(list, struct au0828_dev, au0828list); | ||
749 | if (h->vdev->minor == minor) { | ||
750 | dev = h; | ||
751 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
752 | } | ||
753 | #ifdef VBI_IS_WORKING | 742 | #ifdef VBI_IS_WORKING |
754 | if (h->vbi_dev->minor == minor) { | 743 | if (video_devdata(filp)->vfl_type == VFL_TYPE_GRABBER) |
755 | dev = h; | 744 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
756 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | ||
757 | } | ||
758 | #endif | 745 | #endif |
759 | } | ||
760 | |||
761 | if (NULL == dev) | ||
762 | return -ENODEV; | ||
763 | 746 | ||
764 | fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL); | 747 | fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL); |
765 | if (NULL == fh) { | 748 | if (NULL == fh) { |
@@ -1676,25 +1659,23 @@ int au0828_analog_register(struct au0828_dev *dev, | |||
1676 | strcpy(dev->vbi_dev->name, "au0828a vbi"); | 1659 | strcpy(dev->vbi_dev->name, "au0828a vbi"); |
1677 | #endif | 1660 | #endif |
1678 | 1661 | ||
1679 | list_add_tail(&dev->au0828list, &au0828_devlist); | ||
1680 | |||
1681 | /* Register the v4l2 device */ | 1662 | /* Register the v4l2 device */ |
1663 | video_set_drvdata(dev->vdev, dev); | ||
1682 | retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1); | 1664 | retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1); |
1683 | if (retval != 0) { | 1665 | if (retval != 0) { |
1684 | dprintk(1, "unable to register video device (error = %d).\n", | 1666 | dprintk(1, "unable to register video device (error = %d).\n", |
1685 | retval); | 1667 | retval); |
1686 | list_del(&dev->au0828list); | ||
1687 | video_device_release(dev->vdev); | 1668 | video_device_release(dev->vdev); |
1688 | return -ENODEV; | 1669 | return -ENODEV; |
1689 | } | 1670 | } |
1690 | 1671 | ||
1691 | #ifdef VBI_IS_WORKING | 1672 | #ifdef VBI_IS_WORKING |
1692 | /* Register the vbi device */ | 1673 | /* Register the vbi device */ |
1674 | video_set_drvdata(dev->vbi_dev, dev); | ||
1693 | retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1); | 1675 | retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1); |
1694 | if (retval != 0) { | 1676 | if (retval != 0) { |
1695 | dprintk(1, "unable to register vbi device (error = %d).\n", | 1677 | dprintk(1, "unable to register vbi device (error = %d).\n", |
1696 | retval); | 1678 | retval); |
1697 | list_del(&dev->au0828list); | ||
1698 | video_device_release(dev->vbi_dev); | 1679 | video_device_release(dev->vbi_dev); |
1699 | video_device_release(dev->vdev); | 1680 | video_device_release(dev->vdev); |
1700 | return -ENODEV; | 1681 | return -ENODEV; |