All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org
Cc: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Hans Verkuil <hans@jjverkuil.nl>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 56/76] media: s5p-jpeg: Access v4l2_fh from file
Date: Tue, 12 Aug 2025 08:13:39 +0200	[thread overview]
Message-ID: <b6f75a41-d5bb-46c7-966d-eeb1d47736e5@gmail.com> (raw)
In-Reply-To: <20250810013100.29776-57-laurent.pinchart+renesas@ideasonboard.com>

Hi Laurent & Jacopo,

Thanks for taking care of this, this generally looks good to me,
but please see inline.

W dniu 10.08.2025 o 03:30, Laurent Pinchart pisze:
> 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>
> Reviewed-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
> Co-developed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> Changes since v1:
> 
> - Update file-to-ctx macro due to removal of fh-to-ctx macro
> ---
>   .../platform/samsung/s5p-jpeg/jpeg-core.c     | 27 ++++++++-----------
>   1 file changed, 11 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> index 65f256db4c76..81792f7f8b16 100644
> --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> @@ -580,14 +580,9 @@ static inline struct s5p_jpeg_ctx *ctrl_to_ctx(struct v4l2_ctrl *c)
>   	return container_of(c->handler, struct s5p_jpeg_ctx, ctrl_handler);
>   }
>   
> -static inline struct s5p_jpeg_ctx *fh_to_ctx(struct v4l2_fh *fh)
> -{
> -	return container_of(fh, struct s5p_jpeg_ctx, fh);
> -}
> -
>   static inline struct s5p_jpeg_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 s5p_jpeg_ctx, fh);
>   }
>   
>   static int s5p_jpeg_to_user_subsampling(struct s5p_jpeg_ctx *ctx)
> @@ -1015,8 +1010,8 @@ static int s5p_jpeg_open(struct file *file)
>   
>   static int s5p_jpeg_release(struct file *file)
>   {
> -	struct s5p_jpeg *jpeg = video_drvdata(file);
>   	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
> +	struct s5p_jpeg *jpeg = video_drvdata(file);

What is the purpose of this change?

Regards,

Andrzej

>   
>   	mutex_lock(&jpeg->lock);
>   	v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
> @@ -1253,7 +1248,7 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
>   static int s5p_jpeg_querycap(struct file *file, void *priv,
>   			   struct v4l2_capability *cap)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   
>   	if (ctx->mode == S5P_JPEG_ENCODE) {
>   		strscpy(cap->driver, S5P_JPEG_M2M_NAME,
> @@ -1301,7 +1296,7 @@ static int enum_fmt(struct s5p_jpeg_ctx *ctx,
>   static int s5p_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
>   				   struct v4l2_fmtdesc *f)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   
>   	if (ctx->mode == S5P_JPEG_ENCODE)
>   		return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f,
> @@ -1314,7 +1309,7 @@ static int s5p_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
>   static int s5p_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
>   				   struct v4l2_fmtdesc *f)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   
>   	if (ctx->mode == S5P_JPEG_ENCODE)
>   		return enum_fmt(ctx, sjpeg_formats, SJPEG_NUM_FORMATS, f,
> @@ -1340,7 +1335,7 @@ static int s5p_jpeg_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
>   	struct vb2_queue *vq;
>   	struct s5p_jpeg_q_data *q_data = NULL;
>   	struct v4l2_pix_format *pix = &f->fmt.pix;
> -	struct s5p_jpeg_ctx *ct = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ct = file_to_ctx(file);
>   
>   	vq = v4l2_m2m_get_vq(ct->fh.m2m_ctx, f->type);
>   	if (!vq)
> @@ -1480,7 +1475,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct s5p_jpeg_fmt *fmt,
>   static int s5p_jpeg_try_fmt_vid_cap(struct file *file, void *priv,
>   				  struct v4l2_format *f)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   	struct v4l2_pix_format *pix = &f->fmt.pix;
>   	struct s5p_jpeg_fmt *fmt;
>   	int ret;
> @@ -1539,7 +1534,7 @@ static int s5p_jpeg_try_fmt_vid_cap(struct file *file, void *priv,
>   static int s5p_jpeg_try_fmt_vid_out(struct file *file, void *priv,
>   				  struct v4l2_format *f)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   	struct s5p_jpeg_fmt *fmt;
>   
>   	fmt = s5p_jpeg_find_format(ctx, f->fmt.pix.pixelformat,
> @@ -1686,7 +1681,7 @@ static int s5p_jpeg_s_fmt_vid_cap(struct file *file, void *priv,
>   	if (ret)
>   		return ret;
>   
> -	return s5p_jpeg_s_fmt(fh_to_ctx(priv), f);
> +	return s5p_jpeg_s_fmt(file_to_ctx(file), f);
>   }
>   
>   static int s5p_jpeg_s_fmt_vid_out(struct file *file, void *priv,
> @@ -1698,7 +1693,7 @@ static int s5p_jpeg_s_fmt_vid_out(struct file *file, void *priv,
>   	if (ret)
>   		return ret;
>   
> -	return s5p_jpeg_s_fmt(fh_to_ctx(priv), f);
> +	return s5p_jpeg_s_fmt(file_to_ctx(file), f);
>   }
>   
>   static int s5p_jpeg_subscribe_event(struct v4l2_fh *fh,
> @@ -1795,7 +1790,7 @@ static int exynos3250_jpeg_try_crop(struct s5p_jpeg_ctx *ctx,
>   static int s5p_jpeg_g_selection(struct file *file, void *priv,
>   			 struct v4l2_selection *s)
>   {
> -	struct s5p_jpeg_ctx *ctx = fh_to_ctx(priv);
> +	struct s5p_jpeg_ctx *ctx = file_to_ctx(file);
>   
>   	if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT &&
>   	    s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)



  reply	other threads:[~2025-08-12  7:30 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10  1:29 [PATCH v3 00/76] media: Rationalise usage of v4l2_fh Laurent Pinchart
2025-08-10  1:29 ` Laurent Pinchart
2025-08-10  1:29 ` Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 01/76] media: pci: saa7164: Store v4l2_fh pointer in file->private_data Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 02/76] media: imagination: " Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 03/76] media: ti: vpe: " Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 04/76] media: usb: hdpvr: " Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 05/76] media: usb: pvrusb2: " Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 06/76] media: usb: uvcvideo: " Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 07/76] media: staging: most: " Laurent Pinchart
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:29 ` [PATCH v3 10/76] media: nvidia: tegra-vde: Replace file->private_data access Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 11/76] media: Replace file->private_data access with custom functions Laurent Pinchart
2025-08-10  1:29   ` Laurent Pinchart
2025-08-10  1:29   ` Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 12/76] media: pci: ivtv: Don't create fake v4l2_fh Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 13/76] media: amphion: Make some vpu_v4l2 functions static Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 14/76] media: amphion: Delete v4l2_fh synchronously in .release() Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 15/76] media: visl: Drop visl_v4l2fh_to_ctx() function Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 16/76] media: v4l2-fh: Move piece of documentation to correct function Laurent Pinchart
2025-08-10  1:29 ` [PATCH v3 17/76] media: rcar-vin: Do not set file->private_data Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 18/76] media: rzg2l-cru: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 19/76] media: camss: Replace .open() file operation with v4l2_fh_open() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 20/76] media: camss: Remove custom .release fop() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 21/76] media: chips-media: wave5: Pass file pointer to wave5_cleanup_instance() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 22/76] media: qcom: iris: Pass file pointer to iris_v4l2_fh_(de)init() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 23/76] media: qcom: iris: Set file->private_data in iris_v4l2_fh_(de)init() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 24/76] media: qcom: iris: Drop unused argument to iris_get_inst() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 25/76] media: qcom: venus: Pass file pointer to venus_close_common() Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 26/76] media: Set file->private_data in v4l2_fh_add() Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 27/76] media: Reset file->private_data to NULL in v4l2_fh_del() Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 28/76] media: ipu6: isys: Don't set V4L2_FL_USES_V4L2_FH manually Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 29/76] media: staging: ipu7: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 30/76] media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 31/76] media: v4l2-dev: Make open and release file operations mandatory Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 32/76] media: Drop V4L2_FL_USES_V4L2_FH checks Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 33/76] media: zoran: Remove zoran_fh structure Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 34/76] media: zoran: Rename __fh to fh Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 35/76] media: v4l2-ioctl: Access v4l2_fh from private_data Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 36/76] media: allegro: Access v4l2_fh from file Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 37/76] media: meson-ge2d: " Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 38/76] media: coda: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 39/76] media: wave5: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 40/76] media: m2m-deinterlace: " 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 45/76] media: tegra-vde: " 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
2025-08-10  1:30 ` [PATCH v3 48/76] media: nxp: mx2: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 49/76] media: renesas: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 50/76] media: rockhip: rga: " Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 51/76] media: rockchip: rkvdec: " Laurent Pinchart
2025-08-10  1:30   ` 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 54/76] media: s3c-camif: " 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 [this message]
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 59/76] media: bdisp: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 60/76] media: st: delta: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 61/76] media: stm32: dma2d: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 62/76] media: hantro: Access v4l2_fh from file->private_data Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-11 14:36   ` Nicolas Dufresne
2025-08-11 14:36     ` Nicolas Dufresne
2025-08-10  1:30 ` [PATCH v3 63/76] media: omap3isp: Access v4l2_fh from file Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 64/76] media: cx18: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 65/76] media: ivtv: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 66/76] media: usb: hdpvr: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 67/76] media: usb: uvc: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 68/76] media: staging: imx: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 69/76] media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 70/76] media: v4l2-ioctl: Push NULL fh argument down to ioctl wrappers Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 71/76] media: test-drivers: Rename second ioctl handlers argument to 'void *priv' Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 72/76] media: uvcvideo: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 73/76] media: v4l2-pci-skeleton: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 74/76] media: v4l2-core: " Laurent Pinchart
2025-08-10  1:30 ` [PATCH v3 75/76] media: v4l2: " Laurent Pinchart
2025-08-10  1:30   ` Laurent Pinchart
2025-08-12  5:52   ` Jai Luthra
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=b6f75a41-d5bb-46c7-966d-eeb1d47736e5@gmail.com \
    --to=andrzejtp2010@gmail.com \
    --cc=hans@jjverkuil.nl \
    --cc=jacek.anaszewski@gmail.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --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.nawrocki@samsung.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.