From: Hans Verkuil Date: Sat, 23 Aug 2008 10:24:07 +0000 (-0300) Subject: V4L/DVB (8786): v4l2: remove the priv field, use dev_get_drvdata instead X-Git-Tag: v2.6.28-rc1~601^2~241 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=601e9444f249d219009ec05674268d90f6f1cdcb;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index cf6a817d505..5b34c134aa2 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c @@ -533,7 +533,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, memcpy(vfd, &device_template, sizeof(struct video_device)); strlcpy(vfd->name, name, sizeof(vfd->name)); 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"); if (video_register_device(vfd, type, -1) < 0) { diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 59fdaf85e41..62cc6874d63 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -275,7 +275,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(rt, rt->curfreq); @@ -286,7 +286,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = rt->curfreq; @@ -312,7 +312,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct rt_device *rt = dev->priv; + struct rt_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -329,7 +329,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct rt_device *rt = dev->priv; + struct rt_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -437,7 +437,7 @@ static int __init rtrack_init(void) 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) { release_region(io, 2); diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index ddd96295a9f..5dd5e349ef4 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c @@ -197,7 +197,7 @@ static int vidioc_g_tuner (struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -266,7 +266,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(az, az->curfreq); @@ -277,7 +277,7 @@ static int vidioc_g_frequency (struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = az->curfreq; @@ -304,7 +304,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct az_device *az = dev->priv; + struct az_device *az = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -324,7 +324,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct az_device *az = dev->priv; + struct az_device *az = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -405,7 +405,7 @@ static int __init aztech_init(void) } 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) { release_region(io,2); diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index d65fd287bde..1f57f731c12 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c @@ -205,7 +205,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -233,7 +233,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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) || (f->frequency > GEMTEK_PCI_RANGE_HIGH) ) @@ -248,7 +248,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = card->current_frequency; @@ -273,7 +273,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { 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) { case V4L2_CID_AUDIO_MUTE: @@ -293,7 +293,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { 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) { case V4L2_CID_AUDIO_MUTE: @@ -442,7 +442,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci } card->videodev = devradio; - devradio->priv = card; + video_set_drvdata(devradio, card); gemtek_pci_mute( card ); printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 2d991ae2f20..2c4c15e6d51 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c @@ -460,7 +460,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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); @@ -471,7 +471,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = rt->lastfreq; @@ -496,7 +496,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct gemtek_device *rt = dev->priv; + struct gemtek_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -516,7 +516,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct gemtek_device *rt = dev->priv; + struct gemtek_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -623,7 +623,7 @@ static int __init gemtek_init(void) 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) { release_region(io, 1); diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 4e2e8a3d9b5..9bf2acf5249 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c @@ -232,7 +232,7 @@ static int vidioc_g_tuner (struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -303,7 +303,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, struct v4l2_frequency *f) { 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) { 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, struct v4l2_frequency *f) { 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->frequency = card->freq; @@ -356,7 +356,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct radio_device *card=dev->priv; + struct radio_device *card = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -371,7 +371,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct radio_device *card=dev->priv; + struct radio_device *card = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -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); 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) { printk("radio-maxiradio: can't register device!"); diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index 8fe820da73e..4234f7ed0fc 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c @@ -155,7 +155,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -175,7 +175,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(rt, rt->curfreq); @@ -186,7 +186,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = rt->curfreq; @@ -212,7 +212,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct rt_device *rt = dev->priv; + struct rt_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -232,7 +232,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct rt_device *rt = dev->priv; + struct rt_device *rt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -342,7 +342,7 @@ static int __init rtrack2_init(void) return -EBUSY; } - rtrack2_radio.priv=&rtrack2_unit; + video_set_drvdata(&rtrack2_radio, &rtrack2_unit); spin_lock_init(&lock); if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) { diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 6d865a7a91e..810c366b73b 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c @@ -148,7 +148,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, { int mult; 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) return -EINVAL; @@ -177,7 +177,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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)) f->frequency *= 1000; @@ -195,7 +195,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = fmi->curfreq; @@ -223,7 +223,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct fmi_device *fmi = dev->priv; + struct fmi_device *fmi = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -237,7 +237,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct fmi_device *fmi = dev->priv; + struct fmi_device *fmi = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -386,7 +386,7 @@ static int __init fmi_init(void) fmi_unit.curvol = 0; fmi_unit.curfreq = 0; fmi_unit.flags = V4L2_TUNER_CAP_LOW; - fmi_radio.priv = &fmi_unit; + video_set_drvdata(&fmi_radio, &fmi_unit); mutex_init(&lock); diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 9625d1f0194..9f823150452 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c @@ -231,7 +231,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, { int mult; 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) return -EINVAL; @@ -264,7 +264,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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)) f->frequency *= 1000; @@ -288,7 +288,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = fmr2->curfreq; @@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct fmr2_device *fmr2 = dev->priv; + struct fmr2_device *fmr2 = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct fmr2_device *fmr2 = dev->priv; + struct fmr2_device *fmr2 = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -454,7 +454,7 @@ static int __init fmr2_init(void) fmr2_unit.stereo = 1; fmr2_unit.flags = V4L2_TUNER_CAP_LOW; fmr2_unit.card_type = 0; - fmr2_radio.priv = &fmr2_unit; + video_set_drvdata(&fmr2_radio, &fmr2_unit); mutex_init(&lock); diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index de13ec81ce4..0bc9af686ad 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c @@ -222,7 +222,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -250,7 +250,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(tt, tt->curfreq); @@ -261,7 +261,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = tt->curfreq; @@ -287,7 +287,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct tt_device *tt = dev->priv; + struct tt_device *tt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -307,7 +307,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct tt_device *tt = dev->priv; + struct tt_device *tt = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -414,7 +414,7 @@ static int __init terratec_init(void) return -EBUSY; } - terratec_radio.priv=&terratec_unit; + video_set_drvdata(&terratec_radio, &terratec_unit); spin_lock_init(&lock); diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index c2eedb7a73a..27255d7ff1b 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c @@ -224,7 +224,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(typhoon, typhoon->curfreq); @@ -235,7 +235,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = typhoon->curfreq; @@ -262,7 +262,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct typhoon_device *typhoon = dev->priv; + struct typhoon_device *typhoon = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -279,7 +279,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct typhoon_device *typhoon = dev->priv; + struct typhoon_device *typhoon = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -458,7 +458,7 @@ static int __init typhoon_init(void) 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) { release_region(io, 8); return -EINVAL; diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index 0d43e8401eb..3a9a7772ae5 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c @@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { 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) return -EINVAL; @@ -278,7 +278,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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_setfreq(zol, zol->curfreq); @@ -289,7 +289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, struct v4l2_frequency *f) { 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->frequency = zol->curfreq; @@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct zol_device *zol = dev->priv; + struct zol_device *zol = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { struct video_device *dev = video_devdata(file); - struct zol_device *zol = dev->priv; + struct zol_device *zol = video_get_drvdata(dev); switch (ctrl->id) { case V4L2_CID_AUDIO_MUTE: @@ -453,7 +453,7 @@ static int __init zoltrix_init(void) return -ENXIO; } - zoltrix_radio.priv = &zoltrix_unit; + video_set_drvdata(&zoltrix_radio, &zoltrix_unit); if (!request_region(io, 2, "zoltrix")) { printk(KERN_ERR "zoltrix: port 0x%x already in use\n", io); return -EBUSY; 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; diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index 23df00919ae..1d4df571060 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h @@ -69,14 +69,6 @@ struct video_device /* ioctl callbacks */ 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 */ @@ -98,18 +90,18 @@ void video_device_release(struct video_device *vfd); a dubious construction at best. */ void video_device_release_empty(struct video_device *vfd); -#ifdef OBSOLETE_DEVDATA /* to be removed soon */ /* helper functions to access driver private data. */ 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) { - 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 */ extern struct video_device* video_devdata(struct file*); #endif