[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250802-media-private-data-v1-45-eb140ddd6a9d@ideasonboard.com>
Date: Sat, 02 Aug 2025 11:23:07 +0200
From: Jacopo Mondi <jacopo.mondi@...asonboard.com>
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>,
Zhou Peng <eagle.zhou@....com>,
Xavier Roumegue <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: [PATCH 45/65] media: exynos-gsc: Access v4l2_fh from file
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@...asonboard.com>
---
.../media/platform/samsung/exynos-gsc/gsc-core.h | 2 --
.../media/platform/samsung/exynos-gsc/gsc-m2m.c | 24 +++++++++++-----------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h b/drivers/media/platform/samsung/exynos-gsc/gsc-core.h
index a5491fe39e0f686c75c888c4632150f32326c36e..265221abf4dcd87f2ab10758e145fa96ac9d420e 100644
--- a/drivers/media/platform/samsung/exynos-gsc/gsc-core.h
+++ b/drivers/media/platform/samsung/exynos-gsc/gsc-core.h
@@ -85,8 +85,6 @@ enum gsc_yuv_fmt {
GSC_CRCB,
};
-#define fh_to_ctx(__fh) container_of(__fh, struct gsc_ctx, fh)
-
#define is_rgb(x) (!!((x) & 0x1))
#define is_yuv420(x) (!!((x) & 0x2))
#define is_yuv422(x) (!!((x) & 0x4))
diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
index 2999fb2610f0f61b63d0331f94883469ff43d751..722e2531e23f1bc01f5e9a9c08dfe4745cc2aa4f 100644
--- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
+++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c
@@ -297,7 +297,7 @@ static int gsc_m2m_enum_fmt(struct file *file, void *priv,
static int gsc_m2m_g_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return gsc_g_fmt_mplane(ctx, f);
}
@@ -305,7 +305,7 @@ static int gsc_m2m_g_fmt_mplane(struct file *file, void *fh,
static int gsc_m2m_try_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return gsc_try_fmt_mplane(ctx, f);
}
@@ -313,7 +313,7 @@ static int gsc_m2m_try_fmt_mplane(struct file *file, void *fh,
static int gsc_m2m_s_fmt_mplane(struct file *file, void *fh,
struct v4l2_format *f)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
struct vb2_queue *vq;
struct gsc_frame *frame;
struct v4l2_pix_format_mplane *pix;
@@ -359,7 +359,7 @@ static int gsc_m2m_s_fmt_mplane(struct file *file, void *fh,
static int gsc_m2m_reqbufs(struct file *file, void *fh,
struct v4l2_requestbuffers *reqbufs)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
struct gsc_dev *gsc = ctx->gsc_dev;
u32 max_cnt;
@@ -374,35 +374,35 @@ static int gsc_m2m_reqbufs(struct file *file, void *fh,
static int gsc_m2m_expbuf(struct file *file, void *fh,
struct v4l2_exportbuffer *eb)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_expbuf(file, ctx->m2m_ctx, eb);
}
static int gsc_m2m_querybuf(struct file *file, void *fh,
struct v4l2_buffer *buf)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_querybuf(file, ctx->m2m_ctx, buf);
}
static int gsc_m2m_qbuf(struct file *file, void *fh,
struct v4l2_buffer *buf)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_qbuf(file, ctx->m2m_ctx, buf);
}
static int gsc_m2m_dqbuf(struct file *file, void *fh,
struct v4l2_buffer *buf)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_dqbuf(file, ctx->m2m_ctx, buf);
}
static int gsc_m2m_streamon(struct file *file, void *fh,
enum v4l2_buf_type type)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
/* The source and target color format need to be set */
if (V4L2_TYPE_IS_OUTPUT(type)) {
@@ -418,7 +418,7 @@ static int gsc_m2m_streamon(struct file *file, void *fh,
static int gsc_m2m_streamoff(struct file *file, void *fh,
enum v4l2_buf_type type)
{
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
return v4l2_m2m_streamoff(file, ctx->m2m_ctx, type);
}
@@ -440,8 +440,8 @@ static int is_rectangle_enclosed(struct v4l2_rect *a, struct v4l2_rect *b)
static int gsc_m2m_g_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{
+ struct gsc_ctx *ctx = file_to_ctx(file);
struct gsc_frame *frame;
- struct gsc_ctx *ctx = fh_to_ctx(fh);
if ((s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) &&
(s->type != V4L2_BUF_TYPE_VIDEO_OUTPUT))
@@ -478,7 +478,7 @@ static int gsc_m2m_s_selection(struct file *file, void *fh,
struct v4l2_selection *s)
{
struct gsc_frame *frame;
- struct gsc_ctx *ctx = fh_to_ctx(fh);
+ struct gsc_ctx *ctx = file_to_ctx(file);
struct gsc_variant *variant = ctx->gsc_dev->variant;
struct v4l2_selection sel = *s;
int ret;
--
2.49.0
Powered by blists - more mailing lists