]> www.infradead.org Git - users/hch/misc.git/commitdiff
media: exynos4-is: Access v4l2_fh from file
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>
Sun, 10 Aug 2025 01:30:35 +0000 (04:30 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 13 Aug 2025 06:33:52 +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>
Co-developed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/samsung/exynos4-is/fimc-core.h
drivers/media/platform/samsung/exynos4-is/fimc-m2m.c

index 2b6c72d9442c9ce100bb4a27ea7d8da4e821233d..c23cbdee7afcdfedf1a2ef0433b98af6b4478eef 100644 (file)
@@ -496,11 +496,9 @@ struct fimc_ctx {
        struct fimc_ctrls       ctrls;
 };
 
-#define fh_to_ctx(__fh) container_of(__fh, struct fimc_ctx, fh)
-
 static inline struct fimc_ctx *file_to_ctx(struct file *filp)
 {
-       return fh_to_ctx(file_to_v4l2_fh(filp));
+       return container_of(file_to_v4l2_fh(filp), struct fimc_ctx, fh);
 }
 
 static inline void set_frame_bounds(struct fimc_frame *f, u32 width, u32 height)
index 609fd84f89d4ad189d0f367bb37693f15f3a618e..562c57f186c61546175b4f902f1da18fbb2f25fe 100644 (file)
@@ -249,7 +249,7 @@ static int fimc_m2m_enum_fmt(struct file *file, void *priv,
 static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh,
                                 struct v4l2_format *f)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
+       struct fimc_ctx *ctx = file_to_ctx(file);
        const struct fimc_frame *frame = ctx_get_frame(ctx, f->type);
 
        if (IS_ERR(frame))
@@ -308,7 +308,7 @@ static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f)
 static int fimc_m2m_try_fmt_mplane(struct file *file, void *fh,
                                   struct v4l2_format *f)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
+       struct fimc_ctx *ctx = file_to_ctx(file);
        return fimc_try_fmt_mplane(ctx, f);
 }
 
@@ -337,7 +337,7 @@ static void __set_frame_format(struct fimc_frame *frame,
 static int fimc_m2m_s_fmt_mplane(struct file *file, void *fh,
                                 struct v4l2_format *f)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
+       struct fimc_ctx *ctx = file_to_ctx(file);
        struct fimc_dev *fimc = ctx->fimc_dev;
        const struct fimc_fmt *fmt;
        struct vb2_queue *vq;
@@ -376,7 +376,7 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *fh,
 static int fimc_m2m_g_selection(struct file *file, void *fh,
                                struct v4l2_selection *s)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
+       struct fimc_ctx *ctx = file_to_ctx(file);
        const struct fimc_frame *frame;
 
        frame = ctx_get_frame(ctx, s->type);
@@ -484,7 +484,7 @@ static int fimc_m2m_try_selection(struct fimc_ctx *ctx,
 static int fimc_m2m_s_selection(struct file *file, void *fh,
                                struct v4l2_selection *s)
 {
-       struct fimc_ctx *ctx = fh_to_ctx(fh);
+       struct fimc_ctx *ctx = file_to_ctx(file);
        struct fimc_dev *fimc = ctx->fimc_dev;
        struct fimc_frame *f;
        int ret;