summaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-23 07:24:07 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-12 09:36:54 -0200
commit601e9444f249d219009ec05674268d90f6f1cdcb (patch)
tree42d58813872e340e03a40b74922ea89dfdcf0c55 /drivers/media/video
parente138c592b50370621653fd962b2bc3f4e25dfe78 (diff)
V4L/DVB (8786): v4l2: remove the priv field, use dev_get_drvdata instead
Remove the priv field and let video_get/set_drvdata use dev_get_drvdata and dev_set_drvdata instead. Convert all drivers that still used priv directly. 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/arv.c10
-rw-r--r--drivers/media/video/cpia.c12
-rw-r--r--drivers/media/video/pwc/pwc-if.c12
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c2
-rw-r--r--drivers/media/video/s2255drv.c2
-rw-r--r--drivers/media/video/saa5246a.c13
-rw-r--r--drivers/media/video/saa5249.c12
-rw-r--r--drivers/media/video/stk-webcam.c4
-rw-r--r--drivers/media/video/usbvideo/vicam.c9
-rw-r--r--drivers/media/video/w9966.c10
10 files changed, 43 insertions, 43 deletions
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 0d4f9b68345..218754b4906 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -270,7 +270,7 @@ static inline void wait_for_vertical_sync(int exp_line)
static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
struct video_device *v = video_devdata(file);
- struct ar_device *ar = v->priv;
+ struct ar_device *ar = video_get_drvdata(v);
long ret = ar->frame_bytes; /* return read bytes */
unsigned long arvcr1 = 0;
unsigned long flags;
@@ -400,7 +400,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
struct video_device *dev = video_devdata(file);
- struct ar_device *ar = dev->priv;
+ struct ar_device *ar = video_get_drvdata(dev);
DEBUG(1, "ar_ioctl()\n");
switch(cmd) {
@@ -626,7 +626,7 @@ static void ar_interrupt(int irq, void *dev)
*/
static int ar_initialize(struct video_device *dev)
{
- struct ar_device *ar = dev->priv;
+ struct ar_device *ar = video_get_drvdata(dev);
unsigned long cr = 0;
int i,found=0;
@@ -733,7 +733,7 @@ static int ar_initialize(struct video_device *dev)
void ar_release(struct video_device *vfd)
{
- struct ar_device *ar = vfd->priv;
+ struct ar_device *ar = video_get_drvdata(vfd);
mutex_lock(&ar->lock);
video_device_release(vfd);
}
@@ -815,7 +815,7 @@ static int __init ar_init(void)
return -ENOMEM;
}
memcpy(ar->vdev, &ar_template, sizeof(ar_template));
- ar->vdev->priv = ar;
+ video_set_drvdata(ar->vdev, ar);
if (vga) {
ar->width = AR_WIDTH_VGA;
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index c0600fdbfc6..b14c59c281e 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3155,7 +3155,7 @@ static void put_cam(struct cpia_camera_ops* ops)
static int cpia_open(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
- struct cam_data *cam = dev->priv;
+ struct cam_data *cam = video_get_drvdata(dev);
int err;
if (!cam) {
@@ -3232,7 +3232,7 @@ static int cpia_open(struct inode *inode, struct file *file)
static int cpia_close(struct inode *inode, struct file *file)
{
struct video_device *dev = file->private_data;
- struct cam_data *cam = dev->priv;
+ struct cam_data *cam = video_get_drvdata(dev);
if (cam->ops) {
/* Return ownership of /proc/cpia/videoX to root */
@@ -3284,7 +3284,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *dev = file->private_data;
- struct cam_data *cam = dev->priv;
+ struct cam_data *cam = video_get_drvdata(dev);
int err;
/* make this _really_ smp and multithread-safe */
@@ -3341,7 +3341,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
unsigned int ioctlnr, void *arg)
{
struct video_device *dev = file->private_data;
- struct cam_data *cam = dev->priv;
+ struct cam_data *cam = video_get_drvdata(dev);
int retval = 0;
if (!cam || !cam->ops)
@@ -3739,7 +3739,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end - vma->vm_start;
unsigned long page, pos;
- struct cam_data *cam = dev->priv;
+ struct cam_data *cam = video_get_drvdata(dev);
int retval;
if (!cam || !cam->ops)
@@ -3929,7 +3929,7 @@ static void init_camera_struct(struct cam_data *cam,
cam->proc_entry = NULL;
memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template));
- cam->vdev.priv = cam;
+ video_set_drvdata(&cam->vdev, cam);
cam->curframe = 0;
for (i = 0; i < FRAME_NUM; i++) {
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 9aee7cb6f79..ab28389b4cd 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1112,7 +1112,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev);
- pdev = (struct pwc_device *)vdev->priv;
+ pdev = video_get_drvdata(vdev);
BUG_ON(!pdev);
if (pdev->vopen) {
PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n");
@@ -1233,7 +1233,7 @@ static int pwc_video_close(struct inode *inode, struct file *file)
PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
lock_kernel();
- pdev = (struct pwc_device *)vdev->priv;
+ pdev = video_get_drvdata(vdev);
if (pdev->vopen == 0)
PWC_DEBUG_MODULE("video_close() called on closed device?\n");
@@ -1304,7 +1304,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
vdev, buf, count);
if (vdev == NULL)
return -EFAULT;
- pdev = vdev->priv;
+ pdev = video_get_drvdata(vdev);
if (pdev == NULL)
return -EFAULT;
@@ -1386,7 +1386,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
if (vdev == NULL)
return -EFAULT;
- pdev = vdev->priv;
+ pdev = video_get_drvdata(vdev);
if (pdev == NULL)
return -EFAULT;
@@ -1408,7 +1408,7 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file,
if (!vdev)
goto out;
- pdev = vdev->priv;
+ pdev = video_get_drvdata(vdev);
mutex_lock(&pdev->modlock);
if (!pdev->unplugged)
@@ -1428,7 +1428,7 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
int index;
PWC_DEBUG_MEMORY(">> %s\n", __func__);
- pdev = vdev->priv;
+ pdev = video_get_drvdata(vdev);
size = vma->vm_end - vma->vm_start;
start = vma->vm_start;
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index 1742889874d..76a1376c975 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -346,7 +346,7 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file,
if (vdev == NULL)
return -EFAULT;
- pdev = vdev->priv;
+ pdev = video_get_drvdata(vdev);
if (pdev == NULL)
return -EFAULT;
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index af19bb346ef..ea40f4c8b33 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1800,7 +1800,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
ret = video_register_device(dev->vdev[i],
VFL_TYPE_GRABBER,
cur_nr + i);
- dev->vdev[i]->priv = dev;
+ video_set_drvdata(dev->vdev[i], dev);
if (ret != 0) {
dev_err(&dev->udev->dev,
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index 5f5aa2063e0..0178b49da0c 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -117,7 +117,7 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
memset(t->pgbuf[pgbuf], ' ', sizeof(t->pgbuf[0]));
t->is_searching[pgbuf] = false;
}
- vd->priv=t;
+ video_set_drvdata(vd, t);
/*
@@ -151,7 +151,7 @@ static int saa5246a_detach(struct i2c_client *client)
struct video_device *vd = i2c_get_clientdata(client);
i2c_detach_client(client);
video_unregister_device(vd);
- kfree(vd->priv);
+ kfree(video_get_drvdata(vd));
kfree(client);
return 0;
}
@@ -582,7 +582,8 @@ static int do_saa5246a_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
struct video_device *vd = video_devdata(file);
- struct saa5246a_device *t=vd->priv;
+ struct saa5246a_device *t = video_get_drvdata(vd);
+
switch(cmd)
{
case VTXIOCGETINFO:
@@ -723,7 +724,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct video_device *vd = video_devdata(file);
- struct saa5246a_device *t = vd->priv;
+ struct saa5246a_device *t = video_get_drvdata(vd);
int err;
cmd = vtx_fix_command(cmd);
@@ -736,7 +737,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
static int saa5246a_open(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5246a_device *t = vd->priv;
+ struct saa5246a_device *t = video_get_drvdata(vd);
if (t->client == NULL)
return -ENODEV;
@@ -779,7 +780,7 @@ static int saa5246a_open(struct inode *inode, struct file *file)
static int saa5246a_release(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5246a_device *t = vd->priv;
+ struct saa5246a_device *t = video_get_drvdata(vd);
/* Stop all acquisition circuits. */
i2c_senddata(t, SAA5246A_REGISTER_R1,
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 225117c789c..c784715a0b0 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -186,7 +186,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
t->vdau[pgbuf].stopped = true;
t->is_searching[pgbuf] = false;
}
- vd->priv=t;
+ video_set_drvdata(vd, t);
/*
@@ -221,7 +221,7 @@ static int saa5249_detach(struct i2c_client *client)
struct video_device *vd = i2c_get_clientdata(client);
i2c_detach_client(client);
video_unregister_device(vd);
- kfree(vd->priv);
+ kfree(video_get_drvdata(vd));
kfree(vd);
kfree(client);
return 0;
@@ -320,7 +320,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
{
static int virtual_mode = false;
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t=vd->priv;
+ struct saa5249_device *t = video_get_drvdata(vd);
switch(cmd)
{
@@ -619,7 +619,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t=vd->priv;
+ struct saa5249_device *t = video_get_drvdata(vd);
int err;
cmd = vtx_fix_command(cmd);
@@ -632,7 +632,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
static int saa5249_open(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t = vd->priv;
+ struct saa5249_device *t = video_get_drvdata(vd);
int pgbuf;
if (t->client == NULL)
@@ -670,7 +670,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
static int saa5249_release(struct inode *inode, struct file *file)
{
struct video_device *vd = video_devdata(file);
- struct saa5249_device *t = vd->priv;
+ struct saa5249_device *t = video_get_drvdata(vd);
i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */
i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 6b1ef5dc562..8dda5680094 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -72,7 +72,7 @@ static void stk_camera_cleanup(struct kref *kref)
STK_INFO("Syntek USB2.0 Camera release resources"
" video device /dev/video%d\n", dev->vdev.minor);
video_unregister_device(&dev->vdev);
- dev->vdev.priv = NULL;
+ video_set_drvdata(&dev->vdev, NULL);
if (dev->sio_bufs != NULL || dev->isobufs != NULL)
STK_ERROR("We are leaking memory\n");
@@ -1379,7 +1379,7 @@ static int stk_register_video_device(struct stk_camera *dev)
dev->vdev = stk_v4l_data;
dev->vdev.debug = debug;
dev->vdev.parent = &dev->interface->dev;
- dev->vdev.priv = dev;
+ video_set_drvdata(&dev->vdev, dev);
err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
if (err)
STK_ERROR("v4l registration failed\n");
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index d7728256f29..1ffcc393fcb 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -473,8 +473,8 @@ static int
vicam_open(struct inode *inode, struct file *file)
{
struct video_device *dev = video_devdata(file);
- struct vicam_camera *cam =
- (struct vicam_camera *) dev->priv;
+ struct vicam_camera *cam = video_get_drvdata(dev);
+
DBG("open\n");
if (!cam) {
@@ -866,9 +866,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
mutex_init(&cam->cam_lock);
- memcpy(&cam->vdev, &vicam_template,
- sizeof (vicam_template));
- cam->vdev.priv = cam; // sort of a reverse mapping for those functions that get vdev only
+ memcpy(&cam->vdev, &vicam_template, sizeof(vicam_template));
+ video_set_drvdata(&cam->vdev, cam);
cam->udev = dev;
cam->bulkEndpoint = bulkEndpoint;
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index e3580119640..14ebb15837f 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -188,7 +188,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
static int w9966_exclusive_open(struct inode *inode, struct file *file)
{
struct video_device *vdev = video_devdata(file);
- struct w9966_dev *cam = vdev->priv;
+ struct w9966_dev *cam = video_get_drvdata(vdev);
return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0;
}
@@ -196,7 +196,7 @@ static int w9966_exclusive_open(struct inode *inode, struct file *file)
static int w9966_exclusive_release(struct inode *inode, struct file *file)
{
struct video_device *vdev = video_devdata(file);
- struct w9966_dev *cam = vdev->priv;
+ struct w9966_dev *cam = video_get_drvdata(vdev);
clear_bit(0, &cam->in_use);
return 0;
@@ -351,7 +351,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
// Fill in the video_device struct and register us to v4l
memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
- cam->vdev.priv = cam;
+ video_set_drvdata(&cam->vdev, cam);
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
return -1;
@@ -733,7 +733,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg)
{
struct video_device *vdev = video_devdata(file);
- struct w9966_dev *cam = vdev->priv;
+ struct w9966_dev *cam = video_get_drvdata(vdev);
switch(cmd)
{
@@ -892,7 +892,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct video_device *vdev = video_devdata(file);
- struct w9966_dev *cam = vdev->priv;
+ struct w9966_dev *cam = video_get_drvdata(vdev);
unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000
unsigned char __user *dest = (unsigned char __user *)buf;
unsigned long dleft = count;