From: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
To: Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
linux-media <linux-media@vger.kernel.org>
Subject: Re: [PATCH 49/65] media: s5p-jpeg: Access v4l2_fh from file
Date: Sun, 3 Aug 2025 20:02:00 +0200 [thread overview]
Message-ID: <c52ec06e-e4b5-4f7d-af13-0e2b712307fe@gmail.com> (raw)
In-Reply-To: <20250802-media-private-data-v1-49-eb140ddd6a9d@ideasonboard.com>
Hi Jacopo,
W dniu 2.08.2025 o 11:23, Jacopo Mondi pisze:
> 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 fh_to_ctx() macro.
>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
> ---
> .../media/platform/samsung/s5p-jpeg/jpeg-core.c | 25 +++++++++-------------
> 1 file changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> index 2a57efd181540183e7d2b66d51f9f2f274ddd100..81792f7f8b1671dba2023f99b2779784d9a14b8c 100644
> --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c
> @@ -580,11 +580,6 @@ 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 container_of(file_to_v4l2_fh(filp), struct s5p_jpeg_ctx, fh);
> @@ -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);
>
> 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)
>
next prev parent reply other threads:[~2025-08-03 18:02 UTC|newest]
Thread overview: 102+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-02 9:22 [PATCH 00/65] media: Rationalise usage of v4l2_fh Jacopo Mondi
2025-08-02 9:22 ` [PATCH 01/65] media: pci: saa7164: Store v4l2_fh pointer in file->private_data Jacopo Mondi
2025-08-02 9:22 ` [PATCH 02/65] media: imagination: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 03/65] media: ti: vpe: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 04/65] media: usb: hdpvr: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 05/65] media: usb: pvrusb2: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 06/65] media: usb: uvcvideo: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 07/65] media: staging: most: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 08/65] media: Wrap file->private_data access with a helper function Jacopo Mondi
2025-08-02 9:22 ` [PATCH 09/65] media: Replace file->private_data access with file_to_v4l2_fh() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 10/65] media: nvidia: tegra-vde: Replace file->private_data access Jacopo Mondi
2025-08-02 9:22 ` [PATCH 11/65] media: Replace file->private_data access with custom functions Jacopo Mondi
2025-08-06 8:16 ` Hans Verkuil
2025-08-06 9:48 ` Laurent Pinchart
2025-08-06 10:23 ` Hans Verkuil
2025-08-18 14:10 ` Lukasz Stelmach
2025-08-02 9:22 ` [PATCH 12/65] media: pci: ivtv: Don't create fake v4l2_fh Jacopo Mondi
2025-08-02 9:22 ` [PATCH 13/65] media: amphion: Make some vpu_v4l2 functions static Jacopo Mondi
2025-08-05 1:34 ` [EXT] " Ming Qian
2025-08-02 9:22 ` [PATCH 14/65] media: amphion: Delete v4l2_fh synchronously in .release() Jacopo Mondi
2025-08-05 1:43 ` [EXT] " Ming Qian
2025-08-02 9:22 ` [PATCH 15/65] media: visl: Drop visl_v4l2fh_to_ctx() function Jacopo Mondi
2025-08-02 9:22 ` [PATCH 16/65] media: v4l2-fh: Move piece of documentation to correct function Jacopo Mondi
2025-08-02 9:22 ` [PATCH 17/65] media: rcar-vin: Do not set file->private_data Jacopo Mondi
2025-08-02 13:26 ` Niklas Söderlund
2025-08-02 9:22 ` [PATCH 18/65] media: rzg2l-cru: " Jacopo Mondi
2025-08-04 10:01 ` Tommaso Merciai
2025-08-02 9:22 ` [PATCH 19/65] media: camss: Replace .open() file operation with v4l2_fh_open() Jacopo Mondi
2025-08-24 19:04 ` Vladimir Zapolskiy
2025-08-02 9:22 ` [PATCH 20/65] media: camss: Remove custom .release fop() Jacopo Mondi
2025-08-24 19:07 ` Vladimir Zapolskiy
2025-08-02 9:22 ` [PATCH 21/65] media: chips-media: wave5: Pass file pointer to wave5_cleanup_instance() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 22/65] media: qcom: iris: Pass file pointer to iris_v4l2_fh_(de)init() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 23/65] media: qcom: iris: Set file->private_data in iris_v4l2_fh_(de)init() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 24/65] media: qcom: iris: Drop unused argument to iris_get_inst() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 25/65] media: qcom: venus: Pass file pointer to venus_close_common() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 26/65] media: Set file->private_data in v4l2_fh_add() Jacopo Mondi
2025-08-02 9:22 ` [PATCH 27/65] media: Reset file->private_data to NULL in v4l2_fh_del() Jacopo Mondi
2025-08-06 12:45 ` Hans Verkuil
2025-08-07 8:50 ` Laurent Pinchart
2025-08-07 17:00 ` Laurent Pinchart
2025-08-07 20:25 ` Laurent Pinchart
2025-08-07 20:51 ` Hans Verkuil
2025-08-08 6:30 ` Laurent Pinchart
2025-08-18 14:12 ` Lukasz Stelmach
2025-08-02 9:22 ` [PATCH 28/65] media: v4l2-ioctl: Access v4l2_fh from private_data Jacopo Mondi
2025-08-02 9:22 ` [PATCH 29/65] media: allegro: Access v4l2_fh from file Jacopo Mondi
2025-08-05 7:39 ` Michael Tretter
2025-08-02 9:22 ` [PATCH 30/65] media: meson-ge2d: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 31/65] media: coda: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 32/65] media: wave5: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 33/65] media: m2m-deinterlace: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 34/65] media: mtk: jpeg: Access v4l2_fh from file->private_data Jacopo Mondi
2025-08-02 9:22 ` [PATCH 35/65] media: mtk_mdp_m2m: Access v4l2_fh from file Jacopo Mondi
2025-08-02 9:22 ` [PATCH 36/65] media: mtk: mdp3: " Jacopo Mondi
2025-08-02 9:22 ` [PATCH 37/65] media: mtk: vcodec: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 38/65] media: tegra-vde: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 39/65] media: imx-jpeg: " Jacopo Mondi
2025-08-05 1:58 ` [EXT] " Ming Qian
2025-08-02 9:23 ` [PATCH 40/65] media: imx-isi: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 41/65] media: nxp: mx2: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 42/65] media: renesas: " Jacopo Mondi
2025-08-05 9:59 ` Kieran Bingham
2025-08-02 9:23 ` [PATCH 43/65] media: rockhip: rga: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 44/65] media: rockchip: rkvdec: " Jacopo Mondi
2025-08-02 16:02 ` Detlev Casanova
2025-08-02 9:23 ` [PATCH 45/65] media: exynos-gsc: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 46/65] media: exynos4-is: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 47/65] media: s3c-camif: Set queue owner using file Jacopo Mondi
2025-08-02 9:23 ` [PATCH 48/65] media: s5p-g2d: Access v4l2_fh from file Jacopo Mondi
2025-08-02 9:23 ` [PATCH 49/65] media: s5p-jpeg: " Jacopo Mondi
2025-08-03 18:02 ` Andrzej Pietrasiewicz [this message]
2025-08-02 9:23 ` [PATCH 50/65] media: s5p-mfc: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 51/65] media: bdisp: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 52/65] media: st: delta: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 53/65] media: stm32: dma2d: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 54/65] media: hantro: Access v4l2_fh from file->private_data Jacopo Mondi
2025-08-04 21:59 ` Paul Kocialkowski
2025-08-02 9:23 ` [PATCH 55/65] media: omap3isp: Access v4l2_fh from file Jacopo Mondi
2025-08-02 9:23 ` [PATCH 56/65] media: cx18: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 57/65] media: ivtv: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 58/65] media: zoran: Remove access to __fh Jacopo Mondi
2025-08-07 6:58 ` Hans Verkuil
2025-08-07 12:31 ` Laurent Pinchart
2025-08-07 13:18 ` Hans Verkuil
2025-08-02 9:23 ` [PATCH 59/65] media: usb: hdpvr: Access v4l2_fh from file Jacopo Mondi
2025-08-02 9:23 ` [PATCH 60/65] media: usb: uvc: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 61/65] media: staging: imx: " Jacopo Mondi
2025-08-02 9:23 ` [PATCH 62/65] media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check Jacopo Mondi
2025-08-02 9:23 ` [PATCH 63/65] media: ipu6: isys: Don't set V4L2_FL_USES_V4L2_FH manually Jacopo Mondi
2025-08-08 1:01 ` Cao, Bingbu
2025-08-08 7:22 ` Sakari Ailus
2025-08-02 9:23 ` [PATCH 64/65] media: staging: ipu7: " Jacopo Mondi
2025-08-07 9:07 ` Sakari Ailus
2025-08-07 17:01 ` Laurent Pinchart
2025-08-08 7:22 ` Sakari Ailus
2025-08-02 9:23 ` [PATCH 65/65] media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers Jacopo Mondi
2025-08-07 7:26 ` Hans Verkuil
2025-08-07 7:58 ` Hans Verkuil
2025-08-07 20:33 ` Laurent Pinchart
2025-08-07 20:55 ` Hans Verkuil
2025-08-08 7:00 ` 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=c52ec06e-e4b5-4f7d-af13-0e2b712307fe@gmail.com \
--to=andrzejtp2010@gmail.com \
--cc=jacopo.mondi@ideasonboard.com \
--cc=linux-media@vger.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;
as well as URLs for NNTP newsgroup(s).