]> www.infradead.org Git - users/hch/misc.git/commitdiff
media: meson-ge2d: Access v4l2_fh from file
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>
Sun, 10 Aug 2025 01:30:19 +0000 (04:30 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 13 Aug 2025 06:33:47 +0000 (08:33 +0200)
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.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/amlogic/meson-ge2d/ge2d.c

index b1b0b6535fb1931c74ae9b2da28bea579cd1bc4c..5744853a40035e9973e605dd3ffec508641470f2 100644 (file)
@@ -457,7 +457,7 @@ static int vidioc_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *f
 static int vidioc_g_selection(struct file *file, void *priv,
                              struct v4l2_selection *s)
 {
-       struct ge2d_ctx *ctx = priv;
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        struct ge2d_frame *f;
        bool use_frame = false;
 
@@ -507,7 +507,7 @@ static int vidioc_g_selection(struct file *file, void *priv,
 static int vidioc_s_selection(struct file *file, void *priv,
                              struct v4l2_selection *s)
 {
-       struct ge2d_ctx *ctx = priv;
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        struct meson_ge2d *ge2d = ctx->ge2d;
        struct ge2d_frame *f;
        int ret = 0;
@@ -574,8 +574,8 @@ static void vidioc_setup_cap_fmt(struct ge2d_ctx *ctx, struct v4l2_pix_format *f
 
 static int vidioc_try_fmt_cap(struct file *file, void *priv, struct v4l2_format *f)
 {
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        const struct ge2d_fmt *fmt = find_fmt(f);
-       struct ge2d_ctx *ctx = priv;
        struct v4l2_pix_format fmt_cap;
 
        vidioc_setup_cap_fmt(ctx, &fmt_cap);
@@ -595,7 +595,7 @@ static int vidioc_try_fmt_cap(struct file *file, void *priv, struct v4l2_format
 
 static int vidioc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *f)
 {
-       struct ge2d_ctx *ctx = priv;
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        struct meson_ge2d *ge2d = ctx->ge2d;
        struct vb2_queue *vq;
        struct ge2d_frame *frm;
@@ -631,7 +631,7 @@ static int vidioc_s_fmt_cap(struct file *file, void *priv, struct v4l2_format *f
 
 static int vidioc_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
 {
-       struct ge2d_ctx *ctx = priv;
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        struct vb2_queue *vq;
        struct ge2d_frame *frm;
 
@@ -670,7 +670,7 @@ static int vidioc_try_fmt_out(struct file *file, void *priv, struct v4l2_format
 
 static int vidioc_s_fmt_out(struct file *file, void *priv, struct v4l2_format *f)
 {
-       struct ge2d_ctx *ctx = priv;
+       struct ge2d_ctx *ctx = file_to_ge2d_ctx(file);
        struct meson_ge2d *ge2d = ctx->ge2d;
        struct vb2_queue *vq;
        struct ge2d_frame *frm, *frm_cap;