Commit 8c14cc1f authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] bttv: fix priority handling

Replace the - incorrect - manual priority handling with the core priority
implementation.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ae50f0f8
...@@ -1706,11 +1706,7 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) ...@@ -1706,11 +1706,7 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id)
struct bttv_fh *fh = priv; struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
unsigned int i; unsigned int i;
int err; int err = 0;
err = v4l2_prio_check(&btv->prio, fh->prio);
if (err)
goto err;
for (i = 0; i < BTTV_TVNORMS; i++) for (i = 0; i < BTTV_TVNORMS; i++)
if (*id & bttv_tvnorms[i].v4l2_id) if (*id & bttv_tvnorms[i].v4l2_id)
...@@ -1793,11 +1789,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) ...@@ -1793,11 +1789,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i)
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
int err;
err = v4l2_prio_check(&btv->prio, fh->prio);
if (err)
return err;
if (i >= bttv_tvcards[btv->c.type].video_inputs) if (i >= bttv_tvcards[btv->c.type].video_inputs)
return -EINVAL; return -EINVAL;
...@@ -1811,15 +1802,10 @@ static int bttv_s_tuner(struct file *file, void *priv, ...@@ -1811,15 +1802,10 @@ static int bttv_s_tuner(struct file *file, void *priv,
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
int err;
if (t->index) if (t->index)
return -EINVAL; return -EINVAL;
err = v4l2_prio_check(&btv->prio, fh->prio);
if (err)
return err;
bttv_call_all(btv, tuner, s_tuner, t); bttv_call_all(btv, tuner, s_tuner, t);
if (btv->audio_mode_gpio) if (btv->audio_mode_gpio)
...@@ -1862,14 +1848,10 @@ static int bttv_s_frequency(struct file *file, void *priv, ...@@ -1862,14 +1848,10 @@ static int bttv_s_frequency(struct file *file, void *priv,
{ {
struct bttv_fh *fh = priv; struct bttv_fh *fh = priv;
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
int err;
if (f->tuner) if (f->tuner)
return -EINVAL; return -EINVAL;
err = v4l2_prio_check(&btv->prio, fh->prio);
if (err)
return err;
bttv_set_frequency(btv, f); bttv_set_frequency(btv, f);
return 0; return 0;
} }
...@@ -2808,28 +2790,6 @@ static int bttv_g_tuner(struct file *file, void *priv, ...@@ -2808,28 +2790,6 @@ static int bttv_g_tuner(struct file *file, void *priv,
return 0; return 0;
} }
static int bttv_g_priority(struct file *file, void *f, enum v4l2_priority *p)
{
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;
*p = v4l2_prio_max(&btv->prio);
return 0;
}
static int bttv_s_priority(struct file *file, void *f,
enum v4l2_priority prio)
{
struct bttv_fh *fh = f;
struct bttv *btv = fh->btv;
int rc;
rc = v4l2_prio_change(&btv->prio, &fh->prio, prio);
return rc;
}
static int bttv_cropcap(struct file *file, void *priv, static int bttv_cropcap(struct file *file, void *priv,
struct v4l2_cropcap *cap) struct v4l2_cropcap *cap)
{ {
...@@ -2882,11 +2842,6 @@ static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop) ...@@ -2882,11 +2842,6 @@ static int bttv_s_crop(struct file *file, void *f, const struct v4l2_crop *crop)
/* Make sure tvnorm, vbi_end and the current cropping /* Make sure tvnorm, vbi_end and the current cropping
parameters remain consistent until we're done. Note parameters remain consistent until we're done. Note
read() may change vbi_end in check_alloc_btres_lock(). */ read() may change vbi_end in check_alloc_btres_lock(). */
retval = v4l2_prio_check(&btv->prio, fh->prio);
if (0 != retval) {
return retval;
}
retval = -EBUSY; retval = -EBUSY;
if (locked_btres(fh->btv, VIDEO_RESOURCES)) { if (locked_btres(fh->btv, VIDEO_RESOURCES)) {
...@@ -3085,8 +3040,6 @@ static int bttv_open(struct file *file) ...@@ -3085,8 +3040,6 @@ static int bttv_open(struct file *file)
fh->type = type; fh->type = type;
fh->ov.setup_ok = 0; fh->ov.setup_ok = 0;
v4l2_prio_open(&btv->prio, &fh->prio);
videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, videobuf_queue_sg_init(&fh->cap, &bttv_video_qops,
&btv->c.pci->dev, &btv->s_lock, &btv->c.pci->dev, &btv->s_lock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
...@@ -3156,7 +3109,6 @@ static int bttv_release(struct file *file) ...@@ -3156,7 +3109,6 @@ static int bttv_release(struct file *file)
videobuf_mmap_free(&fh->cap); videobuf_mmap_free(&fh->cap);
videobuf_mmap_free(&fh->vbi); videobuf_mmap_free(&fh->vbi);
v4l2_prio_close(&btv->prio, fh->prio);
file->private_data = NULL; file->private_data = NULL;
btv->users--; btv->users--;
...@@ -3226,8 +3178,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { ...@@ -3226,8 +3178,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = {
.vidioc_g_fbuf = bttv_g_fbuf, .vidioc_g_fbuf = bttv_g_fbuf,
.vidioc_s_fbuf = bttv_s_fbuf, .vidioc_s_fbuf = bttv_s_fbuf,
.vidioc_overlay = bttv_overlay, .vidioc_overlay = bttv_overlay,
.vidioc_g_priority = bttv_g_priority,
.vidioc_s_priority = bttv_s_priority,
.vidioc_g_parm = bttv_g_parm, .vidioc_g_parm = bttv_g_parm,
.vidioc_g_frequency = bttv_g_frequency, .vidioc_g_frequency = bttv_g_frequency,
.vidioc_s_frequency = bttv_s_frequency, .vidioc_s_frequency = bttv_s_frequency,
...@@ -3268,13 +3218,13 @@ static int radio_open(struct file *file) ...@@ -3268,13 +3218,13 @@ static int radio_open(struct file *file)
return -ENOMEM; return -ENOMEM;
file->private_data = fh; file->private_data = fh;
*fh = btv->init; *fh = btv->init;
v4l2_fh_init(&fh->fh, vdev);
v4l2_prio_open(&btv->prio, &fh->prio);
btv->radio_user++; btv->radio_user++;
bttv_call_all(btv, tuner, s_radio); bttv_call_all(btv, tuner, s_radio);
audio_input(btv,TVAUDIO_INPUT_RADIO); audio_input(btv,TVAUDIO_INPUT_RADIO);
v4l2_fh_add(&fh->fh);
return 0; return 0;
} }
...@@ -3285,8 +3235,9 @@ static int radio_release(struct file *file) ...@@ -3285,8 +3235,9 @@ static int radio_release(struct file *file)
struct bttv *btv = fh->btv; struct bttv *btv = fh->btv;
struct saa6588_command cmd; struct saa6588_command cmd;
v4l2_prio_close(&btv->prio, fh->prio);
file->private_data = NULL; file->private_data = NULL;
v4l2_fh_del(&fh->fh);
v4l2_fh_exit(&fh->fh);
kfree(fh); kfree(fh);
btv->radio_user--; btv->radio_user--;
...@@ -3948,6 +3899,7 @@ static struct video_device *vdev_init(struct bttv *btv, ...@@ -3948,6 +3899,7 @@ static struct video_device *vdev_init(struct bttv *btv,
vfd->v4l2_dev = &btv->c.v4l2_dev; vfd->v4l2_dev = &btv->c.v4l2_dev;
vfd->release = video_device_release; vfd->release = video_device_release;
vfd->debug = bttv_debug; vfd->debug = bttv_debug;
set_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
video_set_drvdata(vfd, btv); video_set_drvdata(vfd, btv);
snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)", snprintf(vfd->name, sizeof(vfd->name), "BT%d%s %s (%s)",
btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "", btv->id, (btv->id==848 && btv->revision==0x12) ? "A" : "",
...@@ -4086,7 +4038,6 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) ...@@ -4086,7 +4038,6 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id)
INIT_LIST_HEAD(&btv->c.subs); INIT_LIST_HEAD(&btv->c.subs);
INIT_LIST_HEAD(&btv->capture); INIT_LIST_HEAD(&btv->capture);
INIT_LIST_HEAD(&btv->vcapture); INIT_LIST_HEAD(&btv->vcapture);
v4l2_prio_init(&btv->prio);
init_timer(&btv->timeout); init_timer(&btv->timeout);
btv->timeout.function = bttv_irq_timeout; btv->timeout.function = bttv_irq_timeout;
......
...@@ -221,9 +221,6 @@ struct bttv_fh { ...@@ -221,9 +221,6 @@ struct bttv_fh {
struct bttv *btv; struct bttv *btv;
int resources; int resources;
#ifdef VIDIOC_G_PRIORITY
enum v4l2_priority prio;
#endif
enum v4l2_buf_type type; enum v4l2_buf_type type;
/* video capture */ /* video capture */
...@@ -420,9 +417,6 @@ struct bttv { ...@@ -420,9 +417,6 @@ struct bttv {
spinlock_t s_lock; spinlock_t s_lock;
struct mutex lock; struct mutex lock;
int resources; int resources;
#ifdef VIDIOC_G_PRIORITY
struct v4l2_prio_state prio;
#endif
/* video state */ /* video state */
unsigned int input; unsigned int input;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment