Skip to content

Commit

Permalink
V4L/DVB (8786): v4l2: remove the priv field, use dev_get_drvdata instead
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Oct 12, 2008
1 parent e138c59 commit 601e944
Show file tree
Hide file tree
Showing 23 changed files with 111 additions and 119 deletions.
2 changes: 1 addition & 1 deletion drivers/media/common/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-aimslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-aztech.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-gemtek-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) )
Expand All @@ -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;
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions drivers/media/radio/radio-gemtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-maxiradio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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",
Expand All @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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!");
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-rtrack2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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) {
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/radio/radio-sf16fmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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);

Expand Down
Loading

0 comments on commit 601e944

Please sign in to comment.