aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88/cx88-video.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-12-10 08:44:04 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:17:56 -0500
commit63b0d5ad20365edf8baf96cdbb8e7faf62501286 (patch)
tree9a12041cab48051834ee67d0de358443464e5d94 /drivers/media/video/cx88/cx88-video.c
parentf0813b4c9f7ffbeaddcba1c08a1812f7ff30e1b7 (diff)
V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers
Fix all device drivers to use the video_drvdata function instead of maintaining a local list of minor to private data mappings. Call video_set_drvdata to register the driver private pointer when not already done. Where applicable, the local list of mappings is completely removed when it becomes unused. [mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging] Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88/cx88-video.c')
-rw-r--r--drivers/media/video/cx88/cx88-video.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 0259ac6d8147..758399173a52 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -75,10 +75,6 @@ MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes");
75#define dprintk(level,fmt, arg...) if (video_debug >= level) \ 75#define dprintk(level,fmt, arg...) if (video_debug >= level) \
76 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg) 76 printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
77 77
78/* ------------------------------------------------------------------ */
79
80static LIST_HEAD(cx8800_devlist);
81
82/* ------------------------------------------------------------------- */ 78/* ------------------------------------------------------------------- */
83/* static data */ 79/* static data */
84 80
@@ -754,33 +750,27 @@ static int get_ressource(struct cx8800_fh *fh)
754static int video_open(struct file *file) 750static int video_open(struct file *file)
755{ 751{
756 int minor = video_devdata(file)->minor; 752 int minor = video_devdata(file)->minor;
757 struct cx8800_dev *h,*dev = NULL; 753 struct video_device *vdev = video_devdata(file);
754 struct cx8800_dev *dev = video_drvdata(file);
758 struct cx88_core *core; 755 struct cx88_core *core;
759 struct cx8800_fh *fh; 756 struct cx8800_fh *fh;
760 enum v4l2_buf_type type = 0; 757 enum v4l2_buf_type type = 0;
761 int radio = 0; 758 int radio = 0;
762 759
763 lock_kernel(); 760 switch (vdev->vfl_type) {
764 list_for_each_entry(h, &cx8800_devlist, devlist) { 761 case VFL_TYPE_GRABBER:
765 if (h->video_dev->minor == minor) { 762 type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
766 dev = h; 763 break;
767 type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 764 case VFL_TYPE_VBI:
768 } 765 type = V4L2_BUF_TYPE_VBI_CAPTURE;
769 if (h->vbi_dev->minor == minor) { 766 break;
770 dev = h; 767 case VFL_TYPE_RADIO:
771 type = V4L2_BUF_TYPE_VBI_CAPTURE; 768 radio = 1;
772 } 769 break;
773 if (h->radio_dev &&
774 h->radio_dev->minor == minor) {
775 radio = 1;
776 dev = h;
777 }
778 }
779 if (NULL == dev) {
780 unlock_kernel();
781 return -ENODEV;
782 } 770 }
783 771
772 lock_kernel();
773
784 core = dev->core; 774 core = dev->core;
785 775
786 dprintk(1,"open minor=%d radio=%d type=%s\n", 776 dprintk(1,"open minor=%d radio=%d type=%s\n",
@@ -1909,6 +1899,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1909 /* register v4l devices */ 1899 /* register v4l devices */
1910 dev->video_dev = cx88_vdev_init(core,dev->pci, 1900 dev->video_dev = cx88_vdev_init(core,dev->pci,
1911 &cx8800_video_template,"video"); 1901 &cx8800_video_template,"video");
1902 video_set_drvdata(dev->video_dev, dev);
1912 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, 1903 err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
1913 video_nr[core->nr]); 1904 video_nr[core->nr]);
1914 if (err < 0) { 1905 if (err < 0) {
@@ -1920,6 +1911,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1920 core->name, video_device_node_name(dev->video_dev)); 1911 core->name, video_device_node_name(dev->video_dev));
1921 1912
1922 dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi"); 1913 dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi");
1914 video_set_drvdata(dev->vbi_dev, dev);
1923 err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, 1915 err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
1924 vbi_nr[core->nr]); 1916 vbi_nr[core->nr]);
1925 if (err < 0) { 1917 if (err < 0) {
@@ -1933,6 +1925,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1933 if (core->board.radio.type == CX88_RADIO) { 1925 if (core->board.radio.type == CX88_RADIO) {
1934 dev->radio_dev = cx88_vdev_init(core,dev->pci, 1926 dev->radio_dev = cx88_vdev_init(core,dev->pci,
1935 &cx8800_radio_template,"radio"); 1927 &cx8800_radio_template,"radio");
1928 video_set_drvdata(dev->radio_dev, dev);
1936 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO, 1929 err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
1937 radio_nr[core->nr]); 1930 radio_nr[core->nr]);
1938 if (err < 0) { 1931 if (err < 0) {
@@ -1945,7 +1938,6 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1945 } 1938 }
1946 1939
1947 /* everything worked */ 1940 /* everything worked */
1948 list_add_tail(&dev->devlist,&cx8800_devlist);
1949 pci_set_drvdata(pci_dev,dev); 1941 pci_set_drvdata(pci_dev,dev);
1950 1942
1951 /* initial device configuration */ 1943 /* initial device configuration */
@@ -2001,7 +1993,6 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev)
2001 1993
2002 /* free memory */ 1994 /* free memory */
2003 btcx_riscmem_free(dev->pci,&dev->vidq.stopper); 1995 btcx_riscmem_free(dev->pci,&dev->vidq.stopper);
2004 list_del(&dev->devlist);
2005 cx88_core_put(core,dev->pci); 1996 cx88_core_put(core,dev->pci);
2006 kfree(dev); 1997 kfree(dev);
2007} 1998}