Skip to content

Commit

Permalink
V4L/DVB: v4l2-common: simplify prio utility functions
Browse files Browse the repository at this point in the history
v4l2_prio_init/open/close returned an int when in fact they would
always return 0. Make these void functions.

v4l2_prio_close and v4l2_prio_check pass an enum v4l2_priority as a
pointer for no good reason. Replace with a normal enum v4l2_priority
argument.

These changes will simplify the work of moving priority handling into
the v4l core.

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 May 19, 2010
1 parent 530d2d3 commit ffb4877
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 99 deletions.
18 changes: 9 additions & 9 deletions drivers/media/video/bt8xx/bttv-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@ static int bttv_s_ctrl(struct file *file, void *f,
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;

err = v4l2_prio_check(&btv->prio, &fh->prio);
err = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -1859,7 +1859,7 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id)
unsigned int i;
int err;

err = v4l2_prio_check(&btv->prio, &fh->prio);
err = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -1941,7 +1941,7 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i)

int err;

err = v4l2_prio_check(&btv->prio, &fh->prio);
err = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != err)
return err;

Expand All @@ -1961,7 +1961,7 @@ static int bttv_s_tuner(struct file *file, void *priv,
struct bttv *btv = fh->btv;
int err;

err = v4l2_prio_check(&btv->prio, &fh->prio);
err = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -2001,7 +2001,7 @@ static int bttv_s_frequency(struct file *file, void *priv,
struct bttv *btv = fh->btv;
int err;

err = v4l2_prio_check(&btv->prio, &fh->prio);
err = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -3024,7 +3024,7 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
return -EINVAL;

retval = v4l2_prio_check(&btv->prio, &fh->prio);
retval = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != retval)
return retval;

Expand Down Expand Up @@ -3236,7 +3236,7 @@ static int bttv_open(struct file *file)
*fh = btv->init;
fh->type = type;
fh->ov.setup_ok = 0;
v4l2_prio_open(&btv->prio,&fh->prio);
v4l2_prio_open(&btv->prio, &fh->prio);

videobuf_queue_sg_init(&fh->cap, &bttv_video_qops,
&btv->c.pci->dev, &btv->s_lock,
Expand Down Expand Up @@ -3307,7 +3307,7 @@ static int bttv_release(struct file *file)
/* free stuff */
videobuf_mmap_free(&fh->cap);
videobuf_mmap_free(&fh->vbi);
v4l2_prio_close(&btv->prio,&fh->prio);
v4l2_prio_close(&btv->prio, fh->prio);
file->private_data = NULL;
kfree(fh);

Expand Down Expand Up @@ -3444,7 +3444,7 @@ static int radio_release(struct file *file)
struct bttv *btv = fh->btv;
struct rds_command cmd;

v4l2_prio_close(&btv->prio,&fh->prio);
v4l2_prio_close(&btv->prio, fh->prio);
file->private_data = NULL;
kfree(fh);

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/cpia2/cpia2_v4l.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static int cpia2_close(struct file *file)
{
if(fh->mmapped)
cam->mmapped = 0;
v4l2_prio_close(&cam->prio,&fh->prio);
v4l2_prio_close(&cam->prio, fh->prio);
file->private_data = NULL;
kfree(fh);
}
Expand Down Expand Up @@ -1592,7 +1592,7 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOC_S_FMT:
{
struct cpia2_fh *fh = file->private_data;
retval = v4l2_prio_check(&cam->prio, &fh->prio);
retval = v4l2_prio_check(&cam->prio, fh->prio);
if(retval) {
mutex_unlock(&cam->busy_lock);
return retval;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-controls.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
int ret;
struct v4l2_control ctrl;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/cx18/cx18-fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ int cx18_v4l2_close(struct file *filp)

CX18_DEBUG_IOCTL("close() of %s\n", s->name);

v4l2_prio_close(&cx->prio, &id->prio);
v4l2_prio_close(&cx->prio, id->prio);

/* Easy case first: this stream was never claimed by us */
if (s->id != id->open_id) {
Expand Down
16 changes: 8 additions & 8 deletions drivers/media/video/cx18/cx18-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
int ret;
int w, h;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -306,7 +306,7 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -341,7 +341,7 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
int ret;
struct v4l2_sliced_vbi_format *vbifmt = &fmt->fmt.sliced;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -549,7 +549,7 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -601,7 +601,7 @@ int cx18_s_input(struct file *file, void *fh, unsigned int inp)
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -647,7 +647,7 @@ int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf)
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -675,7 +675,7 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down Expand Up @@ -715,7 +715,7 @@ static int cx18_s_tuner(struct file *file, void *fh, struct v4l2_tuner *vt)
struct cx18 *cx = id->cx;
int ret;

ret = v4l2_prio_check(&cx->prio, &id->prio);
ret = v4l2_prio_check(&cx->prio, id->prio);
if (ret)
return ret;

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/davinci/vpfe_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ static int vpfe_release(struct file *file)
/* Decrement device usrs counter */
vpfe_dev->usrs--;
/* Close the priority */
v4l2_prio_close(&vpfe_dev->prio, &fh->prio);
v4l2_prio_close(&vpfe_dev->prio, fh->prio);
/* If this is the last file handle */
if (!vpfe_dev->usrs) {
vpfe_dev->initialized = 0;
Expand Down
8 changes: 4 additions & 4 deletions drivers/media/video/davinci/vpif_capture.c
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@ static int vpif_release(struct file *filep)
mutex_unlock(&common->lock);

/* Close the priority */
v4l2_prio_close(&ch->prio, &fh->prio);
v4l2_prio_close(&ch->prio, fh->prio);

if (fh->initialized)
ch->initialized = 0;
Expand Down Expand Up @@ -1444,7 +1444,7 @@ static int vpif_s_std(struct file *file, void *priv, v4l2_std_id *std_id)
}
}

ret = v4l2_prio_check(&ch->prio, &fh->prio);
ret = v4l2_prio_check(&ch->prio, fh->prio);
if (0 != ret)
return ret;

Expand Down Expand Up @@ -1554,7 +1554,7 @@ static int vpif_s_input(struct file *file, void *priv, unsigned int index)
}
}

ret = v4l2_prio_check(&ch->prio, &fh->prio);
ret = v4l2_prio_check(&ch->prio, fh->prio);
if (0 != ret)
return ret;

Expand Down Expand Up @@ -1710,7 +1710,7 @@ static int vpif_s_fmt_vid_cap(struct file *file, void *priv,
}
}

ret = v4l2_prio_check(&ch->prio, &fh->prio);
ret = v4l2_prio_check(&ch->prio, fh->prio);
if (0 != ret)
return ret;

Expand Down
4 changes: 2 additions & 2 deletions drivers/media/video/davinci/vpif_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ static int vpif_release(struct file *filep)
ch->initialized = 0;

/* Close the priority */
v4l2_prio_close(&ch->prio, &fh->prio);
v4l2_prio_close(&ch->prio, fh->prio);
filep->private_data = NULL;
fh->initialized = 0;
kfree(fh);
Expand Down Expand Up @@ -753,7 +753,7 @@ static int vpif_s_fmt_vid_out(struct file *file, void *priv,
}

/* Check for the priority */
ret = v4l2_prio_check(&ch->prio, &fh->prio);
ret = v4l2_prio_check(&ch->prio, fh->prio);
if (0 != ret)
return ret;
fh->initialized = 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/ivtv/ivtv-fileops.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ int ivtv_v4l2_close(struct file *filp)

IVTV_DEBUG_FILE("close %s\n", s->name);

v4l2_prio_close(&itv->prio, &id->prio);
v4l2_prio_close(&itv->prio, id->prio);
v4l2_fh_del(fh);
v4l2_fh_exit(fh);

Expand Down
2 changes: 1 addition & 1 deletion drivers/media/video/ivtv/ivtv-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1851,7 +1851,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_S_FBUF:
case VIDIOC_OVERLAY:
ret = v4l2_prio_check(&itv->prio, &id->prio);
ret = v4l2_prio_check(&itv->prio, id->prio);
if (ret)
return ret;
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/video/pvrusb2/pvrusb2-v4l2.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
case VIDIOC_S_INPUT:
case VIDIOC_S_TUNER:
case VIDIOC_S_FREQUENCY:
ret = v4l2_prio_check(&vp->prio, &fh->prio);
ret = v4l2_prio_check(&vp->prio, fh->prio);
if (ret)
return ret;
}
Expand Down Expand Up @@ -972,7 +972,7 @@ static int pvr2_v4l2_release(struct file *file)
fhp->rhp = NULL;
}

v4l2_prio_close(&vp->prio, &fhp->prio);
v4l2_prio_close(&vp->prio, fhp->prio);
file->private_data = NULL;

if (fhp->vnext) {
Expand Down Expand Up @@ -1093,7 +1093,7 @@ static int pvr2_v4l2_open(struct file *file)

fhp->file = file;
file->private_data = fhp;
v4l2_prio_open(&vp->prio,&fhp->prio);
v4l2_prio_open(&vp->prio, &fhp->prio);

fhp->fw_mode_flag = pvr2_hdw_cpufw_get_enabled(hdw);

Expand Down
14 changes: 7 additions & 7 deletions drivers/media/video/saa7134/saa7134-video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, str
That needs to be fixed somehow, but for now this is
good enough. */
if (fh) {
err = v4l2_prio_check(&dev->prio, &fh->prio);
err = v4l2_prio_check(&dev->prio, fh->prio);
if (0 != err)
return err;
}
Expand Down Expand Up @@ -1359,7 +1359,7 @@ static int video_open(struct file *file)
fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24);
fh->width = 720;
fh->height = 576;
v4l2_prio_open(&dev->prio,&fh->prio);
v4l2_prio_open(&dev->prio, &fh->prio);

videobuf_queue_sg_init(&fh->cap, &video_qops,
&dev->pci->dev, &dev->slock,
Expand Down Expand Up @@ -1502,7 +1502,7 @@ static int video_release(struct file *file)
saa7134_pgtable_free(dev->pci,&fh->pt_cap);
saa7134_pgtable_free(dev->pci,&fh->pt_vbi);

v4l2_prio_close(&dev->prio,&fh->prio);
v4l2_prio_close(&dev->prio, fh->prio);
file->private_data = NULL;
kfree(fh);
return 0;
Expand Down Expand Up @@ -1785,7 +1785,7 @@ static int saa7134_s_input(struct file *file, void *priv, unsigned int i)
struct saa7134_dev *dev = fh->dev;
int err;

err = v4l2_prio_check(&dev->prio, &fh->prio);
err = v4l2_prio_check(&dev->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -1839,7 +1839,7 @@ int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_
That needs to be fixed somehow, but for now this is
good enough. */
if (fh) {
err = v4l2_prio_check(&dev->prio, &fh->prio);
err = v4l2_prio_check(&dev->prio, fh->prio);
if (0 != err)
return err;
} else if (res_locked(dev, RESOURCE_OVERLAY)) {
Expand Down Expand Up @@ -2023,7 +2023,7 @@ static int saa7134_s_tuner(struct file *file, void *priv,
struct saa7134_dev *dev = fh->dev;
int rx, mode, err;

err = v4l2_prio_check(&dev->prio, &fh->prio);
err = v4l2_prio_check(&dev->prio, fh->prio);
if (0 != err)
return err;

Expand Down Expand Up @@ -2057,7 +2057,7 @@ static int saa7134_s_frequency(struct file *file, void *priv,
struct saa7134_dev *dev = fh->dev;
int err;

err = v4l2_prio_check(&dev->prio, &fh->prio);
err = v4l2_prio_check(&dev->prio, fh->prio);
if (0 != err)
return err;

Expand Down
Loading

0 comments on commit ffb4877

Please sign in to comment.