[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<PAXPR04MB82541D50F538EECA4EE244BFE722A@PAXPR04MB8254.eurprd04.prod.outlook.com>
Date: Tue, 5 Aug 2025 01:58:01 +0000
From: Ming Qian <ming.qian@....com>
To: Jacopo Mondi <jacopo.mondi@...asonboard.com>, Mauro Carvalho Chehab
<mchehab@...nel.org>, Devarsh Thakkar <devarsht@...com>, Benoit Parrot
<bparrot@...com>, Hans Verkuil <hverkuil@...nel.org>, Mike Isely
<isely@...ox.com>, Laurent Pinchart <laurent.pinchart@...asonboard.com>, Hans
de Goede <hansg@...nel.org>, Parthiban Veerasooran
<parthiban.veerasooran@...rochip.com>, Christian Gromm
<christian.gromm@...rochip.com>, Greg Kroah-Hartman
<gregkh@...uxfoundation.org>, Alex Shi <alexs@...nel.org>, Yanteng Si
<si.yanteng@...ux.dev>, Dongliang Mu <dzm91@...t.edu.cn>, Jonathan Corbet
<corbet@....net>, Tomasz Figa <tfiga@...omium.org>, Marek Szyprowski
<m.szyprowski@...sung.com>, Andy Walls <awalls@...metrocast.net>, Michael
Tretter <m.tretter@...gutronix.de>, Pengutronix Kernel Team
<kernel@...gutronix.de>, Bin Liu <bin.liu@...iatek.com>, Matthias Brugger
<matthias.bgg@...il.com>, AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>, Dmitry Osipenko
<digetx@...il.com>, Thierry Reding <thierry.reding@...il.com>, Jonathan
Hunter <jonathanh@...dia.com>, Mirela Rabulea <mirela.rabulea@....com>, Shawn
Guo <shawnguo@...nel.org>, Sascha Hauer <s.hauer@...gutronix.de>, Fabio
Estevam <festevam@...il.com>, Kieran Bingham
<kieran.bingham+renesas@...asonboard.com>, Michal Simek
<michal.simek@....com>, Eagle Zhou <eagle.zhou@....com>, "Xavier Roumegue
(OSS)" <xavier.roumegue@....nxp.com>, Philipp Zabel <p.zabel@...gutronix.de>,
Vikash Garodia <quic_vgarodia@...cinc.com>, Dikshita Agarwal
<quic_dikshita@...cinc.com>, Abhinav Kumar <abhinav.kumar@...ux.dev>, Bryan
O'Donoghue <bryan.odonoghue@...aro.org>, Sylwester Nawrocki
<sylvester.nawrocki@...il.com>, Jernej Skrabec <jernej.skrabec@...il.com>,
Chen-Yu Tsai <wens@...e.org>, Samuel Holland <samuel@...lland.org>, Daniel
Almeida <daniel.almeida@...labora.com>, Neil Armstrong
<neil.armstrong@...aro.org>, Kevin Hilman <khilman@...libre.com>, Jerome
Brunet <jbrunet@...libre.com>, Martin Blumenstingl
<martin.blumenstingl@...glemail.com>, Nas Chung <nas.chung@...psnmedia.com>,
Jackson Lee <jackson.lee@...psnmedia.com>, Minghsiu Tsai
<minghsiu.tsai@...iatek.com>, Houlong Wei <houlong.wei@...iatek.com>,
Andrew-CT Chen <andrew-ct.chen@...iatek.com>, Tiffany Lin
<tiffany.lin@...iatek.com>, Yunfei Dong <yunfei.dong@...iatek.com>, Geert
Uytterhoeven <geert+renesas@...der.be>, Magnus Damm <magnus.damm@...il.com>,
Mikhail Ulyanov <mikhail.ulyanov@...entembedded.com>, Jacob Chen
<jacob-chen@...wrt.com>, Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
Heiko Stuebner <heiko@...ech.de>, Detlev Casanova
<detlev.casanova@...labora.com>, Krzysztof Kozlowski <krzk@...nel.org>, Alim
Akhtar <alim.akhtar@...sung.com>, Sylwester Nawrocki
<s.nawrocki@...sung.com>, Łukasz Stelmach
<l.stelmach@...sung.com>, Andrzej Pietrasiewicz <andrzejtp2010@...il.com>,
Jacek Anaszewski <jacek.anaszewski@...il.com>, Andrzej Hajda
<andrzej.hajda@...el.com>, Fabien Dessenne <fabien.dessenne@...s.st.com>,
Hugues Fruchet <hugues.fruchet@...s.st.com>, Jean-Christophe Trotin
<jean-christophe.trotin@...s.st.com>, Maxime Coquelin
<mcoquelin.stm32@...il.com>, Alexandre Torgue <alexandre.torgue@...s.st.com>,
Nicolas Dufresne <nicolas.dufresne@...labora.com>, Benjamin Gaignard
<benjamin.gaignard@...labora.com>, Steve Longerbeam <slongerbeam@...il.com>,
Maxime Ripard <mripard@...nel.org>, Paul Kocialkowski <paulk@...-base.io>,
Niklas Söderlund <niklas.soderlund@...natech.se>, Robert
Foss <rfoss@...nel.org>, Todor Tomov <todor.too@...il.com>, Vladimir
Zapolskiy <vladimir.zapolskiy@...aro.org>, Corentin Labbe
<clabbe@...libre.com>, Sakari Ailus <sakari.ailus@...ux.intel.com>, Bingbu
Cao <bingbu.cao@...el.com>, Tianshu Qiu <tian.shu.qiu@...el.com>, Stanislaw
Gruszka <stanislaw.gruszka@...ux.intel.com>
CC: "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>, "linux-tegra@...r.kernel.org"
<linux-tegra@...r.kernel.org>, "imx@...ts.linux.dev" <imx@...ts.linux.dev>,
"linux-renesas-soc@...r.kernel.org" <linux-renesas-soc@...r.kernel.org>,
"linux-arm-msm@...r.kernel.org" <linux-arm-msm@...r.kernel.org>,
"linux-samsung-soc@...r.kernel.org" <linux-samsung-soc@...r.kernel.org>,
"linux-sunxi@...ts.linux.dev" <linux-sunxi@...ts.linux.dev>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-amlogic@...ts.infradead.org" <linux-amlogic@...ts.infradead.org>,
"linux-rockchip@...ts.infradead.org" <linux-rockchip@...ts.infradead.org>,
"linux-stm32@...md-mailman.stormreply.com"
<linux-stm32@...md-mailman.stormreply.com>,
"mjpeg-users@...ts.sourceforge.net" <mjpeg-users@...ts.sourceforge.net>
Subject: RE: [EXT] [PATCH 39/65] media: imx-jpeg: Access v4l2_fh from file
>-----Original Message-----
>From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
>Sent: Saturday, August 2, 2025 5:23 PM
>To: Mauro Carvalho Chehab <mchehab@...nel.org>; Devarsh Thakkar
><devarsht@...com>; Benoit Parrot <bparrot@...com>; Hans Verkuil
><hverkuil@...nel.org>; Mike Isely <isely@...ox.com>; Laurent Pinchart
><laurent.pinchart@...asonboard.com>; Hans de Goede <hansg@...nel.org>;
>Parthiban Veerasooran <parthiban.veerasooran@...rochip.com>; Christian
>Gromm <christian.gromm@...rochip.com>; Greg Kroah-Hartman
><gregkh@...uxfoundation.org>; Alex Shi <alexs@...nel.org>; Yanteng Si
><si.yanteng@...ux.dev>; Dongliang Mu <dzm91@...t.edu.cn>; Jonathan
>Corbet <corbet@....net>; Tomasz Figa <tfiga@...omium.org>; Marek
>Szyprowski <m.szyprowski@...sung.com>; Andy Walls
><awalls@...metrocast.net>; Michael Tretter <m.tretter@...gutronix.de>;
>Pengutronix Kernel Team <kernel@...gutronix.de>; Bin Liu
><bin.liu@...iatek.com>; Matthias Brugger <matthias.bgg@...il.com>;
>AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>;
>Dmitry Osipenko <digetx@...il.com>; Thierry Reding
><thierry.reding@...il.com>; Jonathan Hunter <jonathanh@...dia.com>;
>Mirela Rabulea <mirela.rabulea@....com>; Shawn Guo
><shawnguo@...nel.org>; Sascha Hauer <s.hauer@...gutronix.de>; Fabio
>Estevam <festevam@...il.com>; Kieran Bingham
><kieran.bingham+renesas@...asonboard.com>; Michal Simek
><michal.simek@....com>; Ming Qian <ming.qian@....com>; Eagle Zhou
><eagle.zhou@....com>; Xavier Roumegue (OSS)
><xavier.roumegue@....nxp.com>; Philipp Zabel <p.zabel@...gutronix.de>;
>Vikash Garodia <quic_vgarodia@...cinc.com>; Dikshita Agarwal
><quic_dikshita@...cinc.com>; Abhinav Kumar <abhinav.kumar@...ux.dev>;
>Bryan O'Donoghue <bryan.odonoghue@...aro.org>; Sylwester Nawrocki
><sylvester.nawrocki@...il.com>; Jernej Skrabec <jernej.skrabec@...il.com>;
>Chen-Yu Tsai <wens@...e.org>; Samuel Holland <samuel@...lland.org>;
>Daniel Almeida <daniel.almeida@...labora.com>; Neil Armstrong
><neil.armstrong@...aro.org>; Kevin Hilman <khilman@...libre.com>; Jerome
>Brunet <jbrunet@...libre.com>; Martin Blumenstingl
><martin.blumenstingl@...glemail.com>; Nas Chung
><nas.chung@...psnmedia.com>; Jackson Lee
><jackson.lee@...psnmedia.com>; Minghsiu Tsai
><minghsiu.tsai@...iatek.com>; Houlong Wei <houlong.wei@...iatek.com>;
>Andrew-CT Chen <andrew-ct.chen@...iatek.com>; Tiffany Lin
><tiffany.lin@...iatek.com>; Yunfei Dong <yunfei.dong@...iatek.com>;
>Geert Uytterhoeven <geert+renesas@...der.be>; Magnus Damm
><magnus.damm@...il.com>; Mikhail Ulyanov
><mikhail.ulyanov@...entembedded.com>; Jacob Chen <jacob-
>chen@...wrt.com>; Ezequiel Garcia <ezequiel@...guardiasur.com.ar>; Heiko
>Stuebner <heiko@...ech.de>; Detlev Casanova
><detlev.casanova@...labora.com>; Krzysztof Kozlowski <krzk@...nel.org>;
>Alim Akhtar <alim.akhtar@...sung.com>; Sylwester Nawrocki
><s.nawrocki@...sung.com>; Łukasz Stelmach <l.stelmach@...sung.com>;
>Andrzej Pietrasiewicz <andrzejtp2010@...il.com>; Jacek Anaszewski
><jacek.anaszewski@...il.com>; Andrzej Hajda <andrzej.hajda@...el.com>;
>Fabien Dessenne <fabien.dessenne@...s.st.com>; Hugues Fruchet
><hugues.fruchet@...s.st.com>; Jean-Christophe Trotin <jean-
>christophe.trotin@...s.st.com>; Maxime Coquelin
><mcoquelin.stm32@...il.com>; Alexandre Torgue
><alexandre.torgue@...s.st.com>; Nicolas Dufresne
><nicolas.dufresne@...labora.com>; Benjamin Gaignard
><benjamin.gaignard@...labora.com>; Steve Longerbeam
><slongerbeam@...il.com>; Maxime Ripard <mripard@...nel.org>; Paul
>Kocialkowski <paulk@...-base.io>; Niklas Söderlund
><niklas.soderlund@...natech.se>; Robert Foss <rfoss@...nel.org>; Todor
>Tomov <todor.too@...il.com>; Vladimir Zapolskiy
><vladimir.zapolskiy@...aro.org>; Corentin Labbe <clabbe@...libre.com>;
>Sakari Ailus <sakari.ailus@...ux.intel.com>; Bingbu Cao
><bingbu.cao@...el.com>; Tianshu Qiu <tian.shu.qiu@...el.com>; Stanislaw
>Gruszka <stanislaw.gruszka@...ux.intel.com>
>Cc: linux-media@...r.kernel.org; linux-kernel@...r.kernel.org; linux-
>staging@...ts.linux.dev; linux-doc@...r.kernel.org; linux-arm-
>kernel@...ts.infradead.org; linux-mediatek@...ts.infradead.org; linux-
>tegra@...r.kernel.org; imx@...ts.linux.dev; linux-renesas-soc@...r.kernel.org;
>linux-arm-msm@...r.kernel.org; linux-samsung-soc@...r.kernel.org; linux-
>sunxi@...ts.linux.dev; linux-usb@...r.kernel.org; linux-
>amlogic@...ts.infradead.org; linux-rockchip@...ts.infradead.org; linux-
>stm32@...md-mailman.stormreply.com; mjpeg-users@...ts.sourceforge.net;
>Jacopo Mondi <jacopo.mondi@...asonboard.com>
>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@...asonboard.com>
Reviewed-by: Ming Qian <ming.qian@....nxp.com>
>---
> 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
Powered by blists - more mailing lists