aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/au0828
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-01-23 01:45:46 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-23 01:45:46 -0500
commit6be325719b3e54624397e413efd4b33a997e55a3 (patch)
tree57f321a56794cab2222e179b16731e0d76a4a68a /drivers/media/video/au0828
parent26d92f9276a56d55511a427fb70bd70886af647a (diff)
parent92dcffb916d309aa01778bf8963a6932e4014d07 (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/media/video/au0828')
-rw-r--r--drivers/media/video/au0828/au0828-video.c36
-rw-r--r--drivers/media/video/au0828/au0828.h1
2 files changed, 8 insertions, 29 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index 1485aee18d58..dc67bc40f36f 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
43static LIST_HEAD(au0828_devlist);
44static DEFINE_MUTEX(au0828_sysfs_lock); 43static 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
738static int au0828_v4l2_open(struct file *filp) 735static 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) {
@@ -1587,7 +1570,6 @@ static const struct video_device au0828_video_template = {
1587 .fops = &au0828_v4l_fops, 1570 .fops = &au0828_v4l_fops,
1588 .release = video_device_release, 1571 .release = video_device_release,
1589 .ioctl_ops = &video_ioctl_ops, 1572 .ioctl_ops = &video_ioctl_ops,
1590 .minor = -1,
1591 .tvnorms = V4L2_STD_NTSC_M, 1573 .tvnorms = V4L2_STD_NTSC_M,
1592 .current_norm = V4L2_STD_NTSC_M, 1574 .current_norm = V4L2_STD_NTSC_M,
1593}; 1575};
@@ -1676,25 +1658,23 @@ int au0828_analog_register(struct au0828_dev *dev,
1676 strcpy(dev->vbi_dev->name, "au0828a vbi"); 1658 strcpy(dev->vbi_dev->name, "au0828a vbi");
1677#endif 1659#endif
1678 1660
1679 list_add_tail(&dev->au0828list, &au0828_devlist);
1680
1681 /* Register the v4l2 device */ 1661 /* Register the v4l2 device */
1662 video_set_drvdata(dev->vdev, dev);
1682 retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1); 1663 retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1);
1683 if (retval != 0) { 1664 if (retval != 0) {
1684 dprintk(1, "unable to register video device (error = %d).\n", 1665 dprintk(1, "unable to register video device (error = %d).\n",
1685 retval); 1666 retval);
1686 list_del(&dev->au0828list);
1687 video_device_release(dev->vdev); 1667 video_device_release(dev->vdev);
1688 return -ENODEV; 1668 return -ENODEV;
1689 } 1669 }
1690 1670
1691#ifdef VBI_IS_WORKING 1671#ifdef VBI_IS_WORKING
1692 /* Register the vbi device */ 1672 /* Register the vbi device */
1673 video_set_drvdata(dev->vbi_dev, dev);
1693 retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1); 1674 retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1);
1694 if (retval != 0) { 1675 if (retval != 0) {
1695 dprintk(1, "unable to register vbi device (error = %d).\n", 1676 dprintk(1, "unable to register vbi device (error = %d).\n",
1696 retval); 1677 retval);
1697 list_del(&dev->au0828list);
1698 video_device_release(dev->vbi_dev); 1678 video_device_release(dev->vbi_dev);
1699 video_device_release(dev->vdev); 1679 video_device_release(dev->vdev);
1700 return -ENODEV; 1680 return -ENODEV;
diff --git a/drivers/media/video/au0828/au0828.h b/drivers/media/video/au0828/au0828.h
index b977915efbd0..207f32dec6a6 100644
--- a/drivers/media/video/au0828/au0828.h
+++ b/drivers/media/video/au0828/au0828.h
@@ -192,7 +192,6 @@ struct au0828_dev {
192 struct au0828_dvb dvb; 192 struct au0828_dvb dvb;
193 193
194 /* Analog */ 194 /* Analog */
195 struct list_head au0828list;
196 struct v4l2_device v4l2_dev; 195 struct v4l2_device v4l2_dev;
197 int users; 196 int users;
198 unsigned int stream_on:1; /* Locks streams */ 197 unsigned int stream_on:1; /* Locks streams */