From nobody Sun Oct 5 16:18:50 2025 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B682A221723; Sat, 2 Aug 2025 09:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126905; cv=none; b=NXUGqiBRJDiz2oCwmJxHjA44yjJhzP9h44bJ5JRYaYYRt16cprw2ISLyvC4qSmnSzWdjMH1+tik8eLL3+h+w3EDmMg81MO/tVfyeRuCWj8eRadSn7DZg24pLBZiMb6Z/v/fvuhFyXwFAAb2NGJxbWPXGyrfsq5stGVfNTssiQqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754126905; c=relaxed/simple; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Wp7P9FuKzTOA/WsWfu6tVnRQ/Yk4jZdpqxfFGuidAZge5Y+Xiin7j8EV5ao9lU3JQkGRtkwRFmMpVzs+Ufs5TUFaAzTVXGEcSpsUjqyTpEEDzE08yXEJT+nxxuQwlz372tC/D4I6FbNbvbaNfcHaP9Ony95v+d/8x02V6QV8aDM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=hpY78Cmk; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hpY78Cmk" Received: from [192.168.0.172] (mob-5-90-138-121.net.vodafone.it [5.90.138.121]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A3DB13BFA; Sat, 2 Aug 2025 11:27:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1754126857; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=hpY78CmkVv74nSpWm7mIQCCiDoYD4+PYB95WVTP4W7eZHiEy+SV4qDjjuyt3l55ad Wo1Jomg7/kuakxont8Lj75UEoyxO/gXWRVep1Pym+B5WryRO5Bf/nqQHWEQxxF549z O+SKZiZJEXIhWbrbWhqqK7Mujk0z12AkXw6FIywc= From: Jacopo Mondi Date: Sat, 02 Aug 2025 11:22:51 +0200 Subject: [PATCH 29/65] media: allegro: Access v4l2_fh from file Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250802-media-private-data-v1-29-eb140ddd6a9d@ideasonboard.com> References: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> In-Reply-To: <20250802-media-private-data-v1-0-eb140ddd6a9d@ideasonboard.com> To: Mauro Carvalho Chehab , Devarsh Thakkar , Benoit Parrot , Hans Verkuil , Mike Isely , Laurent Pinchart , Hans de Goede , Parthiban Veerasooran , Christian Gromm , Greg Kroah-Hartman , Alex Shi , Yanteng Si , Dongliang Mu , Jonathan Corbet , Tomasz Figa , Marek Szyprowski , Andy Walls , Michael Tretter , Pengutronix Kernel Team , Bin Liu , Matthias Brugger , AngeloGioacchino Del Regno , Dmitry Osipenko , Thierry Reding , Jonathan Hunter , Mirela Rabulea , Shawn Guo , Sascha Hauer , Fabio Estevam , Kieran Bingham , Michal Simek , Ming Qian , Zhou Peng , Xavier Roumegue , Philipp Zabel , Vikash Garodia , Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Sylwester Nawrocki , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland , Daniel Almeida , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Nas Chung , Jackson Lee , Minghsiu Tsai , Houlong Wei , Andrew-CT Chen , Tiffany Lin , Yunfei Dong , Geert Uytterhoeven , Magnus Damm , Mikhail Ulyanov , Jacob Chen , Ezequiel Garcia , Heiko Stuebner , Detlev Casanova , Krzysztof Kozlowski , Alim Akhtar , Sylwester Nawrocki , =?utf-8?q?=C5=81ukasz_Stelmach?= , Andrzej Pietrasiewicz , Jacek Anaszewski , Andrzej Hajda , Fabien Dessenne , Hugues Fruchet , Jean-Christophe Trotin , Maxime Coquelin , Alexandre Torgue , Nicolas Dufresne , Benjamin Gaignard , Steve Longerbeam , Maxime Ripard , Paul Kocialkowski , =?utf-8?q?Niklas_S=C3=B6derlund?= , Robert Foss , Todor Tomov , Vladimir Zapolskiy , Corentin Labbe , Sakari Ailus , Bingbu Cao , Tianshu Qiu , Stanislaw Gruszka Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org, imx@lists.linux.dev, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-usb@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, mjpeg-users@lists.sourceforge.net, Jacopo Mondi X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4042; i=jacopo.mondi@ideasonboard.com; h=from:subject:message-id; bh=EupQNZwVDEWPV0lRXOPIWwyqRXZFDT974pCYxdDmFr4=; b=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBojdj6938RTcCW3JLF7q2TU/zTQB1aW4uCXzbSl KRPGOpR5M2JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaI3Y+gAKCRByNAaPFqFW PPEoEACtOVVZcE0Jno+wySkwxbtRcY7fcEkuzlP+5mpC4ISfqOV+gM1G/t+jhOBOQxI2V/sx6dj NffRk/kDtQ0yQ4OGn75YP9PwPU1u9Ho0ABWevDJPGYy5zNzO1Ho6BvS55kDKWQhWVZUBNHaX5q7 ydYl8Kklpn3uECXV2WO4sJhJcOUYT1yZ4VZ7O6wNgmZjaL+XavqFPr05yLv4ATGvhCQK1zttCLo ZuyM2KYvgb2RWYqOlshgBkBj6Ry5xxAPHBGJltaqSdAms5rji4stoNX+CGpKTz/eZCE1XaM8lec KfphPeP6gNXjr4erndbjbZ5ZG4SszKQ0+yLymE6Wdj+DQvrPjHGjJCx1xRLzDG4PzvA3ILsaB2E cmu6TARWAS4IXzftMkQ7UsHq3BLGTqd1B/BroBVisfe+SI5XaE8KQyW7YdgWWMUPmgD6IqaQ0D8 NG5HUaRIsNxYllVZYKG+EbXmU0cfD3ELrYPOBtInFkGy717UK1q8BcTX6XcC+G8qhbJZBsiGM6w SqUODvlIMVAPmeAe8idoPhTsaqG0rZJ6GHa13M4scN3OICYwSQoh2HrXwVz5Fs+X8Z993R2hRiR UuwCyI5NZ+aiwhmLknbWCncfbc/sPJStc5Q8ddqgjMoRv47AcoNqw7tZnQ+l3zMnhzdNFYcsO4x 6BSqqLyKW3RHXBA== X-Developer-Key: i=jacopo.mondi@ideasonboard.com; a=openpgp; fpr=72392EDC88144A65C701EA9BA5826A2587AD026B 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 only left user of fh_to_channel() and remove the macro completely. Signed-off-by: Jacopo Mondi --- drivers/media/platform/allegro-dvt/allegro-core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/me= dia/platform/allegro-dvt/allegro-core.c index 5e3b1f5d7206d84b8ccb9ea3b3f3f1fe75becf99..81c6afcf2d06f9e39015e49d355= 346238c5033d8 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -197,8 +197,6 @@ static const struct regmap_config allegro_sram_config = =3D { .cache_type =3D REGCACHE_NONE, }; =20 -#define fh_to_channel(__fh) container_of(__fh, struct allegro_channel, fh) - struct allegro_channel { struct allegro_dev *dev; struct v4l2_fh fh; @@ -3284,7 +3282,7 @@ static int allegro_enum_fmt_vid(struct file *file, vo= id *fh, static int allegro_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); =20 f->fmt.pix.field =3D V4L2_FIELD_NONE; f->fmt.pix.width =3D channel->width; @@ -3326,7 +3324,7 @@ static int allegro_try_fmt_vid_cap(struct file *file,= void *fh, static int allegro_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct vb2_queue *vq; int err; =20 @@ -3350,7 +3348,7 @@ static int allegro_s_fmt_vid_cap(struct file *file, v= oid *fh, static int allegro_g_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); =20 f->fmt.pix.field =3D V4L2_FIELD_NONE; =20 @@ -3397,7 +3395,7 @@ static int allegro_try_fmt_vid_out(struct file *file,= void *fh, static int allegro_s_fmt_vid_out(struct file *file, void *fh, struct v4l2_format *f) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 err =3D allegro_try_fmt_vid_out(file, fh, f); @@ -3438,7 +3436,7 @@ static int allegro_channel_cmd_start(struct allegro_c= hannel *channel) static int allegro_encoder_cmd(struct file *file, void *fh, struct v4l2_encoder_cmd *cmd) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 err =3D v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd); @@ -3488,7 +3486,7 @@ static int allegro_ioctl_streamon(struct file *file, = void *priv, enum v4l2_buf_type type) { struct v4l2_fh *fh =3D file_to_v4l2_fh(file); - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); int err; =20 if (type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE) { @@ -3503,7 +3501,7 @@ static int allegro_ioctl_streamon(struct file *file, = void *priv, static int allegro_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct v4l2_fract *timeperframe; =20 if (a->type !=3D V4L2_BUF_TYPE_VIDEO_OUTPUT) @@ -3520,7 +3518,7 @@ static int allegro_g_parm(struct file *file, void *fh, static int allegro_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a) { - struct allegro_channel *channel =3D fh_to_channel(fh); + struct allegro_channel *channel =3D file_to_channel(file); struct v4l2_fract *timeperframe; int div; =20 --=20 2.49.0