The v4l2_fh associated with an open file handle is now guaranteed
to be available in file->private_data, initialised by v4l2_fh_add().

Access the v4l2_fh, and from there the driver-specific structure,
from the file * in all ioctl handlers.

Signed-off-by: Jacopo Mondi <jacopo.mo...@ideasonboard.com>
---
 .../media/platform/chips-media/coda/coda-common.c  | 36 +++++++++++-----------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/media/platform/chips-media/coda/coda-common.c 
b/drivers/media/platform/chips-media/coda/coda-common.c
index 
a27d5a261a27fb78d4c7ca008146780698386333..a10576f702127ba6014799e7d3190c2785afd2a2
 100644
--- a/drivers/media/platform/chips-media/coda/coda-common.c
+++ b/drivers/media/platform/chips-media/coda/coda-common.c
@@ -427,7 +427,7 @@ static struct vdoa_data *coda_get_vdoa_data(void)
 static int coda_querycap(struct file *file, void *priv,
                         struct v4l2_capability *cap)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
 
        strscpy(cap->driver, CODA_NAME, sizeof(cap->driver));
        strscpy(cap->card, coda_product_name(ctx->dev->devtype->product),
@@ -447,7 +447,7 @@ static int coda_enum_fmt(struct file *file, void *priv,
 {
        struct video_device *vdev = video_devdata(file);
        const struct coda_video_device *cvd = to_coda_video_device(vdev);
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        const u32 *formats;
 
        if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
@@ -497,7 +497,7 @@ static int coda_g_fmt(struct file *file, void *priv,
                      struct v4l2_format *f)
 {
        struct coda_q_data *q_data;
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
 
        q_data = get_q_data(ctx, f->type);
        if (!q_data)
@@ -658,7 +658,7 @@ static int coda_try_fmt(struct coda_ctx *ctx, const struct 
coda_codec *codec,
 static int coda_try_fmt_vid_cap(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        const struct coda_q_data *q_data_src;
        const struct coda_codec *codec;
        struct vb2_queue *src_vq;
@@ -764,7 +764,7 @@ static void coda_set_default_colorspace(struct 
v4l2_pix_format *fmt)
 static int coda_try_fmt_vid_out(struct file *file, void *priv,
                                struct v4l2_format *f)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_dev *dev = ctx->dev;
        const struct coda_q_data *q_data_dst;
        const struct coda_codec *codec;
@@ -858,7 +858,7 @@ static int coda_s_fmt(struct coda_ctx *ctx, struct 
v4l2_format *f,
 static int coda_s_fmt_vid_cap(struct file *file, void *priv,
                              struct v4l2_format *f)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_q_data *q_data_src;
        const struct coda_codec *codec;
        struct v4l2_rect r;
@@ -910,7 +910,7 @@ static int coda_s_fmt_vid_cap(struct file *file, void *priv,
 static int coda_s_fmt_vid_out(struct file *file, void *priv,
                              struct v4l2_format *f)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        const struct coda_codec *codec;
        struct v4l2_format f_cap;
        struct vb2_queue *dst_vq;
@@ -966,7 +966,7 @@ static int coda_s_fmt_vid_out(struct file *file, void *priv,
 static int coda_reqbufs(struct file *file, void *priv,
                        struct v4l2_requestbuffers *rb)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        int ret;
 
        ret = v4l2_m2m_reqbufs(file, ctx->fh.m2m_ctx, rb);
@@ -986,7 +986,7 @@ static int coda_reqbufs(struct file *file, void *priv,
 static int coda_qbuf(struct file *file, void *priv,
                     struct v4l2_buffer *buf)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
 
        if (ctx->inst_type == CODA_INST_DECODER &&
            buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
@@ -997,7 +997,7 @@ static int coda_qbuf(struct file *file, void *priv,
 
 static int coda_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
 {
-       struct coda_ctx *ctx = fh_to_ctx(priv);
+       struct coda_ctx *ctx = file_to_ctx(file);
        int ret;
 
        ret = v4l2_m2m_dqbuf(file, ctx->fh.m2m_ctx, buf);
@@ -1025,7 +1025,7 @@ void coda_m2m_buf_done(struct coda_ctx *ctx, struct 
vb2_v4l2_buffer *buf,
 static int coda_g_selection(struct file *file, void *fh,
                            struct v4l2_selection *s)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_q_data *q_data;
        struct v4l2_rect r, *rsel;
 
@@ -1071,7 +1071,7 @@ static int coda_g_selection(struct file *file, void *fh,
 static int coda_s_selection(struct file *file, void *fh,
                            struct v4l2_selection *s)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_q_data *q_data;
 
        switch (s->target) {
@@ -1126,7 +1126,7 @@ static void coda_wake_up_capture_queue(struct coda_ctx 
*ctx)
 static int coda_encoder_cmd(struct file *file, void *fh,
                            struct v4l2_encoder_cmd *ec)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct vb2_v4l2_buffer *buf;
        int ret;
 
@@ -1207,7 +1207,7 @@ static bool coda_mark_last_dst_buf(struct coda_ctx *ctx)
 static int coda_decoder_cmd(struct file *file, void *fh,
                            struct v4l2_decoder_cmd *dc)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_dev *dev = ctx->dev;
        struct vb2_v4l2_buffer *buf;
        struct vb2_queue *dst_vq;
@@ -1286,7 +1286,7 @@ static int coda_decoder_cmd(struct file *file, void *fh,
 static int coda_enum_framesizes(struct file *file, void *fh,
                                struct v4l2_frmsizeenum *fsize)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_q_data *q_data_dst;
        const struct coda_codec *codec;
 
@@ -1319,7 +1319,7 @@ static int coda_enum_framesizes(struct file *file, void 
*fh,
 static int coda_enum_frameintervals(struct file *file, void *fh,
                                    struct v4l2_frmivalenum *f)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct coda_q_data *q_data;
        const struct coda_codec *codec;
 
@@ -1358,7 +1358,7 @@ static int coda_enum_frameintervals(struct file *file, 
void *fh,
 
 static int coda_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct v4l2_fract *tpf;
 
        if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
@@ -1441,7 +1441,7 @@ static uint32_t coda_timeperframe_to_frate(struct 
v4l2_fract *timeperframe)
 
 static int coda_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
 {
-       struct coda_ctx *ctx = fh_to_ctx(fh);
+       struct coda_ctx *ctx = file_to_ctx(file);
        struct v4l2_fract *tpf;
 
        if (a->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)

-- 
2.49.0



_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to