Commit 9467fe12 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (11047): cx88: convert to v4l2_device.

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 74fc7bd9
...@@ -3138,7 +3138,15 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) ...@@ -3138,7 +3138,15 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr)
core->nr = nr; core->nr = nr;
sprintf(core->name, "cx88[%d]", core->nr); sprintf(core->name, "cx88[%d]", core->nr);
strcpy(core->v4l2_dev.name, core->name);
if (v4l2_device_register(NULL, &core->v4l2_dev)) {
kfree(core);
return NULL;
}
if (0 != cx88_get_resources(core, pci)) { if (0 != cx88_get_resources(core, pci)) {
v4l2_device_unregister(&core->v4l2_dev);
kfree(core); kfree(core);
return NULL; return NULL;
} }
......
...@@ -1011,7 +1011,8 @@ struct video_device *cx88_vdev_init(struct cx88_core *core, ...@@ -1011,7 +1011,8 @@ struct video_device *cx88_vdev_init(struct cx88_core *core,
return NULL; return NULL;
*vfd = *template; *vfd = *template;
vfd->minor = -1; vfd->minor = -1;
vfd->parent = &pci->dev; vfd->v4l2_dev = &core->v4l2_dev;
vfd->parent = &pci->dev;
vfd->release = video_device_release; vfd->release = video_device_release;
snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
core->name, type, core->board.name); core->name, type, core->board.name);
...@@ -1064,6 +1065,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci) ...@@ -1064,6 +1065,7 @@ void cx88_core_put(struct cx88_core *core, struct pci_dev *pci)
iounmap(core->lmmio); iounmap(core->lmmio);
cx88_devcount--; cx88_devcount--;
mutex_unlock(&devlist); mutex_unlock(&devlist);
v4l2_device_unregister(&core->v4l2_dev);
kfree(core); kfree(core);
} }
......
...@@ -99,7 +99,8 @@ static int cx8800_bit_getsda(void *data) ...@@ -99,7 +99,8 @@ static int cx8800_bit_getsda(void *data)
static int attach_inform(struct i2c_client *client) static int attach_inform(struct i2c_client *client)
{ {
struct cx88_core *core = i2c_get_adapdata(client->adapter); struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
struct cx88_core *core = to_core(v4l2_dev);
dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n", dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
client->driver->driver.name, client->addr, client->name); client->driver->driver.name, client->addr, client->name);
...@@ -108,7 +109,8 @@ static int attach_inform(struct i2c_client *client) ...@@ -108,7 +109,8 @@ static int attach_inform(struct i2c_client *client)
static int detach_inform(struct i2c_client *client) static int detach_inform(struct i2c_client *client)
{ {
struct cx88_core *core = i2c_get_adapdata(client->adapter); struct v4l2_device *v4l2_dev = i2c_get_adapdata(client->adapter);
struct cx88_core *core = to_core(v4l2_dev);
dprintk(1, "i2c detach [client=%s]\n", client->name); dprintk(1, "i2c detach [client=%s]\n", client->name);
return 0; return 0;
...@@ -186,7 +188,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) ...@@ -186,7 +188,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
core->i2c_adap.client_unregister = detach_inform; core->i2c_adap.client_unregister = detach_inform;
core->i2c_algo.udelay = i2c_udelay; core->i2c_algo.udelay = i2c_udelay;
core->i2c_algo.data = core; core->i2c_algo.data = core;
i2c_set_adapdata(&core->i2c_adap,core); i2c_set_adapdata(&core->i2c_adap, &core->v4l2_dev);
core->i2c_adap.algo_data = &core->i2c_algo; core->i2c_adap.algo_data = &core->i2c_algo;
core->i2c_client.adapter = &core->i2c_adap; core->i2c_client.adapter = &core->i2c_adap;
strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE); strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/videodev2.h> #include <linux/videodev2.h>
#include <linux/kdev_t.h> #include <linux/kdev_t.h>
#include <media/v4l2-common.h> #include <media/v4l2-device.h>
#include <media/tuner.h> #include <media/tuner.h>
#include <media/tveeprom.h> #include <media/tveeprom.h>
#include <media/videobuf-dma-sg.h> #include <media/videobuf-dma-sg.h>
...@@ -327,6 +327,7 @@ struct cx88_core { ...@@ -327,6 +327,7 @@ struct cx88_core {
u32 i2c_state, i2c_rc; u32 i2c_state, i2c_rc;
/* config info -- analog */ /* config info -- analog */
struct v4l2_device v4l2_dev;
unsigned int boardnr; unsigned int boardnr;
struct cx88_board board; struct cx88_board board;
...@@ -365,6 +366,11 @@ struct cx88_core { ...@@ -365,6 +366,11 @@ struct cx88_core {
int active_fe_id; int active_fe_id;
}; };
static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
{
return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
}
struct cx8800_dev; struct cx8800_dev;
struct cx8802_dev; struct cx8802_dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment