Commit 601e9444 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e138c592
...@@ -533,7 +533,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, ...@@ -533,7 +533,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
memcpy(vfd, &device_template, sizeof(struct video_device)); memcpy(vfd, &device_template, sizeof(struct video_device));
strlcpy(vfd->name, name, sizeof(vfd->name)); strlcpy(vfd->name, name, sizeof(vfd->name));
vfd->release = video_device_release; vfd->release = video_device_release;
vfd->priv = dev; video_set_drvdata(vfd, dev);
// fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr");
if (video_register_device(vfd, type, -1) < 0) { if (video_register_device(vfd, type, -1) < 0) {
......
...@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -275,7 +275,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -275,7 +275,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
rt->curfreq = f->frequency; rt->curfreq = f->frequency;
rt_setfreq(rt, rt->curfreq); rt_setfreq(rt, rt->curfreq);
...@@ -286,7 +286,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -286,7 +286,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = rt->curfreq; f->frequency = rt->curfreq;
...@@ -312,7 +312,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -312,7 +312,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -329,7 +329,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -329,7 +329,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -437,7 +437,7 @@ static int __init rtrack_init(void) ...@@ -437,7 +437,7 @@ static int __init rtrack_init(void)
return -EBUSY; return -EBUSY;
} }
rtrack_radio.priv=&rtrack_unit; video_set_drvdata(&rtrack_radio, &rtrack_unit);
if (video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
release_region(io, 2); release_region(io, 2);
......
...@@ -197,7 +197,7 @@ static int vidioc_g_tuner (struct file *file, void *priv, ...@@ -197,7 +197,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct az_device *az = dev->priv; struct az_device *az = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -266,7 +266,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, ...@@ -266,7 +266,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct az_device *az = dev->priv; struct az_device *az = video_get_drvdata(dev);
az->curfreq = f->frequency; az->curfreq = f->frequency;
az_setfreq(az, az->curfreq); az_setfreq(az, az->curfreq);
...@@ -277,7 +277,7 @@ static int vidioc_g_frequency (struct file *file, void *priv, ...@@ -277,7 +277,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct az_device *az = dev->priv; struct az_device *az = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = az->curfreq; f->frequency = az->curfreq;
...@@ -304,7 +304,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv, ...@@ -304,7 +304,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct az_device *az = dev->priv; struct az_device *az = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -324,7 +324,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, ...@@ -324,7 +324,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct az_device *az = dev->priv; struct az_device *az = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -405,7 +405,7 @@ static int __init aztech_init(void) ...@@ -405,7 +405,7 @@ static int __init aztech_init(void)
} }
mutex_init(&lock); mutex_init(&lock);
aztech_radio.priv=&aztech_unit; video_set_drvdata(&aztech_radio, &aztech_unit);
if (video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
release_region(io,2); release_region(io,2);
......
...@@ -205,7 +205,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -205,7 +205,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_pci_card *card = dev->priv; struct gemtek_pci_card *card = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -233,7 +233,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -233,7 +233,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_pci_card *card = dev->priv; struct gemtek_pci_card *card = video_get_drvdata(dev);
if ( (f->frequency < GEMTEK_PCI_RANGE_LOW) || if ( (f->frequency < GEMTEK_PCI_RANGE_LOW) ||
(f->frequency > GEMTEK_PCI_RANGE_HIGH) ) (f->frequency > GEMTEK_PCI_RANGE_HIGH) )
...@@ -248,7 +248,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -248,7 +248,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_pci_card *card = dev->priv; struct gemtek_pci_card *card = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = card->current_frequency; f->frequency = card->current_frequency;
...@@ -273,7 +273,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -273,7 +273,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_pci_card *card = dev->priv; struct gemtek_pci_card *card = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -293,7 +293,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -293,7 +293,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_pci_card *card = dev->priv; struct gemtek_pci_card *card = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -442,7 +442,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci ...@@ -442,7 +442,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
} }
card->videodev = devradio; card->videodev = devradio;
devradio->priv = card; video_set_drvdata(devradio, card);
gemtek_pci_mute( card ); gemtek_pci_mute( card );
printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
......
...@@ -460,7 +460,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -460,7 +460,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_device *rt = dev->priv; struct gemtek_device *rt = video_get_drvdata(dev);
gemtek_setfreq(rt, f->frequency); gemtek_setfreq(rt, f->frequency);
...@@ -471,7 +471,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -471,7 +471,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_device *rt = dev->priv; struct gemtek_device *rt = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = rt->lastfreq; f->frequency = rt->lastfreq;
...@@ -496,7 +496,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -496,7 +496,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_device *rt = dev->priv; struct gemtek_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -516,7 +516,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -516,7 +516,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct gemtek_device *rt = dev->priv; struct gemtek_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -623,7 +623,7 @@ static int __init gemtek_init(void) ...@@ -623,7 +623,7 @@ static int __init gemtek_init(void)
return -EINVAL; return -EINVAL;
} }
gemtek_radio.priv = &gemtek_unit; video_set_drvdata(&gemtek_radio, &gemtek_unit);
if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
release_region(io, 1); release_region(io, 1);
......
...@@ -232,7 +232,7 @@ static int vidioc_g_tuner (struct file *file, void *priv, ...@@ -232,7 +232,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct radio_device *card=dev->priv; struct radio_device *card = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -303,7 +303,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, ...@@ -303,7 +303,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct radio_device *card=dev->priv; struct radio_device *card = video_get_drvdata(dev);
if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) { if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) {
dprintk(1, "radio freq (%d.%02d MHz) out of range (%d-%d)\n", dprintk(1, "radio freq (%d.%02d MHz) out of range (%d-%d)\n",
...@@ -325,7 +325,7 @@ static int vidioc_g_frequency (struct file *file, void *priv, ...@@ -325,7 +325,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct radio_device *card=dev->priv; struct radio_device *card = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = card->freq; f->frequency = card->freq;
...@@ -356,7 +356,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv, ...@@ -356,7 +356,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct radio_device *card=dev->priv; struct radio_device *card = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -371,7 +371,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, ...@@ -371,7 +371,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct radio_device *card=dev->priv; struct radio_device *card = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -421,7 +421,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d ...@@ -421,7 +421,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d
radio_unit.io = pci_resource_start(pdev, 0); radio_unit.io = pci_resource_start(pdev, 0);
mutex_init(&radio_unit.lock); mutex_init(&radio_unit.lock);
maxiradio_radio.priv = &radio_unit; video_set_drvdata(&maxiradio_radio, &radio_unit);
if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
printk("radio-maxiradio: can't register device!"); printk("radio-maxiradio: can't register device!");
......
...@@ -155,7 +155,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -155,7 +155,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -175,7 +175,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -175,7 +175,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
rt->curfreq = f->frequency; rt->curfreq = f->frequency;
rt_setfreq(rt, rt->curfreq); rt_setfreq(rt, rt->curfreq);
...@@ -186,7 +186,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -186,7 +186,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = rt->curfreq; f->frequency = rt->curfreq;
...@@ -212,7 +212,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -212,7 +212,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -232,7 +232,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -232,7 +232,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct rt_device *rt = dev->priv; struct rt_device *rt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -342,7 +342,7 @@ static int __init rtrack2_init(void) ...@@ -342,7 +342,7 @@ static int __init rtrack2_init(void)
return -EBUSY; return -EBUSY;
} }
rtrack2_radio.priv=&rtrack2_unit; video_set_drvdata(&rtrack2_radio, &rtrack2_unit);
spin_lock_init(&lock); spin_lock_init(&lock);
if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
......
...@@ -148,7 +148,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -148,7 +148,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
{ {
int mult; int mult;
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmi_device *fmi = dev->priv; struct fmi_device *fmi = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -177,7 +177,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -177,7 +177,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmi_device *fmi = dev->priv; struct fmi_device *fmi = video_get_drvdata(dev);
if (!(fmi->flags & V4L2_TUNER_CAP_LOW)) if (!(fmi->flags & V4L2_TUNER_CAP_LOW))
f->frequency *= 1000; f->frequency *= 1000;
...@@ -195,7 +195,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -195,7 +195,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmi_device *fmi = dev->priv; struct fmi_device *fmi = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = fmi->curfreq; f->frequency = fmi->curfreq;
...@@ -223,7 +223,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -223,7 +223,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmi_device *fmi = dev->priv; struct fmi_device *fmi = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -237,7 +237,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -237,7 +237,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmi_device *fmi = dev->priv; struct fmi_device *fmi = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -386,7 +386,7 @@ static int __init fmi_init(void) ...@@ -386,7 +386,7 @@ static int __init fmi_init(void)
fmi_unit.curvol = 0; fmi_unit.curvol = 0;
fmi_unit.curfreq = 0; fmi_unit.curfreq = 0;
fmi_unit.flags = V4L2_TUNER_CAP_LOW; fmi_unit.flags = V4L2_TUNER_CAP_LOW;
fmi_radio.priv = &fmi_unit; video_set_drvdata(&fmi_radio, &fmi_unit);
mutex_init(&lock); mutex_init(&lock);
......
...@@ -231,7 +231,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -231,7 +231,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
{ {
int mult; int mult;
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmr2_device *fmr2 = dev->priv; struct fmr2_device *fmr2 = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -264,7 +264,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -264,7 +264,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmr2_device *fmr2 = dev->priv; struct fmr2_device *fmr2 = video_get_drvdata(dev);
if (!(fmr2->flags & V4L2_TUNER_CAP_LOW)) if (!(fmr2->flags & V4L2_TUNER_CAP_LOW))
f->frequency *= 1000; f->frequency *= 1000;
...@@ -288,7 +288,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -288,7 +288,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmr2_device *fmr2 = dev->priv; struct fmr2_device *fmr2 = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = fmr2->curfreq; f->frequency = fmr2->curfreq;
...@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmr2_device *fmr2 = dev->priv; struct fmr2_device *fmr2 = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct fmr2_device *fmr2 = dev->priv; struct fmr2_device *fmr2 = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -454,7 +454,7 @@ static int __init fmr2_init(void) ...@@ -454,7 +454,7 @@ static int __init fmr2_init(void)
fmr2_unit.stereo = 1; fmr2_unit.stereo = 1;
fmr2_unit.flags = V4L2_TUNER_CAP_LOW; fmr2_unit.flags = V4L2_TUNER_CAP_LOW;
fmr2_unit.card_type = 0; fmr2_unit.card_type = 0;
fmr2_radio.priv = &fmr2_unit; video_set_drvdata(&fmr2_radio, &fmr2_unit);
mutex_init(&lock); mutex_init(&lock);
......
...@@ -222,7 +222,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -222,7 +222,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct tt_device *tt = dev->priv; struct tt_device *tt = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -250,7 +250,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -250,7 +250,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct tt_device *tt = dev->priv; struct tt_device *tt = video_get_drvdata(dev);
tt->curfreq = f->frequency; tt->curfreq = f->frequency;
tt_setfreq(tt, tt->curfreq); tt_setfreq(tt, tt->curfreq);
...@@ -261,7 +261,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -261,7 +261,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct tt_device *tt = dev->priv; struct tt_device *tt = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = tt->curfreq; f->frequency = tt->curfreq;
...@@ -287,7 +287,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -287,7 +287,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct tt_device *tt = dev->priv; struct tt_device *tt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -307,7 +307,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -307,7 +307,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct tt_device *tt = dev->priv; struct tt_device *tt = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -414,7 +414,7 @@ static int __init terratec_init(void) ...@@ -414,7 +414,7 @@ static int __init terratec_init(void)
return -EBUSY; return -EBUSY;
} }
terratec_radio.priv=&terratec_unit; video_set_drvdata(&terratec_radio, &terratec_unit);
spin_lock_init(&lock); spin_lock_init(&lock);
......
...@@ -224,7 +224,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -224,7 +224,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct typhoon_device *typhoon = dev->priv; struct typhoon_device *typhoon = video_get_drvdata(dev);
typhoon->curfreq = f->frequency; typhoon->curfreq = f->frequency;
typhoon_setfreq(typhoon, typhoon->curfreq); typhoon_setfreq(typhoon, typhoon->curfreq);
...@@ -235,7 +235,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -235,7 +235,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct typhoon_device *typhoon = dev->priv; struct typhoon_device *typhoon = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = typhoon->curfreq; f->frequency = typhoon->curfreq;
...@@ -262,7 +262,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -262,7 +262,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct typhoon_device *typhoon = dev->priv; struct typhoon_device *typhoon = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -279,7 +279,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, ...@@ -279,7 +279,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct typhoon_device *typhoon = dev->priv; struct typhoon_device *typhoon = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -458,7 +458,7 @@ static int __init typhoon_init(void) ...@@ -458,7 +458,7 @@ static int __init typhoon_init(void)
return -EBUSY; return -EBUSY;
} }
typhoon_radio.priv = &typhoon_unit; video_set_drvdata(&typhoon_radio, &typhoon_unit);
if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) { if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
release_region(io, 8); release_region(io, 8);
return -EINVAL; return -EINVAL;
......
...@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, ...@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v) struct v4l2_tuner *v)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct zol_device *zol = dev->priv; struct zol_device *zol = video_get_drvdata(dev);
if (v->index > 0) if (v->index > 0)
return -EINVAL; return -EINVAL;
...@@ -278,7 +278,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -278,7 +278,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct zol_device *zol = dev->priv; struct zol_device *zol = video_get_drvdata(dev);
zol->curfreq = f->frequency; zol->curfreq = f->frequency;
zol_setfreq(zol, zol->curfreq); zol_setfreq(zol, zol->curfreq);
...@@ -289,7 +289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, ...@@ -289,7 +289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f) struct v4l2_frequency *f)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct zol_device *zol = dev->priv; struct zol_device *zol = video_get_drvdata(dev);
f->type = V4L2_TUNER_RADIO; f->type = V4L2_TUNER_RADIO;
f->frequency = zol->curfreq; f->frequency = zol->curfreq;
...@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, ...@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct zol_device *zol = dev->priv; struct zol_device *zol = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, ...@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl) struct v4l2_control *ctrl)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct zol_device *zol = dev->priv; struct zol_device *zol = video_get_drvdata(dev);
switch (ctrl->id) { switch (ctrl->id) {
case V4L2_CID_AUDIO_MUTE: case V4L2_CID_AUDIO_MUTE:
...@@ -453,7 +453,7 @@ static int __init zoltrix_init(void) ...@@ -453,7 +453,7 @@ static int __init zoltrix_init(void)
return -ENXIO; return -ENXIO;
} }
zoltrix_radio.priv = &zoltrix_unit; video_set_drvdata(&zoltrix_radio, &zoltrix_unit);
if (!request_region(io, 2, "zoltrix")) { if (!request_region(io, 2, "zoltrix")) {
printk(KERN_ERR "zoltrix: port 0x%x already in use\n", io); printk(KERN_ERR "zoltrix: port 0x%x already in use\n", io);
return -EBUSY; return -EBUSY;
......
...@@ -270,7 +270,7 @@ static inline void wait_for_vertical_sync(int exp_line) ...@@ -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) static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{ {
struct video_device *v = video_devdata(file); 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 */ long ret = ar->frame_bytes; /* return read bytes */
unsigned long arvcr1 = 0; unsigned long arvcr1 = 0;
unsigned long flags; unsigned long flags;
...@@ -400,7 +400,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file, ...@@ -400,7 +400,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
struct video_device *dev = video_devdata(file); 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"); DEBUG(1, "ar_ioctl()\n");
switch(cmd) { switch(cmd) {
...@@ -626,7 +626,7 @@ static void ar_interrupt(int irq, void *dev) ...@@ -626,7 +626,7 @@ static void ar_interrupt(int irq, void *dev)
*/ */
static int ar_initialize(struct video_device *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; unsigned long cr = 0;
int i,found=0; int i,found=0;
...@@ -733,7 +733,7 @@ static int ar_initialize(struct video_device *dev) ...@@ -733,7 +733,7 @@ static int ar_initialize(struct video_device *dev)
void ar_release(struct video_device *vfd) 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); mutex_lock(&ar->lock);
video_device_release(vfd); video_device_release(vfd);
} }
...@@ -815,7 +815,7 @@ static int __init ar_init(void) ...@@ -815,7 +815,7 @@ static int __init ar_init(void)
return -ENOMEM; return -ENOMEM;
} }
memcpy(ar->vdev, &ar_template, sizeof(ar_template)); memcpy(ar->vdev, &ar_template, sizeof(ar_template));
ar->vdev->priv = ar; video_set_drvdata(ar->vdev, ar);
if (vga) { if (vga) {
ar->width = AR_WIDTH_VGA; ar->width = AR_WIDTH_VGA;
......
...@@ -3155,7 +3155,7 @@ static void put_cam(struct cpia_camera_ops* ops) ...@@ -3155,7 +3155,7 @@ static void put_cam(struct cpia_camera_ops* ops)
static int cpia_open(struct inode *inode, struct file *file) static int cpia_open(struct inode *inode, struct file *file)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct cam_data *cam = dev->priv; struct cam_data *cam = video_get_drvdata(dev);
int err; int err;
if (!cam) { if (!cam) {
...@@ -3232,7 +3232,7 @@ static int cpia_open(struct inode *inode, struct file *file) ...@@ -3232,7 +3232,7 @@ static int cpia_open(struct inode *inode, struct file *file)
static int cpia_close(struct inode *inode, struct file *file) static int cpia_close(struct inode *inode, struct file *file)
{ {
struct video_device *dev = file->private_data; struct video_device *dev = file->private_data;
struct cam_data *cam = dev->priv; struct cam_data *cam = video_get_drvdata(dev);
if (cam->ops) { if (cam->ops) {
/* Return ownership of /proc/cpia/videoX to root */ /* Return ownership of /proc/cpia/videoX to root */
...@@ -3284,7 +3284,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf, ...@@ -3284,7 +3284,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct video_device *dev = file->private_data; struct video_device *dev = file->private_data;
struct cam_data *cam = dev->priv; struct cam_data *cam = video_get_drvdata(dev);
int err; int err;
/* make this _really_ smp and multithread-safe */ /* make this _really_ smp and multithread-safe */
...@@ -3341,7 +3341,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, ...@@ -3341,7 +3341,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
unsigned int ioctlnr, void *arg) unsigned int ioctlnr, void *arg)
{ {
struct video_device *dev = file->private_data; struct video_device *dev = file->private_data;
struct cam_data *cam = dev->priv; struct cam_data *cam = video_get_drvdata(dev);
int retval = 0; int retval = 0;
if (!cam || !cam->ops) if (!cam || !cam->ops)
...@@ -3739,7 +3739,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -3739,7 +3739,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
unsigned long start = vma->vm_start; unsigned long start = vma->vm_start;
unsigned long size = vma->vm_end - vma->vm_start; unsigned long size = vma->vm_end - vma->vm_start;
unsigned long page, pos; unsigned long page, pos;
struct cam_data *cam = dev->priv; struct cam_data *cam = video_get_drvdata(dev);
int retval; int retval;
if (!cam || !cam->ops) if (!cam || !cam->ops)
...@@ -3929,7 +3929,7 @@ static void init_camera_struct(struct cam_data *cam, ...@@ -3929,7 +3929,7 @@ static void init_camera_struct(struct cam_data *cam,
cam->proc_entry = NULL; cam->proc_entry = NULL;
memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template));
cam->vdev.priv = cam; video_set_drvdata(&cam->vdev, cam);
cam->curframe = 0; cam->curframe = 0;
for (i = 0; i < FRAME_NUM; i++) { for (i = 0; i < FRAME_NUM; i++) {
......
...@@ -1112,7 +1112,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) ...@@ -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); 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); BUG_ON(!pdev);
if (pdev->vopen) { if (pdev->vopen) {
PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); 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) ...@@ -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); PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
lock_kernel(); lock_kernel();
pdev = (struct pwc_device *)vdev->priv; pdev = video_get_drvdata(vdev);
if (pdev->vopen == 0) if (pdev->vopen == 0)
PWC_DEBUG_MODULE("video_close() called on closed device?\n"); 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, ...@@ -1304,7 +1304,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
vdev, buf, count); vdev, buf, count);
if (vdev == NULL) if (vdev == NULL)
return -EFAULT; return -EFAULT;
pdev = vdev->priv; pdev = video_get_drvdata(vdev);
if (pdev == NULL) if (pdev == NULL)
return -EFAULT; return -EFAULT;
...@@ -1386,7 +1386,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait) ...@@ -1386,7 +1386,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
if (vdev == NULL) if (vdev == NULL)
return -EFAULT; return -EFAULT;
pdev = vdev->priv; pdev = video_get_drvdata(vdev);
if (pdev == NULL) if (pdev == NULL)
return -EFAULT; return -EFAULT;
...@@ -1408,7 +1408,7 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file, ...@@ -1408,7 +1408,7 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file,
if (!vdev) if (!vdev)
goto out; goto out;
pdev = vdev->priv; pdev = video_get_drvdata(vdev);
mutex_lock(&pdev->modlock); mutex_lock(&pdev->modlock);
if (!pdev->unplugged) if (!pdev->unplugged)
...@@ -1428,7 +1428,7 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1428,7 +1428,7 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
int index; int index;
PWC_DEBUG_MEMORY(">> %s\n", __func__); PWC_DEBUG_MEMORY(">> %s\n", __func__);
pdev = vdev->priv; pdev = video_get_drvdata(vdev);
size = vma->vm_end - vma->vm_start; size = vma->vm_end - vma->vm_start;
start = vma->vm_start; start = vma->vm_start;
......
...@@ -346,7 +346,7 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file, ...@@ -346,7 +346,7 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file,
if (vdev == NULL) if (vdev == NULL)
return -EFAULT; return -EFAULT;
pdev = vdev->priv; pdev = video_get_drvdata(vdev);
if (pdev == NULL) if (pdev == NULL)
return -EFAULT; return -EFAULT;
......
...@@ -1800,7 +1800,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev) ...@@ -1800,7 +1800,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
ret = video_register_device(dev->vdev[i], ret = video_register_device(dev->vdev[i],
VFL_TYPE_GRABBER, VFL_TYPE_GRABBER,
cur_nr + i); cur_nr + i);
dev->vdev[i]->priv = dev; video_set_drvdata(dev->vdev[i], dev);
if (ret != 0) { if (ret != 0) {
dev_err(&dev->udev->dev, dev_err(&dev->udev->dev,
......
...@@ -117,7 +117,7 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -117,7 +117,7 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
memset(t->pgbuf[pgbuf], ' ', sizeof(t->pgbuf[0])); memset(t->pgbuf[pgbuf], ' ', sizeof(t->pgbuf[0]));
t->is_searching[pgbuf] = false; 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) ...@@ -151,7 +151,7 @@ static int saa5246a_detach(struct i2c_client *client)
struct video_device *vd = i2c_get_clientdata(client); struct video_device *vd = i2c_get_clientdata(client);
i2c_detach_client(client); i2c_detach_client(client);
video_unregister_device(vd); video_unregister_device(vd);
kfree(vd->priv); kfree(video_get_drvdata(vd));
kfree(client); kfree(client);
return 0; return 0;
} }
...@@ -582,7 +582,8 @@ static int do_saa5246a_ioctl(struct inode *inode, struct file *file, ...@@ -582,7 +582,8 @@ static int do_saa5246a_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
struct video_device *vd = video_devdata(file); struct video_device *vd = video_devdata(file);
struct saa5246a_device *t=vd->priv; struct saa5246a_device *t = video_get_drvdata(vd);
switch(cmd) switch(cmd)
{ {
case VTXIOCGETINFO: case VTXIOCGETINFO:
...@@ -723,7 +724,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file, ...@@ -723,7 +724,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct video_device *vd = video_devdata(file); struct video_device *vd = video_devdata(file);
struct saa5246a_device *t = vd->priv; struct saa5246a_device *t = video_get_drvdata(vd);
int err; int err;
cmd = vtx_fix_command(cmd); cmd = vtx_fix_command(cmd);
...@@ -736,7 +737,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file, ...@@ -736,7 +737,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
static int saa5246a_open(struct inode *inode, struct file *file) static int saa5246a_open(struct inode *inode, struct file *file)
{ {
struct video_device *vd = video_devdata(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) if (t->client == NULL)
return -ENODEV; return -ENODEV;
...@@ -779,7 +780,7 @@ static int saa5246a_open(struct inode *inode, struct file *file) ...@@ -779,7 +780,7 @@ static int saa5246a_open(struct inode *inode, struct file *file)
static int saa5246a_release(struct inode *inode, struct file *file) static int saa5246a_release(struct inode *inode, struct file *file)
{ {
struct video_device *vd = video_devdata(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. */ /* Stop all acquisition circuits. */
i2c_senddata(t, SAA5246A_REGISTER_R1, i2c_senddata(t, SAA5246A_REGISTER_R1,
......
...@@ -186,7 +186,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) ...@@ -186,7 +186,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
t->vdau[pgbuf].stopped = true; t->vdau[pgbuf].stopped = true;
t->is_searching[pgbuf] = false; 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) ...@@ -221,7 +221,7 @@ static int saa5249_detach(struct i2c_client *client)
struct video_device *vd = i2c_get_clientdata(client); struct video_device *vd = i2c_get_clientdata(client);
i2c_detach_client(client); i2c_detach_client(client);
video_unregister_device(vd); video_unregister_device(vd);
kfree(vd->priv); kfree(video_get_drvdata(vd));
kfree(vd); kfree(vd);
kfree(client); kfree(client);
return 0; return 0;
...@@ -320,7 +320,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, ...@@ -320,7 +320,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
{ {
static int virtual_mode = false; static int virtual_mode = false;
struct video_device *vd = video_devdata(file); struct video_device *vd = video_devdata(file);
struct saa5249_device *t=vd->priv; struct saa5249_device *t = video_get_drvdata(vd);
switch(cmd) switch(cmd)
{ {
...@@ -619,7 +619,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, ...@@ -619,7 +619,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct video_device *vd = video_devdata(file); struct video_device *vd = video_devdata(file);
struct saa5249_device *t=vd->priv; struct saa5249_device *t = video_get_drvdata(vd);
int err; int err;
cmd = vtx_fix_command(cmd); cmd = vtx_fix_command(cmd);
...@@ -632,7 +632,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, ...@@ -632,7 +632,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
static int saa5249_open(struct inode *inode, struct file *file) static int saa5249_open(struct inode *inode, struct file *file)
{ {
struct video_device *vd = video_devdata(file); struct video_device *vd = video_devdata(file);
struct saa5249_device *t = vd->priv; struct saa5249_device *t = video_get_drvdata(vd);
int pgbuf; int pgbuf;
if (t->client == NULL) if (t->client == NULL)
...@@ -670,7 +670,7 @@ static int saa5249_open(struct inode *inode, struct file *file) ...@@ -670,7 +670,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
static int saa5249_release(struct inode *inode, struct file *file) static int saa5249_release(struct inode *inode, struct file *file)
{ {
struct video_device *vd = video_devdata(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, 1, 0x20, -1); /* Turn off CCT */
i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */ i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */
......
...@@ -72,7 +72,7 @@ static void stk_camera_cleanup(struct kref *kref) ...@@ -72,7 +72,7 @@ static void stk_camera_cleanup(struct kref *kref)
STK_INFO("Syntek USB2.0 Camera release resources" STK_INFO("Syntek USB2.0 Camera release resources"
" video device /dev/video%d\n", dev->vdev.minor); " video device /dev/video%d\n", dev->vdev.minor);
video_unregister_device(&dev->vdev); video_unregister_device(&dev->vdev);
dev->vdev.priv = NULL; video_set_drvdata(&dev->vdev, NULL);
if (dev->sio_bufs != NULL || dev->isobufs != NULL) if (dev->sio_bufs != NULL || dev->isobufs != NULL)
STK_ERROR("We are leaking memory\n"); STK_ERROR("We are leaking memory\n");
...@@ -1379,7 +1379,7 @@ static int stk_register_video_device(struct stk_camera *dev) ...@@ -1379,7 +1379,7 @@ static int stk_register_video_device(struct stk_camera *dev)
dev->vdev = stk_v4l_data; dev->vdev = stk_v4l_data;
dev->vdev.debug = debug; dev->vdev.debug = debug;
dev->vdev.parent = &dev->interface->dev; 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); err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
if (err) if (err)
STK_ERROR("v4l registration failed\n"); STK_ERROR("v4l registration failed\n");
......
...@@ -473,8 +473,8 @@ static int ...@@ -473,8 +473,8 @@ static int
vicam_open(struct inode *inode, struct file *file) vicam_open(struct inode *inode, struct file *file)
{ {
struct video_device *dev = video_devdata(file); struct video_device *dev = video_devdata(file);
struct vicam_camera *cam = struct vicam_camera *cam = video_get_drvdata(dev);
(struct vicam_camera *) dev->priv;
DBG("open\n"); DBG("open\n");
if (!cam) { if (!cam) {
...@@ -866,9 +866,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) ...@@ -866,9 +866,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
mutex_init(&cam->cam_lock); mutex_init(&cam->cam_lock);
memcpy(&cam->vdev, &vicam_template, memcpy(&cam->vdev, &vicam_template, sizeof(vicam_template));
sizeof (vicam_template)); video_set_drvdata(&cam->vdev, cam);
cam->vdev.priv = cam; // sort of a reverse mapping for those functions that get vdev only
cam->udev = dev; cam->udev = dev;
cam->bulkEndpoint = bulkEndpoint; cam->bulkEndpoint = bulkEndpoint;
......
...@@ -188,7 +188,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, ...@@ -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) static int w9966_exclusive_open(struct inode *inode, struct file *file)
{ {
struct video_device *vdev = video_devdata(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; 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) ...@@ -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) static int w9966_exclusive_release(struct inode *inode, struct file *file)
{ {
struct video_device *vdev = video_devdata(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); clear_bit(0, &cam->in_use);
return 0; return 0;
...@@ -351,7 +351,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) ...@@ -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 // Fill in the video_device struct and register us to v4l
memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); 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) if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
return -1; return -1;
...@@ -733,7 +733,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, ...@@ -733,7 +733,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, void *arg) unsigned int cmd, void *arg)
{ {
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct w9966_dev *cam = vdev->priv; struct w9966_dev *cam = video_get_drvdata(vdev);
switch(cmd) switch(cmd)
{ {
...@@ -892,7 +892,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, ...@@ -892,7 +892,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct video_device *vdev = video_devdata(file); 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 addr = 0xa0; // ECP, read, CCD-transfer, 00000
unsigned char __user *dest = (unsigned char __user *)buf; unsigned char __user *dest = (unsigned char __user *)buf;
unsigned long dleft = count; unsigned long dleft = count;
......
...@@ -69,14 +69,6 @@ struct video_device ...@@ -69,14 +69,6 @@ struct video_device
/* ioctl callbacks */ /* ioctl callbacks */
const struct v4l2_ioctl_ops *ioctl_ops; const struct v4l2_ioctl_ops *ioctl_ops;
#ifdef OBSOLETE_DEVDATA /* to be removed soon */
/* dev->driver_data will be used instead some day.
* Use the video_{get|set}_drvdata() helper functions,
* so the switch over will be transparent for you.
* Or use {pci|usb}_{get|set}_drvdata() directly. */
void *priv;
#endif
}; };
/* Class-dev to video-device */ /* Class-dev to video-device */
...@@ -98,18 +90,18 @@ void video_device_release(struct video_device *vfd); ...@@ -98,18 +90,18 @@ void video_device_release(struct video_device *vfd);
a dubious construction at best. */ a dubious construction at best. */
void video_device_release_empty(struct video_device *vfd); void video_device_release_empty(struct video_device *vfd);
#ifdef OBSOLETE_DEVDATA /* to be removed soon */
/* helper functions to access driver private data. */ /* helper functions to access driver private data. */
static inline void *video_get_drvdata(struct video_device *dev) static inline void *video_get_drvdata(struct video_device *dev)
{ {
return dev->priv; return dev_get_drvdata(&dev->dev);
} }
static inline void video_set_drvdata(struct video_device *dev, void *data) static inline void video_set_drvdata(struct video_device *dev, void *data)
{ {
dev->priv = data; dev_set_drvdata(&dev->dev, data);
} }
#ifdef OBSOLETE_DEVDATA /* to be removed soon */
/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ /* Obsolete stuff - Still needed for radio devices and obsolete drivers */
extern struct video_device* video_devdata(struct file*); extern struct video_device* video_devdata(struct file*);
#endif #endif
......
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