aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx88
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-14 11:40:51 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:23 -0400
commit9467fe126451c7fc7878d21f3cd1938421ef972e (patch)
tree298d0aebb8328829a4b41729e817ccc1fff9c298 /drivers/media/video/cx88
parent74fc7bd9cec0ccdbea23659208492ec7ffc58297 (diff)
V4L/DVB (11047): cx88: 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/cx88')
-rw-r--r--drivers/media/video/cx88/cx88-cards.c8
-rw-r--r--drivers/media/video/cx88/cx88-core.c4
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c8
-rw-r--r--drivers/media/video/cx88/cx88.h8
4 files changed, 23 insertions, 5 deletions
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 1d7e3a562995..b9def8cbcdab 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -3138,7 +3138,15 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
3138 3138
3139 core->nr = nr; 3139 core->nr = nr;
3140 sprintf(core->name, "cx88[%d]", core->nr); 3140 sprintf(core->name, "cx88[%d]", core->nr);
3141
3142 strcpy(core->v4l2_dev.name, core->name);
3143 if (v4l2_device_register(NULL, &core->v4l2_dev)) {
3144 kfree(core);
3145 return NULL;
3146 }
3147
3141 if (0 != cx88_get_resources(core, pci)) { 3148 if (0 != cx88_get_resources(core, pci)) {
3149 v4l2_device_unregister(&core->v4l2_dev);
3142 kfree(core); 3150 kfree(core);
3143 return NULL; 3151 return NULL;
3144 } 3152 }
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index b045874ad04f..17c7dad42617 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -1011,7 +1011,8 @@ struct video_device *cx88_vdev_init(struct cx88_core *core,
1011 return NULL; 1011 return NULL;
1012 *vfd = *template; 1012 *vfd = *template;
1013 vfd->minor = -1; 1013 vfd->minor = -1;
1014 vfd->parent = &pci->dev; 1014 vfd->v4l2_dev = &core->v4l2_dev;
1015 vfd->parent = &pci->dev;
1015 vfd->release = video_device_release; 1016 vfd->release = video_device_release;
1016 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", 1017 snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
1017 core->name, type, core->board.name); 1018 core->name, type, core->board.name);
@@ -1064,6 +1065,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
1064 iounmap(core->lmmio); 1065 iounmap(core->lmmio);
1065 cx88_devcount--; 1066 cx88_devcount--;
1066 mutex_unlock(&devlist); 1067 mutex_unlock(&devlist);
1068 v4l2_device_unregister(&core->v4l2_dev);
1067 kfree(core); 1069 kfree(core);
1068} 1070}
1069 1071
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index c0ff2305d804..4a17a7579323 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -99,7 +99,8 @@ static int cx8800_bit_getsda(void *data)
99 99
100static int attach_inform(struct i2c_client *client) 100static int attach_inform(struct i2c_client *client)
101{ 101{
102 struct cx88_core *core = i2c_get_adapdata(client->adapter); 102 struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
103 struct cx88_core *core = to_core(v4l2_dev);
103 104
104 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", 105 dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
105 client->driver->driver.name, client->addr, client->name); 106 client->driver->driver.name, client->addr, client->name);
@@ -108,7 +109,8 @@ static int attach_inform(struct i2c_client *client)
108 109
109static int detach_inform(struct i2c_client *client) 110static int detach_inform(struct i2c_client *client)
110{ 111{
111 struct cx88_core *core = i2c_get_adapdata(client->adapter); 112 struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
113 struct cx88_core *core = to_core(v4l2_dev);
112 114
113 dprintk(1, "i2c detach [client=%s]\n", client->name); 115 dprintk(1, "i2c detach [client=%s]\n", client->name);
114 return 0; 116 return 0;
@@ -186,7 +188,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
186 core->i2c_adap.client_unregister = detach_inform; 188 core->i2c_adap.client_unregister = detach_inform;
187 core->i2c_algo.udelay = i2c_udelay; 189 core->i2c_algo.udelay = i2c_udelay;
188 core->i2c_algo.data = core; 190 core->i2c_algo.data = core;
189 i2c_set_adapdata(&core->i2c_adap,core); 191 i2c_set_adapdata(&core->i2c_adap, &core->v4l2_dev);
190 core->i2c_adap.algo_data = &core->i2c_algo; 192 core->i2c_adap.algo_data = &core->i2c_algo;
191 core->i2c_client.adapter = &core->i2c_adap; 193 core->i2c_client.adapter = &core->i2c_adap;
192 strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE); 194 strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 303d8d20fc91..890018c48cd8 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -25,7 +25,7 @@
25#include <linux/videodev2.h> 25#include <linux/videodev2.h>
26#include <linux/kdev_t.h> 26#include <linux/kdev_t.h>
27 27
28#include <media/v4l2-common.h> 28#include <media/v4l2-device.h>
29#include <media/tuner.h> 29#include <media/tuner.h>
30#include <media/tveeprom.h> 30#include <media/tveeprom.h>
31#include <media/videobuf-dma-sg.h> 31#include <media/videobuf-dma-sg.h>
@@ -327,6 +327,7 @@ struct cx88_core {
327 u32 i2c_state, i2c_rc; 327 u32 i2c_state, i2c_rc;
328 328
329 /* config info -- analog */ 329 /* config info -- analog */
330 struct v4l2_device v4l2_dev;
330 unsigned int boardnr; 331 unsigned int boardnr;
331 struct cx88_board board; 332 struct cx88_board board;
332 333
@@ -365,6 +366,11 @@ struct cx88_core {
365 int active_fe_id; 366 int active_fe_id;
366}; 367};
367 368
369static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
370{
371 return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
372}
373
368struct cx8800_dev; 374struct cx8800_dev;
369struct cx8802_dev; 375struct cx8802_dev;
370 376