diff options
author | Andy Walls <awalls@radix.net> | 2009-01-11 13:08:53 -0500 |
---|---|---|
committer | Andy Walls <awalls@radix.net> | 2009-01-11 13:08:53 -0500 |
commit | 708ba0701edccea0b0fc2b0ea9303337a85ff05c (patch) | |
tree | d721eb8a165d6027364643c3a0734a5ff03dcbc1 /linux/drivers/media/video/cx18 | |
parent | d50048287e23437dfd89b36c72a1740dea721004 (diff) | |
download | mediapointer-dvb-s2-708ba0701edccea0b0fc2b0ea9303337a85ff05c.tar.gz mediapointer-dvb-s2-708ba0701edccea0b0fc2b0ea9303337a85ff05c.tar.bz2 |
cx18: Conversion to new V4L2 framework: use v4l2_device object
From: Andy Walls <awalls@radix.net>
First step in conversion to the new V4L2 framework. Added per cx18 device
instance of the v4l2_device and its registration.
Priority: normal
Signed-off-by: Andy Walls <awalls@radix.net>
Diffstat (limited to 'linux/drivers/media/video/cx18')
-rw-r--r-- | linux/drivers/media/video/cx18/cx18-driver.c | 23 | ||||
-rw-r--r-- | linux/drivers/media/video/cx18/cx18-driver.h | 3 |
2 files changed, 19 insertions, 7 deletions
diff --git a/linux/drivers/media/video/cx18/cx18-driver.c b/linux/drivers/media/video/cx18/cx18-driver.c index 6fbed933e..ea23d34dc 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.c +++ b/linux/drivers/media/video/cx18/cx18-driver.c @@ -802,21 +802,28 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, return -ENOMEM; } cx18_cards[cx18_cards_active] = cx; - cx->pci_dev = pci_dev; cx->num = cx18_cards_active++; snprintf(cx->name, sizeof(cx->name), "cx18-%d", cx->num); CX18_INFO("Initializing card #%d\n", cx->num); spin_unlock(&cx18_cards_lock); + cx->pci_dev = pci_dev; + retval = v4l2_device_register(&pci_dev->dev, &cx->v4l2_dev); + if (retval) { + CX18_ERR("Call to v4l2_device_register() failed\n"); + goto err; + } + CX18_DEBUG_INFO("registered v4l2_device name: %s\n", cx->v4l2_dev.name); + cx18_process_options(cx); if (cx->options.cardtype == -1) { retval = -ENODEV; - goto err; + goto unregister_v4l2; } if (cx18_init_struct1(cx)) { retval = -ENOMEM; - goto err; + goto unregister_v4l2; } CX18_DEBUG_INFO("base addr: 0x%08x\n", cx->base_addr); @@ -826,9 +833,6 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev, if (retval != 0) goto free_workqueue; - /* save cx in the pci struct for later use */ - pci_set_drvdata(pci_dev, cx); - /* map io memory */ CX18_DEBUG_INFO("attempting ioremap at 0x%08x len 0x%08x\n", cx->base_addr + CX18_MEM_OFFSET, CX18_MEM_SIZE); @@ -1007,6 +1011,8 @@ free_mem: release_mem_region(cx->base_addr, CX18_MEM_SIZE); free_workqueue: destroy_workqueue(cx->work_queue); +unregister_v4l2: + v4l2_device_unregister(&cx->v4l2_dev); err: if (retval == 0) retval = -ENODEV; @@ -1113,7 +1119,8 @@ static void cx18_cancel_epu_work_orders(struct cx18 *cx) #endif static void cx18_remove(struct pci_dev *pci_dev) { - struct cx18 *cx = pci_get_drvdata(pci_dev); + struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); + struct cx18 *cx = container_of(v4l2_dev, struct cx18, v4l2_dev); CX18_DEBUG_INFO("Removing Card #%d\n", cx->num); @@ -1153,6 +1160,8 @@ static void cx18_remove(struct pci_dev *pci_dev) pci_disable_device(cx->pci_dev); + v4l2_device_unregister(v4l2_dev); + CX18_INFO("Removed %s, card #%d\n", cx->card_name, cx->num); } diff --git a/linux/drivers/media/video/cx18/cx18-driver.h b/linux/drivers/media/video/cx18/cx18-driver.h index 316ff333d..2d5bcbf1b 100644 --- a/linux/drivers/media/video/cx18/cx18-driver.h +++ b/linux/drivers/media/video/cx18/cx18-driver.h @@ -48,6 +48,7 @@ #include <linux/dvb/audio.h> #include <media/v4l2-common.h> #include <media/v4l2-ioctl.h> +#include <media/v4l2-device.h> #include <media/tuner.h> #include "cx18-mailbox.h" #include "cx18-av-core.h" @@ -386,6 +387,8 @@ struct cx18 { int num; /* board number, -1 during init! */ char name[8]; /* board name for printk and interrupts (e.g. 'cx180') */ struct pci_dev *pci_dev; + struct v4l2_device v4l2_dev; + const struct cx18_card *card; /* card information */ const char *card_name; /* full name of the card */ const struct cx18_card_tuner_i2c *card_i2c; /* i2c addresses to probe for tuner */ |