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.

While at it, remove the now unused to_isi_m2m_ctx() macro.

Signed-off-by: Jacopo Mondi <jacopo.mo...@ideasonboard.com>
---
 drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c 
b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
index 
850dd8ae95841d4470ac6bd7cb1e54a7510d6d5e..5501214cc6c0ce3e0188ae6d4ff4ae277b975911
 100644
--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
+++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
@@ -74,11 +74,6 @@ to_isi_m2m_buffer(struct vb2_v4l2_buffer *buf)
        return container_of(buf, struct mxc_isi_m2m_buffer, buf.vb);
 }
 
-static inline struct mxc_isi_m2m_ctx *to_isi_m2m_ctx(struct v4l2_fh *fh)
-{
-       return container_of(fh, struct mxc_isi_m2m_ctx, fh);
-}
-
 static inline struct mxc_isi_m2m_ctx *file_to_isi_m2m_ctx(struct file *filp)
 {
        return container_of(file_to_v4l2_fh(filp), struct mxc_isi_m2m_ctx, fh);
@@ -432,7 +427,7 @@ static int mxc_isi_m2m_try_fmt_vid(struct file *file, void 
*fh,
        const enum mxc_isi_video_type type =
                f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
                MXC_ISI_VIDEO_M2M_OUT : MXC_ISI_VIDEO_M2M_CAP;
-       struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
+       struct mxc_isi_m2m_ctx *ctx = file_to_isi_m2m_ctx(file);
 
        __mxc_isi_m2m_try_fmt_vid(ctx, &f->fmt.pix_mp, type);
 
@@ -442,7 +437,7 @@ static int mxc_isi_m2m_try_fmt_vid(struct file *file, void 
*fh,
 static int mxc_isi_m2m_g_fmt_vid(struct file *file, void *fh,
                                 struct v4l2_format *f)
 {
-       struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
+       struct mxc_isi_m2m_ctx *ctx = file_to_isi_m2m_ctx(file);
        const struct mxc_isi_m2m_ctx_queue_data *qdata =
                mxc_isi_m2m_ctx_qdata(ctx, f->type);
 
@@ -457,7 +452,7 @@ static int mxc_isi_m2m_s_fmt_vid(struct file *file, void 
*fh,
        const enum mxc_isi_video_type type =
                f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ?
                MXC_ISI_VIDEO_M2M_OUT : MXC_ISI_VIDEO_M2M_CAP;
-       struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
+       struct mxc_isi_m2m_ctx *ctx = file_to_isi_m2m_ctx(file);
        struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp;
        const struct mxc_isi_format_info *info;
        struct vb2_queue *vq;
@@ -489,7 +484,7 @@ static int mxc_isi_m2m_s_fmt_vid(struct file *file, void 
*fh,
 static int mxc_isi_m2m_streamon(struct file *file, void *fh,
                                enum v4l2_buf_type type)
 {
-       struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
+       struct mxc_isi_m2m_ctx *ctx = file_to_isi_m2m_ctx(file);
        struct mxc_isi_m2m_ctx_queue_data *q = mxc_isi_m2m_ctx_qdata(ctx, type);
        const struct v4l2_pix_format_mplane *out_pix = &ctx->queues.out.format;
        const struct v4l2_pix_format_mplane *cap_pix = &ctx->queues.cap.format;
@@ -577,7 +572,7 @@ static int mxc_isi_m2m_streamon(struct file *file, void *fh,
 static int mxc_isi_m2m_streamoff(struct file *file, void *fh,
                                 enum v4l2_buf_type type)
 {
-       struct mxc_isi_m2m_ctx *ctx = to_isi_m2m_ctx(fh);
+       struct mxc_isi_m2m_ctx *ctx = file_to_isi_m2m_ctx(file);
        struct mxc_isi_m2m_ctx_queue_data *q = mxc_isi_m2m_ctx_qdata(ctx, type);
        struct mxc_isi_m2m *m2m = ctx->m2m;
 

-- 
2.49.0



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

Reply via email to