Skip to content

Commit 3bdaa38

Browse files
prabhakarladmchehab
authored andcommitted
[media] media: davinci: vpfe: use v4l2_fh for priority handling
This patch migrates the vpfe driver to use v4l2_fh for priority handling. Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
1 parent 3d7543b commit 3bdaa38

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

‎drivers/media/platform/davinci/vpfe_capture.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ static int vpfe_initialize_device(struct vpfe_device *vpfe_dev)
498498
static int vpfe_open(struct file *file)
499499
{
500500
struct vpfe_device *vpfe_dev = video_drvdata(file);
501+
struct video_device *vdev = video_devdata(file);
501502
struct vpfe_fh *fh;
502503

503504
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_open\n");
@@ -517,6 +518,7 @@ static int vpfe_open(struct file *file)
517518
/* store pointer to fh in private_data member of file */
518519
file->private_data = fh;
519520
fh->vpfe_dev = vpfe_dev;
521+
v4l2_fh_init(&fh->fh, vdev);
520522
mutex_lock(&vpfe_dev->lock);
521523
/* If decoder is not initialized. initialize it */
522524
if (!vpfe_dev->initialized) {
@@ -529,9 +531,7 @@ static int vpfe_open(struct file *file)
529531
vpfe_dev->usrs++;
530532
/* Set io_allowed member to false */
531533
fh->io_allowed = 0;
532-
/* Initialize priority of this instance to default priority */
533-
fh->prio = V4L2_PRIORITY_UNSET;
534-
v4l2_prio_open(&vpfe_dev->prio, &fh->prio);
534+
v4l2_fh_add(&fh->fh);
535535
mutex_unlock(&vpfe_dev->lock);
536536
return 0;
537537
}
@@ -740,8 +740,8 @@ static int vpfe_release(struct file *file)
740740

741741
/* Decrement device usrs counter */
742742
vpfe_dev->usrs--;
743-
/* Close the priority */
744-
v4l2_prio_close(&vpfe_dev->prio, fh->prio);
743+
v4l2_fh_del(&fh->fh);
744+
v4l2_fh_exit(&fh->fh);
745745
/* If this is the last file handle */
746746
if (!vpfe_dev->usrs) {
747747
vpfe_dev->initialized = 0;
@@ -1910,14 +1910,13 @@ static int vpfe_probe(struct platform_device *pdev)
19101910
/* Initialize field of the device objects */
19111911
vpfe_dev->numbuffers = config_params.numbuffers;
19121912

1913-
/* Initialize prio member of device object */
1914-
v4l2_prio_init(&vpfe_dev->prio);
19151913
/* register video device */
19161914
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
19171915
"trying to register vpfe device.\n");
19181916
v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev,
19191917
"video_dev=%x\n", (int)&vpfe_dev->video_dev);
19201918
vpfe_dev->fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
1919+
set_bit(V4L2_FL_USE_FH_PRIO, &vpfe_dev->video_dev->flags);
19211920
ret = video_register_device(vpfe_dev->video_dev,
19221921
VFL_TYPE_GRABBER, -1);
19231922

‎include/media/davinci/vpfe_capture.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <linux/videodev2.h>
2727
#include <linux/clk.h>
2828
#include <linux/i2c.h>
29+
#include <media/v4l2-fh.h>
2930
#include <media/v4l2-ioctl.h>
3031
#include <media/v4l2-device.h>
3132
#include <media/videobuf-dma-contig.h>
@@ -110,8 +111,6 @@ struct vpfe_device {
110111
struct v4l2_device v4l2_dev;
111112
/* parent device */
112113
struct device *pdev;
113-
/* Used to keep track of state of the priority */
114-
struct v4l2_prio_state prio;
115114
/* number of open instances of the channel */
116115
u32 usrs;
117116
/* Indicates id of the field which is being displayed */
@@ -174,11 +173,10 @@ struct vpfe_device {
174173

175174
/* File handle structure */
176175
struct vpfe_fh {
176+
struct v4l2_fh fh;
177177
struct vpfe_device *vpfe_dev;
178178
/* Indicates whether this file handle is doing IO */
179179
u8 io_allowed;
180-
/* Used to keep track priority of this instance */
181-
enum v4l2_priority prio;
182180
};
183181

184182
struct vpfe_config_params {

0 commit comments

Comments
 (0)