]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: omap3isp: Access v4l2_fh from file
authorJacopo Mondi <jacopo.mondi@ideasonboard.com>
Sun, 10 Aug 2025 01:30:45 +0000 (04:30 +0300)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Wed, 13 Aug 2025 06:33:54 +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.

While at it remove the only left user of to_isp_video_fh() and remove
the macro completely.

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/ti/omap3isp/ispvideo.c
drivers/media/platform/ti/omap3isp/ispvideo.h

index 2c0008444b7e2b532c9af061760e7399cdf3e45d..0e7f0bf2b3463b7ef6678f7bd836a952e0b707a7 100644 (file)
@@ -657,7 +657,7 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
 static int
 isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
 
        if (format->type != video->type)
@@ -673,7 +673,7 @@ isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
 static int
 isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        struct v4l2_mbus_framefmt fmt;
 
@@ -858,7 +858,7 @@ isp_video_set_selection(struct file *file, void *fh, struct v4l2_selection *sel)
 static int
 isp_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
 
        if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
@@ -876,7 +876,7 @@ isp_video_get_param(struct file *file, void *fh, struct v4l2_streamparm *a)
 static int
 isp_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
 
        if (video->type != V4L2_BUF_TYPE_VIDEO_OUTPUT ||
@@ -894,7 +894,7 @@ isp_video_set_param(struct file *file, void *fh, struct v4l2_streamparm *a)
 static int
 isp_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        int ret;
 
@@ -908,7 +908,7 @@ isp_video_reqbufs(struct file *file, void *fh, struct v4l2_requestbuffers *rb)
 static int
 isp_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        int ret;
 
@@ -922,7 +922,7 @@ isp_video_querybuf(struct file *file, void *fh, struct v4l2_buffer *b)
 static int
 isp_video_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        int ret;
 
@@ -936,7 +936,7 @@ isp_video_qbuf(struct file *file, void *fh, struct v4l2_buffer *b)
 static int
 isp_video_dqbuf(struct file *file, void *fh, struct v4l2_buffer *b)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        int ret;
 
@@ -1074,7 +1074,7 @@ static int isp_video_check_external_subdevs(struct isp_video *video,
 static int
 isp_video_streamon(struct file *file, void *fh, enum v4l2_buf_type type)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        enum isp_pipeline_state state;
        struct isp_pipeline *pipe;
@@ -1180,7 +1180,7 @@ err_enum_init:
 static int
 isp_video_streamoff(struct file *file, void *fh, enum v4l2_buf_type type)
 {
-       struct isp_video_fh *vfh = to_isp_video_fh(fh);
+       struct isp_video_fh *vfh = file_to_isp_video_fh(file);
        struct isp_video *video = video_drvdata(file);
        struct isp_pipeline *pipe = to_isp_pipeline(&video->video.entity);
        enum isp_pipeline_state state;
@@ -1348,7 +1348,7 @@ static int isp_video_release(struct file *file)
 {
        struct isp_video *video = video_drvdata(file);
        struct v4l2_fh *vfh = file_to_v4l2_fh(file);
-       struct isp_video_fh *handle = to_isp_video_fh(vfh);
+       struct isp_video_fh *handle = file_to_isp_video_fh(file);
 
        /* Disable streaming and free the buffers queue resources. */
        isp_video_streamoff(file, vfh, video->type);
index 4364b4b14fb451b24e97630f21c04100d1704aa3..537da59cff6258cb66ff4eac6ad2739c3f9465c4 100644 (file)
@@ -194,11 +194,9 @@ struct isp_video_fh {
        struct v4l2_fract timeperframe;
 };
 
-#define to_isp_video_fh(fh)    container_of(fh, struct isp_video_fh, vfh)
-
 static inline struct isp_video_fh *file_to_isp_video_fh(struct file *filp)
 {
-       return to_isp_video_fh(file_to_v4l2_fh(filp));
+       return container_of(file_to_v4l2_fh(filp), struct isp_video_fh, vfh);
 }
 
 #define isp_video_queue_to_isp_video_fh(q) \