Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-media@vger.kernel.org,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Hans Verkuil <hans@jjverkuil.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 47/76] media: imx-isi: Access v4l2_fh from file
Date: Mon, 11 Aug 2025 11:05:09 -0400	[thread overview]
Message-ID: <aJoGpTJ6xme8TdMV@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20250810013100.29776-48-laurent.pinchart+renesas@ideasonboard.com>

On Sun, Aug 10, 2025 at 04:30:29AM +0300, Laurent Pinchart wrote:
> From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
>
> 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>
> ---

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> Changes since v1:
>
> - Update file-to-ctx macro due to removal of fh-to-ctx macro
> ---
>  .../media/platform/nxp/imx8-isi/imx8-isi-m2m.c  | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 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 31298307c672..5501214cc6c0 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c
> @@ -74,14 +74,9 @@ 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 to_isi_m2m_ctx(file_to_v4l2_fh(filp));
> +	return container_of(file_to_v4l2_fh(filp), struct mxc_isi_m2m_ctx, fh);
>  }
>
>  static inline struct mxc_isi_m2m_ctx_queue_data *
> @@ -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;
>
> --
> Regards,
>
> Laurent Pinchart
>


  reply	other threads:[~2025-08-11 17:35 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250810013100.29776-1-laurent.pinchart+renesas@ideasonboard.com>
2025-08-10  1:29 ` [PATCH v3 08/76] media: Wrap file->private_data access with a helper function Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 09/76] media: Replace file->private_data access with file_to_v4l2_fh() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 37/76] media: meson-ge2d: Access v4l2_fh from file Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 41/76] media: mtk: jpeg: Access v4l2_fh from file->private_data Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 42/76] media: mtk_mdp_m2m: Access v4l2_fh from file Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 43/76] media: mtk: mdp3: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 44/76] media: mtk: vcodec: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 46/76] media: imx-jpeg: " Laurent Pinchart
2025-08-11 15:05   ` Frank Li
2025-08-10  1:30 ` [PATCH v3 47/76] media: imx-isi: " Laurent Pinchart
2025-08-11 15:05   ` Frank Li [this message]
2025-08-10  1:30 ` [PATCH v3 50/76] media: rockhip: rga: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 51/76] media: rockchip: rkvdec: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 52/76] media: exynos-gsc: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 53/76] media: exynos4-is: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 55/76] media: s5p-g2d: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 56/76] media: s5p-jpeg: " Laurent Pinchart
2025-08-12  6:13   ` Andrzej Pietrasiewicz
2025-08-12  7:51     ` Laurent Pinchart
2025-08-13 10:45       ` Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 57/76] media: s5p-mfc: Store s5p_mfc_ctx in vb2_queue.drv_priv Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 58/76] media: s5p-mfc: Access v4l2_fh from file Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 61/76] media: stm32: dma2d: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 68/76] media: staging: imx: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 75/76] media: v4l2: Rename second ioctl handlers argument to 'void *priv' Laurent Pinchart
2025-08-12  5:52   ` Jai Luthra
2025-08-10  1:30 ` [PATCH v3 76/76] media: staging: " Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJoGpTJ6xme8TdMV@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=hans@jjverkuil.nl \
    --cc=imx@lists.linux.dev \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox