diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-03-13 07:02:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:48 -0400 |
commit | c0714f6cc6a7850062db41d5b2b8b90e5682ae41 (patch) | |
tree | 613844eec6820177fba20d290c99949878dbb219 /drivers/media/video | |
parent | 8bbd90ce80d39d372857235f00c7abb208bd9e4f (diff) |
V4L/DVB (11295): cx23885: convert to v4l2_device.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx23885/cx23885-core.c | 17 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-i2c.c | 9 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-video.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 8 |
4 files changed, 25 insertions, 13 deletions
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index d19d453cf62a..548279225d73 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -1739,16 +1739,20 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | |||
1739 | if (NULL == dev) | 1739 | if (NULL == dev) |
1740 | return -ENOMEM; | 1740 | return -ENOMEM; |
1741 | 1741 | ||
1742 | err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev); | ||
1743 | if (err < 0) | ||
1744 | goto fail_free; | ||
1745 | |||
1742 | /* pci init */ | 1746 | /* pci init */ |
1743 | dev->pci = pci_dev; | 1747 | dev->pci = pci_dev; |
1744 | if (pci_enable_device(pci_dev)) { | 1748 | if (pci_enable_device(pci_dev)) { |
1745 | err = -EIO; | 1749 | err = -EIO; |
1746 | goto fail_free; | 1750 | goto fail_unreg; |
1747 | } | 1751 | } |
1748 | 1752 | ||
1749 | if (cx23885_dev_setup(dev) < 0) { | 1753 | if (cx23885_dev_setup(dev) < 0) { |
1750 | err = -EINVAL; | 1754 | err = -EINVAL; |
1751 | goto fail_free; | 1755 | goto fail_unreg; |
1752 | } | 1756 | } |
1753 | 1757 | ||
1754 | /* print pci info */ | 1758 | /* print pci info */ |
@@ -1775,8 +1779,6 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | |||
1775 | goto fail_irq; | 1779 | goto fail_irq; |
1776 | } | 1780 | } |
1777 | 1781 | ||
1778 | pci_set_drvdata(pci_dev, dev); | ||
1779 | |||
1780 | switch (dev->board) { | 1782 | switch (dev->board) { |
1781 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: | 1783 | case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: |
1782 | cx_set(PCI_INT_MSK, 0x01800000); /* for NetUP */ | 1784 | cx_set(PCI_INT_MSK, 0x01800000); /* for NetUP */ |
@@ -1787,6 +1789,8 @@ static int __devinit cx23885_initdev(struct pci_dev *pci_dev, | |||
1787 | 1789 | ||
1788 | fail_irq: | 1790 | fail_irq: |
1789 | cx23885_dev_unregister(dev); | 1791 | cx23885_dev_unregister(dev); |
1792 | fail_unreg: | ||
1793 | v4l2_device_unregister(&dev->v4l2_dev); | ||
1790 | fail_free: | 1794 | fail_free: |
1791 | kfree(dev); | 1795 | kfree(dev); |
1792 | return err; | 1796 | return err; |
@@ -1794,7 +1798,8 @@ fail_free: | |||
1794 | 1798 | ||
1795 | static void __devexit cx23885_finidev(struct pci_dev *pci_dev) | 1799 | static void __devexit cx23885_finidev(struct pci_dev *pci_dev) |
1796 | { | 1800 | { |
1797 | struct cx23885_dev *dev = pci_get_drvdata(pci_dev); | 1801 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
1802 | struct cx23885_dev *dev = to_cx23885(v4l2_dev); | ||
1798 | 1803 | ||
1799 | cx23885_shutdown(dev); | 1804 | cx23885_shutdown(dev); |
1800 | 1805 | ||
@@ -1802,13 +1807,13 @@ static void __devexit cx23885_finidev(struct pci_dev *pci_dev) | |||
1802 | 1807 | ||
1803 | /* unregister stuff */ | 1808 | /* unregister stuff */ |
1804 | free_irq(pci_dev->irq, dev); | 1809 | free_irq(pci_dev->irq, dev); |
1805 | pci_set_drvdata(pci_dev, NULL); | ||
1806 | 1810 | ||
1807 | mutex_lock(&devlist); | 1811 | mutex_lock(&devlist); |
1808 | list_del(&dev->devlist); | 1812 | list_del(&dev->devlist); |
1809 | mutex_unlock(&devlist); | 1813 | mutex_unlock(&devlist); |
1810 | 1814 | ||
1811 | cx23885_dev_unregister(dev); | 1815 | cx23885_dev_unregister(dev); |
1816 | v4l2_device_unregister(v4l2_dev); | ||
1812 | kfree(dev); | 1817 | kfree(dev); |
1813 | } | 1818 | } |
1814 | 1819 | ||
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index bb7f71a1fcbe..969b7ebbc827 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
@@ -270,8 +270,8 @@ static int i2c_xfer(struct i2c_adapter *i2c_adap, | |||
270 | 270 | ||
271 | static int attach_inform(struct i2c_client *client) | 271 | static int attach_inform(struct i2c_client *client) |
272 | { | 272 | { |
273 | struct cx23885_i2c *bus = i2c_get_adapdata(client->adapter); | 273 | struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter); |
274 | struct cx23885_dev *dev = bus->dev; | 274 | struct cx23885_dev *dev = to_cx23885(v4l2_dev); |
275 | struct tuner_setup tun_setup; | 275 | struct tuner_setup tun_setup; |
276 | 276 | ||
277 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", | 277 | dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", |
@@ -310,7 +310,8 @@ static int attach_inform(struct i2c_client *client) | |||
310 | 310 | ||
311 | static int detach_inform(struct i2c_client *client) | 311 | static int detach_inform(struct i2c_client *client) |
312 | { | 312 | { |
313 | struct cx23885_dev *dev = i2c_get_adapdata(client->adapter); | 313 | struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter); |
314 | struct cx23885_dev *dev = to_cx23885(v4l2_dev); | ||
314 | 315 | ||
315 | dprintk(1, "i2c detach [client=%s]\n", client->name); | 316 | dprintk(1, "i2c detach [client=%s]\n", client->name); |
316 | 317 | ||
@@ -402,7 +403,7 @@ int cx23885_i2c_register(struct cx23885_i2c *bus) | |||
402 | 403 | ||
403 | bus->i2c_algo.data = bus; | 404 | bus->i2c_algo.data = bus; |
404 | bus->i2c_adap.algo_data = bus; | 405 | bus->i2c_adap.algo_data = bus; |
405 | i2c_set_adapdata(&bus->i2c_adap, bus); | 406 | i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev); |
406 | i2c_add_adapter(&bus->i2c_adap); | 407 | i2c_add_adapter(&bus->i2c_adap); |
407 | 408 | ||
408 | bus->i2c_client.adapter = &bus->i2c_adap; | 409 | bus->i2c_client.adapter = &bus->i2c_adap; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 726602935353..1596f4ff3dfe 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -320,8 +320,8 @@ static struct video_device *cx23885_vdev_init(struct cx23885_dev *dev, | |||
320 | if (NULL == vfd) | 320 | if (NULL == vfd) |
321 | return NULL; | 321 | return NULL; |
322 | *vfd = *template; | 322 | *vfd = *template; |
323 | vfd->minor = -1; | 323 | vfd->minor = -1; |
324 | vfd->parent = &pci->dev; | 324 | vfd->v4l2_dev = &dev->v4l2_dev; |
325 | vfd->release = video_device_release; | 325 | vfd->release = video_device_release; |
326 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", | 326 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", |
327 | dev->name, type, cx23885_boards[dev->board].name); | 327 | dev->name, type, cx23885_boards[dev->board].name); |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 779fc35b18d6..ba57643f1198 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/i2c-algo-bit.h> | 24 | #include <linux/i2c-algo-bit.h> |
25 | #include <linux/kdev_t.h> | 25 | #include <linux/kdev_t.h> |
26 | 26 | ||
27 | #include <media/v4l2-common.h> | 27 | #include <media/v4l2-device.h> |
28 | #include <media/tuner.h> | 28 | #include <media/tuner.h> |
29 | #include <media/tveeprom.h> | 29 | #include <media/tveeprom.h> |
30 | #include <media/videobuf-dma-sg.h> | 30 | #include <media/videobuf-dma-sg.h> |
@@ -277,6 +277,7 @@ struct cx23885_tsport { | |||
277 | struct cx23885_dev { | 277 | struct cx23885_dev { |
278 | struct list_head devlist; | 278 | struct list_head devlist; |
279 | atomic_t refcount; | 279 | atomic_t refcount; |
280 | struct v4l2_device v4l2_dev; | ||
280 | 281 | ||
281 | /* pci stuff */ | 282 | /* pci stuff */ |
282 | struct pci_dev *pci; | 283 | struct pci_dev *pci; |
@@ -342,6 +343,11 @@ struct cx23885_dev { | |||
342 | 343 | ||
343 | }; | 344 | }; |
344 | 345 | ||
346 | static inline struct cx23885_dev *to_cx23885(struct v4l2_device *v4l2_dev) | ||
347 | { | ||
348 | return container_of(v4l2_dev, struct cx23885_dev, v4l2_dev); | ||
349 | } | ||
350 | |||
345 | extern struct list_head cx23885_devlist; | 351 | extern struct list_head cx23885_devlist; |
346 | 352 | ||
347 | #define SRAM_CH01 0 /* Video A */ | 353 | #define SRAM_CH01 0 /* Video A */ |