]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (8786): v4l2: remove the priv field, use dev_get_drvdata instead
authorHans Verkuil <hverkuil@xs4all.nl>
Sat, 23 Aug 2008 10:24:07 +0000 (07:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 12 Oct 2008 11:36:54 +0000 (09:36 -0200)
Remove the priv field and let video_get/set_drvdata use dev_get_drvdata
and dev_set_drvdata instead.

Convert all drivers that still used priv directly.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
23 files changed:
drivers/media/common/saa7146_fops.c
drivers/media/radio/radio-aimslab.c
drivers/media/radio/radio-aztech.c
drivers/media/radio/radio-gemtek-pci.c
drivers/media/radio/radio-gemtek.c
drivers/media/radio/radio-maxiradio.c
drivers/media/radio/radio-rtrack2.c
drivers/media/radio/radio-sf16fmi.c
drivers/media/radio/radio-sf16fmr2.c
drivers/media/radio/radio-terratec.c
drivers/media/radio/radio-typhoon.c
drivers/media/radio/radio-zoltrix.c
drivers/media/video/arv.c
drivers/media/video/cpia.c
drivers/media/video/pwc/pwc-if.c
drivers/media/video/pwc/pwc-v4l.c
drivers/media/video/s2255drv.c
drivers/media/video/saa5246a.c
drivers/media/video/saa5249.c
drivers/media/video/stk-webcam.c
drivers/media/video/usbvideo/vicam.c
drivers/media/video/w9966.c
include/media/v4l2-dev.h

index cf6a817d50594a21f76721f1c386b1b2d798418c..5b34c134aa25147dc118a3cc44a3ba49365166f6 100644 (file)
@@ -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) {
index 59fdaf85e41b6a87e0ba4d0a982b79cfff990de7..62cc6874d63feecc68de7e2a30486db7bf549d1d 100644 (file)
@@ -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);
index ddd96295a9fe11695295d3c7fee27dd3aa80c7e6..5dd5e349ef47c22696b0fea79c72c5de5880d9ce 100644 (file)
@@ -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);
index d65fd287bde14f81c0ed8b5b666896c66ac86ad1..1f57f731c12179552299ec6d0d39e258232dedcf 100644 (file)
@@ -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",
index 2d991ae2f205127a454ac282aa67dffcb60d4b29..2c4c15e6d510fdd3e3f81299c7843d29a35d8944 100644 (file)
@@ -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);
index 4e2e8a3d9b5f6b870b908930f2ead776f4991ccc..9bf2acf5249ce40624a080f2141763532af1be1c 100644 (file)
@@ -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!");
index 8fe820da73e8f47069c5ed7bd0c4f1323fc844f7..4234f7ed0fc36920cdc16b0476a3aaf06aa0358c 100644 (file)
@@ -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) {
index 6d865a7a91eccef6f44c4a140f3a397a311ca165..810c366b73b0929c2abb973e0c40b0bd9c5e7126 100644 (file)
@@ -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);
 
index 9625d1f0194eaceb495cca7b51e253ee6edad829..9f823150452de1b87751d5825b2f80536bea0a6a 100644 (file)
@@ -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);
 
index de13ec81ce49c8c6981e8349cab1948d2818767b..0bc9af686ad73e708f5d5f56e917c373f6700362 100644 (file)
@@ -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);
 
index c2eedb7a73a5e0be2151aacfbbacfd17c947d666..27255d7ff1ba076275ee2efe9fff8da74c08da58 100644 (file)
@@ -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;
index 0d43e8401eb5e4af2d19a04a00f23529c13eadfd..3a9a7772ae510f48a484e0cbfa20d28459783387 100644 (file)
@@ -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;
index 0d4f9b6834596881cc699769aecbd96bd078f4ad..218754b4906a7a4fee61b7840dc4b8ed1db92ad4 100644 (file)
@@ -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;
index c0600fdbfc6f14a241267f2d3c6e91e75486761f..b14c59c281eb2b71c46189701d77596d18960089 100644 (file)
@@ -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++) {
index 9aee7cb6f79a9e310e57021ac7d50a1fb73d0dc9..ab28389b4cdadf17d0e28282dd6c186237c2fe14 100644 (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);
 
-       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;
 
index 1742889874df08c6f944b4b066fa1111fcff2e4a..76a1376c9751dd1c06acacc766af6676a36efe40 100644 (file)
@@ -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;
 
index af19bb346ef19c32f695d33685a591b9641c9847..ea40f4c8b33e9e9a3576a6ef27fd3723c2fe55ef 100644 (file)
@@ -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,
index 5f5aa2063e0eb71da9b982a24b1894fa695a7b0b..0178b49da0c18639a0cb7fa0e4d16c547f1810f3 100644 (file)
@@ -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,
index 225117c789ca75c7cdf30f2edbb676eeab085c10..c784715a0b0474616fad25d6a4c68c4ee22cd6cc 100644 (file)
@@ -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 */
index 6b1ef5dc562cbc850e08ca72430c59205d89bfff..8dda5680094d1f92eee131de4306bfa783ea0dd1 100644 (file)
@@ -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");
index d7728256f295426d50e40413682808f204703178..1ffcc393fcbb810f4e9437a8933b1409d809d905 100644 (file)
@@ -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;
index e3580119640f4ed9a2849248ce1e8a439e4dd0cd..14ebb15837fbaafa6194b707c60ce2892c8de37e 100644 (file)
@@ -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;
index 23df00919ae8718c227df2a0bbbec8dca98f4fc7..1d4df571060bb4f94b7f5bb4280055e9163aa1e5 100644 (file)
@@ -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