RE: [EXT] [PATCH 39/65] media: imx-jpeg: Access v4l2_fh from file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




>-----Original Message-----
>From: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
>Sent: Saturday, August 2, 2025 5:23 PM
>To: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>; Devarsh Thakkar
><devarsht@xxxxxx>; Benoit Parrot <bparrot@xxxxxx>; Hans Verkuil
><hverkuil@xxxxxxxxxx>; Mike Isely <isely@xxxxxxxxx>; Laurent Pinchart
><laurent.pinchart@xxxxxxxxxxxxxxxx>; Hans de Goede <hansg@xxxxxxxxxx>;
>Parthiban Veerasooran <parthiban.veerasooran@xxxxxxxxxxxxx>; Christian
>Gromm <christian.gromm@xxxxxxxxxxxxx>; Greg Kroah-Hartman
><gregkh@xxxxxxxxxxxxxxxxxxx>; Alex Shi <alexs@xxxxxxxxxx>; Yanteng Si
><si.yanteng@xxxxxxxxx>; Dongliang Mu <dzm91@xxxxxxxxxxx>; Jonathan
>Corbet <corbet@xxxxxxx>; Tomasz Figa <tfiga@xxxxxxxxxxxx>; Marek
>Szyprowski <m.szyprowski@xxxxxxxxxxx>; Andy Walls
><awalls@xxxxxxxxxxxxxxxx>; Michael Tretter <m.tretter@xxxxxxxxxxxxxx>;
>Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>; Bin Liu
><bin.liu@xxxxxxxxxxxx>; Matthias Brugger <matthias.bgg@xxxxxxxxx>;
>AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>;
>Dmitry Osipenko <digetx@xxxxxxxxx>; Thierry Reding
><thierry.reding@xxxxxxxxx>; Jonathan Hunter <jonathanh@xxxxxxxxxx>;
>Mirela Rabulea <mirela.rabulea@xxxxxxx>; Shawn Guo
><shawnguo@xxxxxxxxxx>; Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>; Fabio
>Estevam <festevam@xxxxxxxxx>; Kieran Bingham
><kieran.bingham+renesas@xxxxxxxxxxxxxxxx>; Michal Simek
><michal.simek@xxxxxxx>; Ming Qian <ming.qian@xxxxxxx>; Eagle Zhou
><eagle.zhou@xxxxxxx>; Xavier Roumegue (OSS)
><xavier.roumegue@xxxxxxxxxxx>; Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>;
>Vikash Garodia <quic_vgarodia@xxxxxxxxxxx>; Dikshita Agarwal
><quic_dikshita@xxxxxxxxxxx>; Abhinav Kumar <abhinav.kumar@xxxxxxxxx>;
>Bryan O'Donoghue <bryan.odonoghue@xxxxxxxxxx>; Sylwester Nawrocki
><sylvester.nawrocki@xxxxxxxxx>; Jernej Skrabec <jernej.skrabec@xxxxxxxxx>;
>Chen-Yu Tsai <wens@xxxxxxxx>; Samuel Holland <samuel@xxxxxxxxxxxx>;
>Daniel Almeida <daniel.almeida@xxxxxxxxxxxxx>; Neil Armstrong
><neil.armstrong@xxxxxxxxxx>; Kevin Hilman <khilman@xxxxxxxxxxxx>; Jerome
>Brunet <jbrunet@xxxxxxxxxxxx>; Martin Blumenstingl
><martin.blumenstingl@xxxxxxxxxxxxxx>; Nas Chung
><nas.chung@xxxxxxxxxxxxxxx>; Jackson Lee
><jackson.lee@xxxxxxxxxxxxxxx>; Minghsiu Tsai
><minghsiu.tsai@xxxxxxxxxxxx>; Houlong Wei <houlong.wei@xxxxxxxxxxxx>;
>Andrew-CT Chen <andrew-ct.chen@xxxxxxxxxxxx>; Tiffany Lin
><tiffany.lin@xxxxxxxxxxxx>; Yunfei Dong <yunfei.dong@xxxxxxxxxxxx>;
>Geert Uytterhoeven <geert+renesas@xxxxxxxxx>; Magnus Damm
><magnus.damm@xxxxxxxxx>; Mikhail Ulyanov
><mikhail.ulyanov@xxxxxxxxxxxxxxxxxx>; Jacob Chen <jacob-
>chen@xxxxxxxxxx>; Ezequiel Garcia <ezequiel@xxxxxxxxxxxxxxxxxxxx>; Heiko
>Stuebner <heiko@xxxxxxxxx>; Detlev Casanova
><detlev.casanova@xxxxxxxxxxxxx>; Krzysztof Kozlowski <krzk@xxxxxxxxxx>;
>Alim Akhtar <alim.akhtar@xxxxxxxxxxx>; Sylwester Nawrocki
><s.nawrocki@xxxxxxxxxxx>; Łukasz Stelmach <l.stelmach@xxxxxxxxxxx>;
>Andrzej Pietrasiewicz <andrzejtp2010@xxxxxxxxx>; Jacek Anaszewski
><jacek.anaszewski@xxxxxxxxx>; Andrzej Hajda <andrzej.hajda@xxxxxxxxx>;
>Fabien Dessenne <fabien.dessenne@xxxxxxxxxxx>; Hugues Fruchet
><hugues.fruchet@xxxxxxxxxxx>; Jean-Christophe Trotin <jean-
>christophe.trotin@xxxxxxxxxxx>; Maxime Coquelin
><mcoquelin.stm32@xxxxxxxxx>; Alexandre Torgue
><alexandre.torgue@xxxxxxxxxxx>; Nicolas Dufresne
><nicolas.dufresne@xxxxxxxxxxxxx>; Benjamin Gaignard
><benjamin.gaignard@xxxxxxxxxxxxx>; Steve Longerbeam
><slongerbeam@xxxxxxxxx>; Maxime Ripard <mripard@xxxxxxxxxx>; Paul
>Kocialkowski <paulk@xxxxxxxxxxx>; Niklas Söderlund
><niklas.soderlund@xxxxxxxxxxxx>; Robert Foss <rfoss@xxxxxxxxxx>; Todor
>Tomov <todor.too@xxxxxxxxx>; Vladimir Zapolskiy
><vladimir.zapolskiy@xxxxxxxxxx>; Corentin Labbe <clabbe@xxxxxxxxxxxx>;
>Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx>; Bingbu Cao
><bingbu.cao@xxxxxxxxx>; Tianshu Qiu <tian.shu.qiu@xxxxxxxxx>; Stanislaw
>Gruszka <stanislaw.gruszka@xxxxxxxxxxxxxxx>
>Cc: linux-media@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; linux-
>staging@xxxxxxxxxxxxxxx; linux-doc@xxxxxxxxxxxxxxx; linux-arm-
>kernel@xxxxxxxxxxxxxxxxxxx; linux-mediatek@xxxxxxxxxxxxxxxxxxx; linux-
>tegra@xxxxxxxxxxxxxxx; imx@xxxxxxxxxxxxxxx; linux-renesas-soc@xxxxxxxxxxxxxxx;
>linux-arm-msm@xxxxxxxxxxxxxxx; linux-samsung-soc@xxxxxxxxxxxxxxx; linux-
>sunxi@xxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; linux-
>amlogic@xxxxxxxxxxxxxxxxxxx; linux-rockchip@xxxxxxxxxxxxxxxxxxx; linux-
>stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx; mjpeg-users@xxxxxxxxxxxxxxxxxxxxx;
>Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>
>Subject: [EXT] [PATCH 39/65] media: imx-jpeg: Access v4l2_fh from file
>
>Caution: This is an external email. Please take care when clicking links or
>opening attachments. When in doubt, report the message using the 'Report
>this email' button
>
>
>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 mxc_jpeg_fh_to_ctx() macro.
>
>Signed-off-by: Jacopo Mondi <jacopo.mondi@xxxxxxxxxxxxxxxx>

Reviewed-by: Ming Qian <ming.qian@xxxxxxxxxxx>

>---
> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 33 +++++++++++--------------
>-
> 1 file changed, 14 insertions(+), 19 deletions(-)
>
>diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>index
>fa7d74d8c1aabd3bf74482e214165d8c1a7e89da..df3ccdf767baf0bf6687808e2c
>017063181a7220 100644
>--- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>+++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c
>@@ -644,11 +644,6 @@ static void print_mxc_buf(struct mxc_jpeg_dev *jpeg,
>struct vb2_buffer *buf,
>        }
> }
>
>-static inline struct mxc_jpeg_ctx *mxc_jpeg_fh_to_ctx(struct v4l2_fh *fh) -{
>-       return container_of(fh, struct mxc_jpeg_ctx, fh);
>-}
>-
> static inline struct mxc_jpeg_ctx *mxc_jpeg_file_to_ctx(struct file *filp)  {
>        return container_of(file_to_v4l2_fh(filp), struct mxc_jpeg_ctx, fh); @@ -
>1610,7 +1605,7 @@ static int mxc_jpeg_decoder_cmd(struct file *file, void
>*priv,
>                                struct v4l2_decoder_cmd *cmd)  {
>        struct v4l2_fh *fh = file_to_v4l2_fh(file);
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        unsigned long flags;
>        int ret;
>
>@@ -1643,7 +1638,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file,
>void *priv,
>                                struct v4l2_encoder_cmd *cmd)  {
>        struct v4l2_fh *fh = file_to_v4l2_fh(file);
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        unsigned long flags;
>        int ret;
>
>@@ -2260,7 +2255,7 @@ static int mxc_jpeg_querycap(struct file *file, void
>*priv,  static int mxc_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
>                                     struct v4l2_fmtdesc *f)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_q_data *q_data = mxc_jpeg_get_q_data(ctx, f->type);
>
>        if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) { @@ -2300,7 +2295,7
>@@ static int mxc_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,  static
>int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
>                                     struct v4l2_fmtdesc *f)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        u32 type = ctx->mxc_jpeg->mode == MXC_JPEG_DECODE ?
>MXC_JPEG_FMT_TYPE_ENC :
>                                                             MXC_JPEG_FMT_TYPE_RAW;
>        int ret;
>@@ -2441,7 +2436,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f,
>static int mxc_jpeg_try_fmt_vid_cap(struct file *file, void *priv,
>                                    struct v4l2_format *f)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_dev *jpeg = ctx->mxc_jpeg;
>        struct device *dev = jpeg->dev;
>        struct mxc_jpeg_q_data tmp_q;
>@@ -2460,7 +2455,7 @@ static int mxc_jpeg_try_fmt_vid_cap(struct file *file,
>void *priv,  static int mxc_jpeg_try_fmt_vid_out(struct file *file, void *priv,
>                                    struct v4l2_format *f)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_dev *jpeg = ctx->mxc_jpeg;
>        struct device *dev = jpeg->dev;
>        struct mxc_jpeg_q_data tmp_q;
>@@ -2512,20 +2507,20 @@ static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx
>*ctx,  static int mxc_jpeg_s_fmt_vid_cap(struct file *file, void *priv,
>                                  struct v4l2_format *f)  {
>-       return mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f);
>+       return mxc_jpeg_s_fmt(mxc_jpeg_file_to_ctx(file), f);
> }
>
> static int mxc_jpeg_s_fmt_vid_out(struct file *file, void *priv,
>                                  struct v4l2_format *f)  {
>        int ret;
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct vb2_queue *dst_vq;
>        struct mxc_jpeg_q_data *q_data_cap;
>        enum v4l2_buf_type cap_type =
>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
>        struct v4l2_format fc;
>
>-       ret = mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f);
>+       ret = mxc_jpeg_s_fmt(ctx, f);
>        if (ret)
>                return ret;
>
>@@ -2554,7 +2549,7 @@ static int mxc_jpeg_s_fmt_vid_out(struct file *file,
>void *priv,  static int mxc_jpeg_g_fmt_vid(struct file *file, void *priv,
>                              struct v4l2_format *f)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_dev *jpeg = ctx->mxc_jpeg;
>        struct device *dev = jpeg->dev;
>        struct v4l2_pix_format_mplane   *pix_mp = &f->fmt.pix_mp;
>@@ -2592,7 +2587,7 @@ static int mxc_jpeg_g_fmt_vid(struct file *file, void
>*priv,
>
> static int mxc_jpeg_dec_g_selection(struct file *file, void *fh, struct
>v4l2_selection *s)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_q_data *q_data_cap;
>
>        if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE && s->type !=
>V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
>@@ -2621,7 +2616,7 @@ static int mxc_jpeg_dec_g_selection(struct file *file,
>void *fh, struct v4l2_sel
>
> static int mxc_jpeg_enc_g_selection(struct file *file, void *fh, struct
>v4l2_selection *s)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_q_data *q_data_out;
>
>        if (s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT && s->type !=
>V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
>@@ -2649,7 +2644,7 @@ static int mxc_jpeg_enc_g_selection(struct file *file,
>void *fh, struct v4l2_sel
>
> static int mxc_jpeg_g_selection(struct file *file, void *fh, struct v4l2_selection
>*s)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>
>        if (ctx->mxc_jpeg->mode == MXC_JPEG_DECODE)
>                return mxc_jpeg_dec_g_selection(file, fh, s); @@ -2659,7 +2654,7 @@
>static int mxc_jpeg_g_selection(struct file *file, void *fh, struct v4l2_selecti
>
> static int mxc_jpeg_s_selection(struct file *file, void *fh, struct v4l2_selection
>*s)  {
>-       struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(fh);
>+       struct mxc_jpeg_ctx *ctx = mxc_jpeg_file_to_ctx(file);
>        struct mxc_jpeg_q_data *q_data_out;
>
>        if (ctx->mxc_jpeg->mode != MXC_JPEG_ENCODE)
>
>--
>2.49.0





[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux for Synopsys ARC Processors]    
  • [Linux on Unisoc (RDA Micro) SoCs]     [Linux Actions SoC]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  •   Powered by Linux