You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
(151) |
Apr
(278) |
May
(221) |
Jun
(161) |
Jul
(158) |
Aug
(204) |
Sep
(111) |
Oct
(344) |
Nov
(246) |
Dec
(348) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(393) |
Feb
(317) |
Mar
(225) |
Apr
(338) |
May
(328) |
Jun
(226) |
Jul
(195) |
Aug
(191) |
Sep
(211) |
Oct
(212) |
Nov
(304) |
Dec
(280) |
| 2003 |
Jan
(332) |
Feb
(401) |
Mar
(355) |
Apr
(240) |
May
(277) |
Jun
(299) |
Jul
(97) |
Aug
(280) |
Sep
(300) |
Oct
(200) |
Nov
(272) |
Dec
(281) |
| 2004 |
Jan
(384) |
Feb
(155) |
Mar
(155) |
Apr
(98) |
May
(191) |
Jun
(117) |
Jul
(119) |
Aug
(242) |
Sep
(146) |
Oct
(166) |
Nov
(101) |
Dec
(133) |
| 2005 |
Jan
(196) |
Feb
(133) |
Mar
(190) |
Apr
(100) |
May
(124) |
Jun
(78) |
Jul
(73) |
Aug
(110) |
Sep
(87) |
Oct
(102) |
Nov
(67) |
Dec
(77) |
| 2006 |
Jan
(75) |
Feb
(35) |
Mar
(51) |
Apr
(144) |
May
(40) |
Jun
(70) |
Jul
(53) |
Aug
(34) |
Sep
(31) |
Oct
(49) |
Nov
(80) |
Dec
(53) |
| 2007 |
Jan
(72) |
Feb
(21) |
Mar
(67) |
Apr
(56) |
May
(45) |
Jun
(23) |
Jul
(15) |
Aug
(27) |
Sep
(41) |
Oct
(20) |
Nov
(60) |
Dec
(52) |
| 2008 |
Jan
(40) |
Feb
(53) |
Mar
(41) |
Apr
(12) |
May
(25) |
Jun
(20) |
Jul
(19) |
Aug
(23) |
Sep
(29) |
Oct
(15) |
Nov
(10) |
Dec
(18) |
| 2009 |
Jan
(24) |
Feb
(19) |
Mar
(5) |
Apr
(17) |
May
(11) |
Jun
(43) |
Jul
(4) |
Aug
(2) |
Sep
(17) |
Oct
(15) |
Nov
(15) |
Dec
(4) |
| 2010 |
Jan
(8) |
Feb
(5) |
Mar
(4) |
Apr
(23) |
May
(16) |
Jun
|
Jul
(5) |
Aug
(1) |
Sep
(7) |
Oct
(31) |
Nov
(11) |
Dec
(6) |
| 2011 |
Jan
(10) |
Feb
(3) |
Mar
|
Apr
|
May
(4) |
Jun
(2) |
Jul
(5) |
Aug
(1) |
Sep
(25) |
Oct
(1) |
Nov
(13) |
Dec
|
| 2012 |
Jan
(2) |
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(9) |
Dec
(3) |
| 2013 |
Jan
(3) |
Feb
(1) |
Mar
(9) |
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(2) |
Dec
|
| 2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(6) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2015 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
|
| 2016 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(4) |
Jul
|
Aug
(2) |
Sep
|
Oct
(2) |
Nov
(4) |
Dec
(5) |
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(6) |
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(3) |
Nov
|
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
(10) |
May
(4) |
Jun
(2) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
(2) |
Mar
|
Apr
(7) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
(7) |
Oct
(5) |
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(12) |
Nov
|
Dec
|
| 2021 |
Jan
(9) |
Feb
(4) |
Mar
(4) |
Apr
(2) |
May
(45) |
Jun
(1) |
Jul
|
Aug
|
Sep
(23) |
Oct
(39) |
Nov
(8) |
Dec
(19) |
| 2022 |
Jan
|
Feb
|
Mar
(10) |
Apr
(26) |
May
(8) |
Jun
(2) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(21) |
Nov
(3) |
Dec
|
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(1) |
| 2024 |
Jan
(14) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(107) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
|
From: Andy S. <and...@gm...> - 2025-09-20 10:49:41
|
On Fri, Sep 19, 2025 at 12:57 PM Jai Luthra <jai...@id...> wrote: > > Hi, > > This patch series introduces state management for video devices. > > Currently, V4L2 subdevices have a well-established state management > system [1] that allows the framework to store the subdevice state > at a central location. > > Video devices however lack this, leading to inconsistent state handling > across drivers and making it difficult to implement features like > hardware multiplexing in complex media pipelines [2]. > > The series is composed of three parts: > > - Core Infrastructure (PATCH 1-4) > Introduces the basic state structure, try state support, > initialization callbacks, and driver helpers > - Framework Integration (PATCH 5-7) > Integrates state passing through the ioctl wrappers and driver > implementations > - Driver Examples (PATCH 8-10) > Use the state to store formats in TI J721E CSI2RX and Rockchip > RKISP1 drivers > > This should also provide a foundation for drivers to extend or subclass > the state structure with device-specific variables in future. > > I have tested capture and format negotiation with the converted drivers > on SK AM62A (j721e-csi2rx) and Debix Model A (rkisp1). > > [1]: https://lore.kernel.org/linux-media/202...@id.../ > [2]: https://lore.kernel.org/linux-media/202...@id.../ When you add a Cc list., do it after the '---' (three minus signs) line, otherwise that huge unneeded noise will become part of the commit message. -- With Best Regards, Andy Shevchenko |
|
From: Jai L. <jai...@id...> - 2025-09-19 10:40:34
|
Replace the opaque (and unused) pointer with a pointer to the video
device state in all V4L2 driver ioctl implementations.
Most changes were automated using Coccinelle semantic patches for both
drivers and framework helpers:
@ops@
identifier ops;
identifier vidioc_op;
identifier fn;
@@
struct v4l2_ioctl_ops ops = {
...,
.vidioc_op = fn,
...,
};
// Rule 1 (like vidioc_log_status)
@depends on ops@
identifier ops.fn;
identifier filep;
identifier priv;
@@
int fn(struct file *filep,
- void *priv)
+ struct video_device_state *state)
{
<...
- priv
+ state
...>
}
// Rule 2 (most ioctls)
@depends on ops@
identifier ops.fn;
identifier filep;
identifier priv;
identifier arg;
type T;
@@
int fn(struct file *filep,
- void *priv,
+ struct video_device_state *state,
T arg)
{
<...
- priv
+ state
...>
}
// Rule 3 (like vidioc_g_pixelaspect)
@depends on ops@
identifier ops.fn;
identifier filep;
identifier priv;
identifier buf_type;
identifier arg;
type T1, T2;
@@
int fn(struct file *filep,
- void *priv,
+ struct video_device_state *state,
T1 buf_type, T2 *arg)
{
<...
- priv
+ state
...>
}
// Rule 4 (like vidioc_default)
@depends on ops@
identifier ops.fn;
identifier filep;
identifier priv;
identifier valid_prio;
identifier cmd;
identifier arg;
@@
long fn(struct file *filep,
- void *priv,
+ struct video_device_state *state,
bool valid_prio, unsigned int cmd, void *arg)
{
<...
- priv
+ state
...>
}
Function signature updates in headers and edge cases where drivers call
ioctl implementations internally were handled manually.
Signed-off-by: Jai Luthra <jai...@id...>
--
Cc: Dmitry Torokhov <dmi...@gm...>
Cc: Nick Dyer <ni...@sh...>
Cc: Hans Verkuil <hve...@ke...>
Cc: Mauro Carvalho Chehab <mc...@ke...>
Cc: Tomasz Figa <tf...@ch...>
Cc: Marek Szyprowski <m.s...@sa...>
Cc: Matt Ranostay <ma...@ra...>
Cc: Andy Walls <aw...@md...>
Cc: Yong Zhi <yon...@in...>
Cc: Sakari Ailus <sak...@li...>
Cc: Bingbu Cao <bin...@in...>
Cc: Dan Scally <djr...@gm...>
Cc: Tianshu Qiu <tia...@in...>
Cc: Martin Tuma <mar...@di...>
Cc: Bluecherry Maintainers <mai...@bl...>
Cc: Andrey Utkin <and...@fa...>
Cc: Ismael Luceno <is...@io...>
Cc: Ezequiel Garcia <eze...@va...>
Cc: Corentin Labbe <cl...@ba...>
Cc: Michael Tretter <m.t...@pe...>
Cc: Pengutronix Kernel Team <ke...@pe...>
Cc: Keke Li <ke...@am...>
Cc: Neil Armstrong <nei...@li...>
Cc: Kevin Hilman <kh...@ba...>
Cc: Jerome Brunet <jb...@ba...>
Cc: Martin Blumenstingl <mar...@go...>
Cc: Ming Qian <min...@nx...>
Cc: Zhou Peng <eag...@nx...>
Cc: Eddie James <ea...@li...>
Cc: Joel Stanley <jo...@jm...>
Cc: Andrew Jeffery <an...@co...>
Cc: Eugen Hristev <eug...@li...>
Cc: Nicolas Ferre <nic...@mi...>
Cc: Alexandre Belloni <ale...@bo...>
Cc: Claudiu Beznea <cla...@tu...>
Cc: Raspberry Pi Kernel Maintenance <ker...@ra...>
Cc: Florian Fainelli <flo...@br...>
Cc: Broadcom internal kernel review list <bcm...@br...>
Cc: Ray Jui <rj...@br...>
Cc: Scott Branden <sbr...@br...>
Cc: Philipp Zabel <p....@pe...>
Cc: Nas Chung <nas...@ch...>
Cc: Jackson Lee <jac...@ch...>
Cc: Devarsh Thakkar <dev...@ti...>
Cc: Bin Liu <bi...@me...>
Cc: Matthias Brugger <mat...@gm...>
Cc: AngeloGioacchino Del Regno <ang...@co...>
Cc: Minghsiu Tsai <min...@me...>
Cc: Houlong Wei <hou...@me...>
Cc: Andrew-CT Chen <and...@me...>
Cc: Tiffany Lin <tif...@me...>
Cc: Yunfei Dong <yun...@me...>
Cc: Joseph Liu <kw...@nu...>
Cc: Marvin Lin <kf...@nu...>
Cc: Dmitry Osipenko <di...@gm...>
Cc: Thierry Reding <thi...@gm...>
Cc: Jonathan Hunter <jon...@nv...>
Cc: Xavier Roumegue <xav...@os...>
Cc: Mirela Rabulea <mir...@nx...>
Cc: Shawn Guo <sha...@ke...>
Cc: Sascha Hauer <s....@pe...>
Cc: Fabio Estevam <fes...@gm...>
Cc: Rui Miguel Silva <rm...@gm...>
Cc: Laurent Pinchart <lau...@id...>
Cc: Martin Kepplinger <ma...@po...>
Cc: Purism Kernel Team <ke...@pu...>
Cc: Robert Foss <rf...@ke...>
Cc: Todor Tomov <tod...@gm...>
Cc: "Bryan O'Donoghue" <bry...@li...>
Cc: Vladimir Zapolskiy <vla...@li...>
Cc: Vikash Garodia <vik...@os...>
Cc: Dikshita Agarwal <dik...@os...>
Cc: Abhinav Kumar <abh...@li...>
Cc: Jacopo Mondi <jac...@id...>
Cc: Tomi Valkeinen <tom...@id...>
Cc: "Niklas Söderlund" <nik...@ra...>
Cc: Geert Uytterhoeven <gee...@gl...>
Cc: Magnus Damm <mag...@gm...>
Cc: Fabrizio Castro <fab...@re...>
Cc: Kieran Bingham <kie...@id...>
Cc: Nikita Yushchenko <nik...@co...>
Cc: Jacob Chen <jac...@io...>
Cc: Heiko Stuebner <he...@sn...>
Cc: Dafna Hirschfeld <da...@fa...>
Cc: Detlev Casanova <det...@co...>
Cc: Krzysztof Kozlowski <kr...@ke...>
Cc: Alim Akhtar <ali...@sa...>
Cc: Sylwester Nawrocki <s.n...@sa...>
Cc: "Łukasz Stelmach" <l.s...@sa...>
Cc: Andrzej Pietrasiewicz <and...@gm...>
Cc: Jacek Anaszewski <jac...@gm...>
Cc: Andrzej Hajda <and...@in...>
Cc: Fabien Dessenne <fab...@fo...>
Cc: Hugues Fruchet <hug...@fo...>
Cc: Jean-Christophe Trotin <jea...@fo...>
Cc: Maxime Coquelin <mco...@gm...>
Cc: Alexandre Torgue <ale...@fo...>
Cc: Alain Volmat <ala...@fo...>
Cc: Maxime Ripard <mr...@ke...>
Cc: Chen-Yu Tsai <we...@cs...>
Cc: Jernej Skrabec <jer...@gm...>
Cc: Samuel Holland <sa...@sh...>
Cc: Yong Deng <yon...@ma...>
Cc: Paul Kocialkowski <pa...@sy...>
Cc: Shreeya Patel <shr...@co...>
Cc: "Lad, Prabhakar" <pra...@gm...>
Cc: Yemike Abhilash Chandra <y-a...@ti...>
Cc: Jai Luthra <jai...@li...>
Cc: Nicolas Dufresne <nic...@co...>
Cc: Benjamin Gaignard <ben...@co...>
Cc: Michal Simek <mic...@am...>
Cc: Alexey Klimov <ale...@li...>
Cc: Eduardo Valentin <edu...@gm...>
Cc: Shuah Khan <sk...@li...>
Cc: Daniel Almeida <dan...@co...>
Cc: Michael Krufky <mk...@li...>
Cc: Mike Isely <is...@po...>
Cc: Hans de Goede <ha...@ke...>
Cc: Andy Shevchenko <an...@ke...>
Cc: Greg Kroah-Hartman <gr...@li...>
Cc: Steve Longerbeam <slo...@gm...>
Cc: Jack Zhu <jac...@st...>
Cc: Changhuang Liang <cha...@st...>
Cc: Sowjanya Komatineni <sko...@nv...>
Cc: Luca Ceresoli <luc...@bo...>
Cc: Parthiban Veerasooran <par...@mi...>
Cc: Christian Gromm <chr...@mi...>
Cc: "Uwe Kleine-König" <u.k...@ba...>
Cc: Ingo Molnar <mi...@ke...>
Cc: Thomas Gleixner <tg...@li...>
Cc: Plamen Atanasov <tig...@ma...>
Cc: Sean Young <se...@me...>
Cc: Ariel Otilibili <ari...@eu...>
Cc: "Dr. David Alan Gilbert" <li...@tr...>
Cc: Jiasheng Jiang <jia...@gm...>
Cc: Lad Prabhakar <pra...@bp...>
Cc: Tommaso Merciai <tom...@bp...>
Cc: Biju Das <bij...@bp...>
Cc: Daniel Scally <dan...@id...>
Cc: Matthew Majewski <mat...@gm...>
Cc: Yunseong Kim <ys...@kz...>
Cc: Chen Ni <ni...@is...>
Cc: Ricardo Ribalda <ri...@ch...>
Cc: Fabio Luongo <f.l...@gm...>
Cc: Mark Brown <br...@ke...>
Cc: Yang Yingliang <yan...@hu...>
Cc: Ludwig Disterhof <lu...@di...>
Cc: Ma Ke <ma...@is...>
Cc: "Everest K.C." <eve...@ev...>
Cc: Stefan Wahren <wah...@gm...>
Cc: Dave Stevenson <dav...@ra...>
Cc: Michael Grzeschik <m.g...@pe...>
Cc: Akash Kumar <qui...@qu...>
Cc: lin...@vg...
Cc: lin...@vg...
Cc: lin...@vg...
Cc: mjp...@li...
Cc: lin...@li...
Cc: lin...@li...
Cc: op...@li...
Cc: lin...@li...
Cc: lin...@li...
Cc: lin...@li...
Cc: lin...@vg...
Cc: im...@li...
Cc: lin...@vg...
Cc: lin...@vg...
Cc: lin...@li...
Cc: lin...@vg...
Cc: lin...@st...
Cc: lin...@li...
Cc: ke...@co...
Cc: lin...@li...
Cc: lin...@vg...
---
drivers/input/rmi4/rmi_f54.c | 22 +-
drivers/input/touchscreen/atmel_mxt_ts.c | 23 +-
drivers/input/touchscreen/sur40.c | 35 ++-
.../extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 34 ++-
drivers/media/common/saa7146/saa7146_video.c | 37 +++-
drivers/media/common/videobuf2/videobuf2-v4l2.c | 30 ++-
drivers/media/dvb-frontends/rtl2832_sdr.c | 38 ++--
drivers/media/i2c/video-i2c.c | 39 ++--
drivers/media/pci/bt8xx/bttv-driver.c | 84 +++++---
drivers/media/pci/bt8xx/bttv-vbi.c | 11 +-
drivers/media/pci/bt8xx/bttvp.h | 9 +-
drivers/media/pci/cobalt/cobalt-v4l2.c | 98 +++++----
drivers/media/pci/cx18/cx18-driver.c | 9 +-
drivers/media/pci/cx18/cx18-ioctl.c | 114 ++++++----
drivers/media/pci/cx18/cx18-ioctl.h | 9 +-
drivers/media/pci/cx23885/cx23885-417.c | 53 +++--
drivers/media/pci/cx23885/cx23885-ioctl.c | 8 +-
drivers/media/pci/cx23885/cx23885-ioctl.h | 9 +-
drivers/media/pci/cx23885/cx23885-vbi.c | 5 +-
drivers/media/pci/cx23885/cx23885-video.c | 82 ++++---
drivers/media/pci/cx23885/cx23885.h | 4 +-
drivers/media/pci/cx25821/cx25821-video.c | 57 +++--
drivers/media/pci/cx88/cx88-blackbird.c | 47 ++--
drivers/media/pci/cx88/cx88-vbi.c | 2 +-
drivers/media/pci/cx88/cx88-video.c | 56 +++--
drivers/media/pci/cx88/cx88.h | 2 +-
drivers/media/pci/dt3155/dt3155.c | 25 ++-
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 29 ++-
drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 41 ++--
drivers/media/pci/ivtv/ivtv-driver.c | 8 +-
drivers/media/pci/ivtv/ivtv-ioctl.c | 225 +++++++++++++------
drivers/media/pci/ivtv/ivtv-ioctl.h | 6 +-
drivers/media/pci/mgb4/mgb4_vin.c | 55 +++--
drivers/media/pci/mgb4/mgb4_vout.c | 49 +++--
drivers/media/pci/saa7134/saa7134-empress.c | 12 +-
drivers/media/pci/saa7134/saa7134-video.c | 96 +++++----
drivers/media/pci/saa7134/saa7134.h | 38 ++--
drivers/media/pci/saa7146/hexium_gemini.c | 10 +-
drivers/media/pci/saa7146/hexium_orion.c | 10 +-
drivers/media/pci/saa7146/mxb.c | 46 ++--
drivers/media/pci/saa7164/saa7164-encoder.c | 39 ++--
drivers/media/pci/saa7164/saa7164-vbi.c | 27 ++-
drivers/media/pci/saa7164/saa7164.h | 9 +-
drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 46 ++--
drivers/media/pci/solo6x10/solo6x10-v4l2.c | 32 ++-
drivers/media/pci/ttpci/budget-av.c | 10 +-
drivers/media/pci/tw5864/tw5864-video.c | 49 +++--
drivers/media/pci/tw68/tw68-video.c | 43 ++--
drivers/media/pci/tw686x/tw686x-video.c | 53 +++--
drivers/media/pci/zoran/zoran_driver.c | 44 ++--
drivers/media/platform/allegro-dvt/allegro-core.c | 49 +++--
.../media/platform/amlogic/c3/isp/c3-isp-capture.c | 18 +-
.../media/platform/amlogic/c3/isp/c3-isp-params.c | 9 +-
.../media/platform/amlogic/c3/isp/c3-isp-stats.c | 9 +-
drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 36 +++-
drivers/media/platform/amphion/vdec.c | 30 ++-
drivers/media/platform/amphion/venc.c | 49 +++--
drivers/media/platform/aspeed/aspeed-video.c | 50 +++--
drivers/media/platform/atmel/atmel-isi.c | 36 ++--
drivers/media/platform/broadcom/bcm2835-unicam.c | 33 ++-
.../media/platform/chips-media/coda/coda-common.c | 69 +++---
.../platform/chips-media/wave5/wave5-helper.c | 2 +-
.../platform/chips-media/wave5/wave5-helper.h | 3 +-
.../platform/chips-media/wave5/wave5-vpu-dec.c | 54 +++--
.../platform/chips-media/wave5/wave5-vpu-enc.c | 62 ++++--
.../media/platform/imagination/e5010-jpeg-enc.c | 34 ++-
drivers/media/platform/intel/pxa_camera.c | 34 ++-
drivers/media/platform/m2m-deinterlace.c | 34 +--
drivers/media/platform/marvell/mcam-core.c | 52 +++--
.../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 44 ++--
drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 34 +--
.../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 25 ++-
.../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 52 +++--
.../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 50 +++--
.../media/platform/microchip/microchip-isc-base.c | 33 ++-
drivers/media/platform/nuvoton/npcm-video.c | 43 ++--
drivers/media/platform/nvidia/tegra-vde/v4l2.c | 38 ++--
drivers/media/platform/nxp/dw100/dw100.c | 35 +--
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 52 +++--
drivers/media/platform/nxp/imx-pxp.c | 34 +--
drivers/media/platform/nxp/imx7-media-csi.c | 21 +-
drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 15 +-
.../media/platform/nxp/imx8-isi/imx8-isi-video.c | 18 +-
drivers/media/platform/nxp/mx2_emmaprp.c | 31 ++-
drivers/media/platform/qcom/camss/camss-video.c | 27 ++-
drivers/media/platform/qcom/iris/iris_vidc.c | 48 +++--
drivers/media/platform/qcom/venus/vdec.c | 29 ++-
drivers/media/platform/qcom/venus/venc.c | 38 ++--
.../media/platform/raspberrypi/pisp_be/pisp_be.c | 42 ++--
drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 40 ++--
.../media/platform/renesas/rcar-vin/rcar-v4l2.c | 21 +-
drivers/media/platform/renesas/rcar_drif.c | 30 ++-
drivers/media/platform/renesas/rcar_fdp1.c | 18 +-
drivers/media/platform/renesas/rcar_jpu.c | 21 +-
drivers/media/platform/renesas/renesas-ceu.c | 36 ++--
.../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 18 +-
drivers/media/platform/renesas/sh_vou.c | 41 ++--
drivers/media/platform/renesas/vsp1/vsp1_histo.c | 9 +-
drivers/media/platform/renesas/vsp1/vsp1_video.c | 18 +-
drivers/media/platform/rockchip/rga/rga.c | 24 ++-
.../platform/rockchip/rkisp1/rkisp1-capture.c | 18 +-
.../media/platform/rockchip/rkisp1/rkisp1-params.c | 15 +-
.../media/platform/rockchip/rkisp1/rkisp1-stats.c | 9 +-
drivers/media/platform/rockchip/rkvdec/rkvdec.c | 34 +--
.../media/platform/samsung/exynos-gsc/gsc-m2m.c | 44 ++--
.../platform/samsung/exynos4-is/fimc-capture.c | 45 ++--
.../platform/samsung/exynos4-is/fimc-isp-video.c | 32 +--
.../media/platform/samsung/exynos4-is/fimc-lite.c | 36 ++--
.../media/platform/samsung/exynos4-is/fimc-m2m.c | 21 +-
.../platform/samsung/s3c-camif/camif-capture.c | 54 +++--
drivers/media/platform/samsung/s5p-g2d/g2d.c | 26 ++-
.../media/platform/samsung/s5p-jpeg/jpeg-core.c | 34 +--
.../media/platform/samsung/s5p-mfc/s5p_mfc_dec.c | 48 +++--
.../media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 51 +++--
drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 26 ++-
drivers/media/platform/st/sti/delta/delta-v4l2.c | 44 ++--
drivers/media/platform/st/sti/hva/hva-v4l2.c | 46 ++--
drivers/media/platform/st/stm32/dma2d/dma2d.c | 18 +-
drivers/media/platform/st/stm32/stm32-dcmi.c | 42 ++--
.../st/stm32/stm32-dcmipp/dcmipp-bytecap.c | 20 +-
.../media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 25 ++-
.../platform/sunxi/sun6i-csi/sun6i_csi_capture.c | 24 ++-
drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 31 ++-
.../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 34 +--
.../media/platform/synopsys/hdmirx/snps_hdmirx.c | 47 ++--
drivers/media/platform/ti/am437x/am437x-vpfe.c | 52 +++--
drivers/media/platform/ti/cal/cal-video.c | 54 +++--
drivers/media/platform/ti/davinci/vpif_capture.c | 94 ++++----
drivers/media/platform/ti/davinci/vpif_display.c | 58 +++--
.../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 20 +-
drivers/media/platform/ti/omap/omap_vout.c | 49 +++--
drivers/media/platform/ti/omap3isp/ispvideo.c | 53 +++--
drivers/media/platform/ti/vpe/vpe.c | 25 ++-
drivers/media/platform/verisilicon/hantro_v4l2.c | 47 ++--
drivers/media/platform/via/via-camera.c | 42 ++--
drivers/media/platform/xilinx/xilinx-dma.c | 15 +-
drivers/media/radio/dsbr100.c | 15 +-
drivers/media/radio/radio-cadet.c | 18 +-
drivers/media/radio/radio-isa.c | 18 +-
drivers/media/radio/radio-keene.c | 15 +-
drivers/media/radio/radio-ma901.c | 15 +-
drivers/media/radio/radio-miropcm20.c | 15 +-
drivers/media/radio/radio-mr800.c | 18 +-
drivers/media/radio/radio-raremono.c | 19 +-
drivers/media/radio/radio-sf16fmi.c | 15 +-
drivers/media/radio/radio-si476x.c | 28 ++-
drivers/media/radio/radio-tea5764.c | 15 +-
drivers/media/radio/radio-tea5777.c | 21 +-
drivers/media/radio/radio-timb.c | 26 ++-
drivers/media/radio/si470x/radio-si470x-common.c | 25 ++-
drivers/media/radio/si4713/radio-platform-si4713.c | 18 +-
drivers/media/radio/si4713/radio-usb-si4713.c | 15 +-
drivers/media/radio/tea575x.c | 21 +-
drivers/media/test-drivers/vicodec/vicodec-core.c | 54 +++--
drivers/media/test-drivers/vim2m.c | 56 +++--
drivers/media/test-drivers/vimc/vimc-capture.c | 20 +-
drivers/media/test-drivers/visl/visl-video.c | 34 +--
drivers/media/test-drivers/vivid/vivid-core.c | 203 ++++++++++--------
drivers/media/test-drivers/vivid/vivid-meta-cap.c | 6 +-
drivers/media/test-drivers/vivid/vivid-meta-cap.h | 6 +-
drivers/media/test-drivers/vivid/vivid-meta-out.c | 6 +-
drivers/media/test-drivers/vivid/vivid-meta-out.h | 9 +-
drivers/media/test-drivers/vivid/vivid-radio-rx.c | 16 +-
drivers/media/test-drivers/vivid/vivid-radio-rx.h | 16 +-
drivers/media/test-drivers/vivid/vivid-radio-tx.c | 6 +-
drivers/media/test-drivers/vivid/vivid-radio-tx.h | 6 +-
drivers/media/test-drivers/vivid/vivid-sdr-cap.c | 30 ++-
drivers/media/test-drivers/vivid/vivid-sdr-cap.h | 30 ++-
drivers/media/test-drivers/vivid/vivid-touch-cap.c | 22 +-
drivers/media/test-drivers/vivid/vivid-touch-cap.h | 22 +-
drivers/media/test-drivers/vivid/vivid-vbi-cap.c | 26 ++-
drivers/media/test-drivers/vivid/vivid-vbi-cap.h | 22 +-
drivers/media/test-drivers/vivid/vivid-vbi-out.c | 22 +-
drivers/media/test-drivers/vivid/vivid-vbi-out.h | 18 +-
drivers/media/test-drivers/vivid/vivid-vid-cap.c | 114 ++++++----
drivers/media/test-drivers/vivid/vivid-vid-cap.h | 117 +++++++---
.../media/test-drivers/vivid/vivid-vid-common.c | 24 ++-
.../media/test-drivers/vivid/vivid-vid-common.h | 34 +--
drivers/media/test-drivers/vivid/vivid-vid-out.c | 122 ++++++-----
drivers/media/test-drivers/vivid/vivid-vid-out.h | 95 +++++---
drivers/media/usb/airspy/airspy.c | 37 ++--
drivers/media/usb/au0828/au0828-video.c | 74 ++++---
drivers/media/usb/cx231xx/cx231xx-417.c | 28 ++-
drivers/media/usb/cx231xx/cx231xx-video.c | 79 ++++---
drivers/media/usb/cx231xx/cx231xx.h | 39 ++--
drivers/media/usb/dvb-usb/cxusb-analog.c | 48 +++--
drivers/media/usb/em28xx/em28xx-video.c | 87 +++++---
drivers/media/usb/go7007/go7007-v4l2.c | 75 ++++---
drivers/media/usb/gspca/gspca.c | 51 +++--
drivers/media/usb/hackrf/hackrf.c | 39 ++--
drivers/media/usb/hdpvr/hdpvr-video.c | 60 ++++--
drivers/media/usb/msi2500/msi2500.c | 31 ++-
drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 98 ++++++---
drivers/media/usb/pwc/pwc-v4l.c | 44 ++--
drivers/media/usb/s2255/s2255drv.c | 55 +++--
drivers/media/usb/stk1160/stk1160-v4l.c | 40 ++--
drivers/media/usb/usbtv/usbtv-video.c | 24 ++-
drivers/media/usb/uvc/uvc_metadata.c | 17 +-
drivers/media/usb/uvc/uvc_v4l2.c | 59 +++--
drivers/media/v4l2-core/v4l2-ctrls-api.c | 2 +-
drivers/media/v4l2-core/v4l2-dev.c | 4 +-
drivers/media/v4l2-core/v4l2-mem2mem.c | 56 +++--
drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 72 ++++---
drivers/staging/media/av7110/av7110_v4l.c | 60 ++++--
.../media/deprecated/atmel/atmel-isc-base.c | 33 ++-
drivers/staging/media/imx/imx-media-capture.c | 53 +++--
drivers/staging/media/imx/imx-media-csc-scaler.c | 23 +-
drivers/staging/media/ipu3/ipu3-v4l2.c | 29 ++-
drivers/staging/media/ipu7/ipu7-isys-video.c | 30 ++-
drivers/staging/media/meson/vdec/vdec.c | 26 ++-
drivers/staging/media/starfive/camss/stf-video.c | 18 +-
drivers/staging/media/sunxi/cedrus/cedrus_video.c | 29 ++-
.../media/sunxi/sun6i-isp/sun6i_isp_capture.c | 24 ++-
.../media/sunxi/sun6i-isp/sun6i_isp_params.c | 9 +-
drivers/staging/media/tegra-video/vi.c | 68 ++++--
drivers/staging/most/video/video.c | 39 ++--
.../vc04_services/bcm2835-camera/bcm2835-camera.c | 58 +++--
drivers/usb/gadget/function/uvc_v4l2.c | 50 +++--
include/media/v4l2-ctrls.h | 5 +-
include/media/v4l2-dev.h | 2 +-
include/media/v4l2-ioctl.h | 238 +++++++++++----------
include/media/v4l2-mem2mem.h | 48 +++--
include/media/videobuf2-v4l2.h | 33 +--
223 files changed, 5392 insertions(+), 2955 deletions(-)
diff --git a/drivers/input/rmi4/rmi_f54.c b/drivers/input/rmi4/rmi_f54.c
index ac4041a69fcd3acf766ac8189ea0ecccb9b7ac93..b66b80d76833bfe56f04f70ce908307692632f48 100644
--- a/drivers/input/rmi4/rmi_f54.c
+++ b/drivers/input/rmi4/rmi_f54.c
@@ -383,7 +383,8 @@ static const struct vb2_queue rmi_f54_queue = {
.timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC,
};
-static int rmi_f54_vidioc_querycap(struct file *file, void *priv,
+static int rmi_f54_vidioc_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *cap)
{
struct f54_data *f54 = video_drvdata(file);
@@ -396,7 +397,8 @@ static int rmi_f54_vidioc_querycap(struct file *file, void *priv,
return 0;
}
-static int rmi_f54_vidioc_enum_input(struct file *file, void *priv,
+static int rmi_f54_vidioc_enum_input(struct file *file,
+ struct video_device_state *state,
struct v4l2_input *i)
{
struct f54_data *f54 = video_drvdata(file);
@@ -442,12 +444,15 @@ static int rmi_f54_set_input(struct f54_data *f54, unsigned int i)
return 0;
}
-static int rmi_f54_vidioc_s_input(struct file *file, void *priv, unsigned int i)
+static int rmi_f54_vidioc_s_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int i)
{
return rmi_f54_set_input(video_drvdata(file), i);
}
-static int rmi_f54_vidioc_g_input(struct file *file, void *priv,
+static int rmi_f54_vidioc_g_input(struct file *file,
+ struct video_device_state *state,
unsigned int *i)
{
struct f54_data *f54 = video_drvdata(file);
@@ -457,7 +462,8 @@ static int rmi_f54_vidioc_g_input(struct file *file, void *priv,
return 0;
}
-static int rmi_f54_vidioc_fmt(struct file *file, void *priv,
+static int rmi_f54_vidioc_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
struct f54_data *f54 = video_drvdata(file);
@@ -467,7 +473,8 @@ static int rmi_f54_vidioc_fmt(struct file *file, void *priv,
return 0;
}
-static int rmi_f54_vidioc_enum_fmt(struct file *file, void *priv,
+static int rmi_f54_vidioc_enum_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_fmtdesc *fmt)
{
struct f54_data *f54 = video_drvdata(file);
@@ -483,7 +490,8 @@ static int rmi_f54_vidioc_enum_fmt(struct file *file, void *priv,
return 0;
}
-static int rmi_f54_vidioc_g_parm(struct file *file, void *fh,
+static int rmi_f54_vidioc_g_parm(struct file *file,
+ struct video_device_state *state,
struct v4l2_streamparm *a)
{
if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 322d5a3d40a0933f1e1c290e906258a874bcf4b2..255e2e7713e3371b56736ded22b66d7df9cf8f49 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2547,7 +2547,8 @@ static const struct vb2_queue mxt_queue = {
.min_queued_buffers = 1,
};
-static int mxt_vidioc_querycap(struct file *file, void *priv,
+static int mxt_vidioc_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *cap)
{
struct mxt_data *data = video_drvdata(file);
@@ -2559,7 +2560,8 @@ static int mxt_vidioc_querycap(struct file *file, void *priv,
return 0;
}
-static int mxt_vidioc_enum_input(struct file *file, void *priv,
+static int mxt_vidioc_enum_input(struct file *file,
+ struct video_device_state *state,
struct v4l2_input *i)
{
if (i->index >= MXT_V4L_INPUT_MAX)
@@ -2604,12 +2606,16 @@ static int mxt_set_input(struct mxt_data *data, unsigned int i)
return 0;
}
-static int mxt_vidioc_s_input(struct file *file, void *priv, unsigned int i)
+static int mxt_vidioc_s_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int i)
{
return mxt_set_input(video_drvdata(file), i);
}
-static int mxt_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
+static int mxt_vidioc_g_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int *i)
{
struct mxt_data *data = video_drvdata(file);
@@ -2618,7 +2624,8 @@ static int mxt_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
return 0;
}
-static int mxt_vidioc_fmt(struct file *file, void *priv, struct v4l2_format *f)
+static int mxt_vidioc_fmt(struct file *file, struct video_device_state *state,
+ struct v4l2_format *f)
{
struct mxt_data *data = video_drvdata(file);
@@ -2628,7 +2635,8 @@ static int mxt_vidioc_fmt(struct file *file, void *priv, struct v4l2_format *f)
return 0;
}
-static int mxt_vidioc_enum_fmt(struct file *file, void *priv,
+static int mxt_vidioc_enum_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_fmtdesc *fmt)
{
if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -2650,7 +2658,8 @@ static int mxt_vidioc_enum_fmt(struct file *file, void *priv,
return 0;
}
-static int mxt_vidioc_g_parm(struct file *file, void *fh,
+static int mxt_vidioc_g_parm(struct file *file,
+ struct video_device_state *state,
struct v4l2_streamparm *a)
{
if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 7b3b10cbfcfc44eabd56a4a39551c44eed730de8..6bc51ad2cd0a47029aade52456003f3be90ec932 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -935,7 +935,8 @@ static void sur40_stop_streaming(struct vb2_queue *vq)
}
/* V4L ioctl */
-static int sur40_vidioc_querycap(struct file *file, void *priv,
+static int sur40_vidioc_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *cap)
{
struct sur40_state *sur40 = video_drvdata(file);
@@ -946,7 +947,8 @@ static int sur40_vidioc_querycap(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_enum_input(struct file *file, void *priv,
+static int sur40_vidioc_enum_input(struct file *file,
+ struct video_device_state *state,
struct v4l2_input *i)
{
if (i->index != 0)
@@ -958,18 +960,23 @@ static int sur40_vidioc_enum_input(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_s_input(struct file *file, void *priv, unsigned int i)
+static int sur40_vidioc_s_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int i)
{
return (i == 0) ? 0 : -EINVAL;
}
-static int sur40_vidioc_g_input(struct file *file, void *priv, unsigned int *i)
+static int sur40_vidioc_g_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int *i)
{
*i = 0;
return 0;
}
-static int sur40_vidioc_try_fmt(struct file *file, void *priv,
+static int sur40_vidioc_try_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
switch (f->fmt.pix.pixelformat) {
@@ -985,7 +992,8 @@ static int sur40_vidioc_try_fmt(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_s_fmt(struct file *file, void *priv,
+static int sur40_vidioc_s_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
struct sur40_state *sur40 = video_drvdata(file);
@@ -1004,7 +1012,8 @@ static int sur40_vidioc_s_fmt(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_g_fmt(struct file *file, void *priv,
+static int sur40_vidioc_g_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
struct sur40_state *sur40 = video_drvdata(file);
@@ -1038,7 +1047,8 @@ static int sur40_s_ctrl(struct v4l2_ctrl *ctrl)
return 0;
}
-static int sur40_ioctl_parm(struct file *file, void *priv,
+static int sur40_ioctl_parm(struct file *file,
+ struct video_device_state *state,
struct v4l2_streamparm *p)
{
if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
@@ -1051,7 +1061,8 @@ static int sur40_ioctl_parm(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
+static int sur40_vidioc_enum_fmt(struct file *file,
+ struct video_device_state *state,
struct v4l2_fmtdesc *f)
{
if (f->index >= ARRAY_SIZE(sur40_pix_format))
@@ -1062,7 +1073,8 @@ static int sur40_vidioc_enum_fmt(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
+static int sur40_vidioc_enum_framesizes(struct file *file,
+ struct video_device_state *state,
struct v4l2_frmsizeenum *f)
{
struct sur40_state *sur40 = video_drvdata(file);
@@ -1077,7 +1089,8 @@ static int sur40_vidioc_enum_framesizes(struct file *file, void *priv,
return 0;
}
-static int sur40_vidioc_enum_frameintervals(struct file *file, void *priv,
+static int sur40_vidioc_enum_frameintervals(struct file *file,
+ struct video_device_state *state,
struct v4l2_frmivalenum *f)
{
struct sur40_state *sur40 = video_drvdata(file);
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index e2eff17952ab237b799f9892159254146319f4c7..ebefd5e5c747aa9646d7a45414a661d076cf1e4a 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -1195,7 +1195,8 @@ static const struct cec_adap_ops extron_cec_adap_ops = {
.received = extron_received,
};
-static int extron_querycap(struct file *file, void *priv,
+static int extron_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *cap)
{
struct extron_port *port = video_drvdata(file);
@@ -1206,7 +1207,9 @@ static int extron_querycap(struct file *file, void *priv,
return 0;
}
-static int extron_enum_input(struct file *file, void *priv, struct v4l2_input *inp)
+static int extron_enum_input(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_input *inp)
{
struct extron_port *port = video_drvdata(file);
@@ -1219,18 +1222,22 @@ static int extron_enum_input(struct file *file, void *priv, struct v4l2_input *i
return 0;
}
-static int extron_g_input(struct file *file, void *priv, unsigned int *i)
+static int extron_g_input(struct file *file, struct video_device_state *state,
+ unsigned int *i)
{
*i = 0;
return 0;
}
-static int extron_s_input(struct file *file, void *priv, unsigned int i)
+static int extron_s_input(struct file *file, struct video_device_state *state,
+ unsigned int i)
{
return i ? -EINVAL : 0;
}
-static int extron_enum_output(struct file *file, void *priv, struct v4l2_output *out)
+static int extron_enum_output(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_output *out)
{
struct extron_port *port = video_drvdata(file);
@@ -1241,18 +1248,21 @@ static int extron_enum_output(struct file *file, void *priv, struct v4l2_output
return 0;
}
-static int extron_g_output(struct file *file, void *priv, unsigned int *o)
+static int extron_g_output(struct file *file,
+ struct video_device_state *state, unsigned int *o)
{
*o = 0;
return 0;
}
-static int extron_s_output(struct file *file, void *priv, unsigned int o)
+static int extron_s_output(struct file *file,
+ struct video_device_state *state, unsigned int o)
{
return o ? -EINVAL : 0;
}
-static int extron_g_edid(struct file *file, void *priv,
+static int extron_g_edid(struct file *file,
+ struct video_device_state *state,
struct v4l2_edid *edid)
{
struct extron_port *port = video_drvdata(file);
@@ -1280,7 +1290,8 @@ static int extron_g_edid(struct file *file, void *priv,
return 0;
}
-static int extron_s_edid(struct file *file, void *priv, struct v4l2_edid *edid)
+static int extron_s_edid(struct file *file, struct video_device_state *state,
+ struct v4l2_edid *edid)
{
struct extron_port *port = video_drvdata(file);
@@ -1305,12 +1316,13 @@ static int extron_s_edid(struct file *file, void *priv, struct v4l2_edid *edid)
return extron_write_edid(port, edid->edid, edid->blocks);
}
-static int extron_log_status(struct file *file, void *priv)
+static int extron_log_status(struct file *file,
+ struct video_device_state *state)
{
struct extron_port *port = video_drvdata(file);
extron_adap_status(port->adap, NULL);
- return v4l2_ctrl_log_status(file, priv);
+ return v4l2_ctrl_log_status(file, state);
}
static const struct v4l2_ioctl_ops extron_ioctl_ops = {
diff --git a/drivers/media/common/saa7146/saa7146_video.c b/drivers/media/common/saa7146/saa7146_video.c
index 733e18001d0d418d32c517b80dee57130b379b07..768be0c6bfdeee70939fbe872a85e99fafe4cd25 100644
--- a/drivers/media/common/saa7146/saa7146_video.c
+++ b/drivers/media/common/saa7146/saa7146_video.c
@@ -251,7 +251,9 @@ static void video_end(struct saa7146_dev *dev)
saa7146_res_free(dev, resource);
}
-static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
+static int vidioc_querycap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_capability *cap)
{
struct saa7146_dev *dev = video_drvdata(file);
@@ -264,7 +266,9 @@ static int vidioc_querycap(struct file *file, void *fh, struct v4l2_capability *
return 0;
}
-static int vidioc_enum_fmt_vid_cap(struct file *file, void *fh, struct v4l2_fmtdesc *f)
+static int vidioc_enum_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_fmtdesc *f)
{
if (f->index >= ARRAY_SIZE(formats))
return -EINVAL;
@@ -323,7 +327,8 @@ int saa7146_s_ctrl(struct v4l2_ctrl *ctrl)
return 0;
}
-static int vidioc_g_parm(struct file *file, void *fh,
+static int vidioc_g_parm(struct file *file,
+ struct video_device_state *state,
struct v4l2_streamparm *parm)
{
struct saa7146_dev *dev = video_drvdata(file);
@@ -337,7 +342,9 @@ static int vidioc_g_parm(struct file *file, void *fh,
return 0;
}
-static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
+static int vidioc_g_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_format *f)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
@@ -346,7 +353,9 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
return 0;
}
-static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format *f)
+static int vidioc_g_fmt_vbi_cap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_format *f)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
@@ -355,7 +364,9 @@ static int vidioc_g_fmt_vbi_cap(struct file *file, void *fh, struct v4l2_format
return 0;
}
-static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
+static int vidioc_try_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_format *f)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
@@ -364,7 +375,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
int maxw, maxh;
int calc_bpl;
- DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh);
+ DEB_EE("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, state);
fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat);
if (NULL == fmt)
@@ -417,7 +428,9 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma
return 0;
}
-static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f)
+static int vidioc_s_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_format *f)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
@@ -428,7 +441,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
DEB_EE("streaming capture is active\n");
return -EBUSY;
}
- err = vidioc_try_fmt_vid_cap(file, fh, f);
+ err = vidioc_try_fmt_vid_cap(file, state, f);
if (0 != err)
return err;
switch (f->fmt.pix.field) {
@@ -445,7 +458,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format
return 0;
}
-static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm)
+static int vidioc_g_std(struct file *file, struct video_device_state *state,
+ v4l2_std_id *norm)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
@@ -454,7 +468,8 @@ static int vidioc_g_std(struct file *file, void *fh, v4l2_std_id *norm)
return 0;
}
-static int vidioc_s_std(struct file *file, void *fh, v4l2_std_id id)
+static int vidioc_s_std(struct file *file, struct video_device_state *state,
+ v4l2_std_id id)
{
struct saa7146_dev *dev = video_drvdata(file);
struct saa7146_vv *vv = dev->vv_data;
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
index d911021c1bb0527777d2da18bef8f0562e32b460..01f0ee4f81d1c478e3ad80f30c97ceccb9e542d8 100644
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
@@ -996,7 +996,8 @@ EXPORT_SYMBOL_GPL(vb2_poll);
/* vb2 ioctl helpers */
-int vb2_ioctl_remove_bufs(struct file *file, void *priv,
+int vb2_ioctl_remove_bufs(struct file *file,
+ struct video_device_state *state,
struct v4l2_remove_buffers *d)
{
struct video_device *vdev = video_devdata(file);
@@ -1014,7 +1015,8 @@ int vb2_ioctl_remove_bufs(struct file *file, void *priv,
}
EXPORT_SYMBOL_GPL(vb2_ioctl_remove_bufs);
-int vb2_ioctl_reqbufs(struct file *file, void *priv,
+int vb2_ioctl_reqbufs(struct file *file,
+ struct video_device_state *state,
struct v4l2_requestbuffers *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1037,7 +1039,8 @@ int vb2_ioctl_reqbufs(struct file *file, void *priv,
}
EXPORT_SYMBOL_GPL(vb2_ioctl_reqbufs);
-int vb2_ioctl_create_bufs(struct file *file, void *priv,
+int vb2_ioctl_create_bufs(struct file *file,
+ struct video_device_state *state,
struct v4l2_create_buffers *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1064,7 +1067,8 @@ int vb2_ioctl_create_bufs(struct file *file, void *priv,
}
EXPORT_SYMBOL_GPL(vb2_ioctl_create_bufs);
-int vb2_ioctl_prepare_buf(struct file *file, void *priv,
+int vb2_ioctl_prepare_buf(struct file *file,
+ struct video_device_state *state,
struct v4l2_buffer *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1075,7 +1079,8 @@ int vb2_ioctl_prepare_buf(struct file *file, void *priv,
}
EXPORT_SYMBOL_GPL(vb2_ioctl_prepare_buf);
-int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p)
+int vb2_ioctl_querybuf(struct file *file, struct video_device_state *state,
+ struct v4l2_buffer *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1084,7 +1089,8 @@ int vb2_ioctl_querybuf(struct file *file, void *priv, struct v4l2_buffer *p)
}
EXPORT_SYMBOL_GPL(vb2_ioctl_querybuf);
-int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
+int vb2_ioctl_qbuf(struct file *file, struct video_device_state *state,
+ struct v4l2_buffer *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1094,7 +1100,8 @@ int vb2_ioctl_qbuf(struct file *file, void *priv, struct v4l2_buffer *p)
}
EXPORT_SYMBOL_GPL(vb2_ioctl_qbuf);
-int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
+int vb2_ioctl_dqbuf(struct file *file, struct video_device_state *state,
+ struct v4l2_buffer *p)
{
struct video_device *vdev = video_devdata(file);
@@ -1104,7 +1111,8 @@ int vb2_ioctl_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p)
}
EXPORT_SYMBOL_GPL(vb2_ioctl_dqbuf);
-int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
+int vb2_ioctl_streamon(struct file *file, struct video_device_state *state,
+ enum v4l2_buf_type i)
{
struct video_device *vdev = video_devdata(file);
@@ -1114,7 +1122,8 @@ int vb2_ioctl_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
}
EXPORT_SYMBOL_GPL(vb2_ioctl_streamon);
-int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
+int vb2_ioctl_streamoff(struct file *file, struct video_device_state *state,
+ enum v4l2_buf_type i)
{
struct video_device *vdev = video_devdata(file);
@@ -1124,7 +1133,8 @@ int vb2_ioctl_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
}
EXPORT_SYMBOL_GPL(vb2_ioctl_streamoff);
-int vb2_ioctl_expbuf(struct file *file, void *priv, struct v4l2_exportbuffer *p)
+int vb2_ioctl_expbuf(struct file *file, struct video_device_state *state,
+ struct v4l2_exportbuffer *p)
{
struct video_device *vdev = video_devdata(file);
diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c
index 0357624968f1b542772d8cc751211c0bf28e19ab..986637c4bec7da0dc8a13ded8829e11b0f8a4415 100644
--- a/drivers/media/dvb-frontends/rtl2832_sdr.c
+++ b/drivers/media/dvb-frontends/rtl2832_sdr.c
@@ -418,8 +418,8 @@ static void rtl2832_sdr_cleanup_queued_bufs(struct rtl2832_sdr_dev *dev)
spin_unlock_irqrestore(&dev->queued_bufs_lock, flags);
}
-static int rtl2832_sdr_querycap(struct file *file, void *fh,
- struct v4l2_capability *cap)
+static int rtl2832_sdr_querycap(struct file *file,
+ struct video_device_state *state, struct v4l2_capability *cap)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -949,8 +949,8 @@ static const struct vb2_ops rtl2832_sdr_vb2_ops = {
.stop_streaming = rtl2832_sdr_stop_streaming,
};
-static int rtl2832_sdr_g_tuner(struct file *file, void *priv,
- struct v4l2_tuner *v)
+static int rtl2832_sdr_g_tuner(struct file *file,
+ struct video_device_state *state, struct v4l2_tuner *v)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -981,8 +981,8 @@ static int rtl2832_sdr_g_tuner(struct file *file, void *priv,
return ret;
}
-static int rtl2832_sdr_s_tuner(struct file *file, void *priv,
- const struct v4l2_tuner *v)
+static int rtl2832_sdr_s_tuner(struct file *file,
+ struct video_device_state *state, const struct v4l2_tuner *v)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -1003,7 +1003,8 @@ static int rtl2832_sdr_s_tuner(struct file *file, void *priv,
return ret;
}
-static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv,
+static int rtl2832_sdr_enum_freq_bands(struct file *file,
+ struct video_device_state *state,
struct v4l2_frequency_band *band)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
@@ -1034,8 +1035,8 @@ static int rtl2832_sdr_enum_freq_bands(struct file *file, void *priv,
return ret;
}
-static int rtl2832_sdr_g_frequency(struct file *file, void *priv,
- struct v4l2_frequency *f)
+static int rtl2832_sdr_g_frequency(struct file *file,
+ struct video_device_state *state, struct v4l2_frequency *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -1061,7 +1062,8 @@ static int rtl2832_sdr_g_frequency(struct file *file, void *priv,
return ret;
}
-static int rtl2832_sdr_s_frequency(struct file *file, void *priv,
+static int rtl2832_sdr_s_frequency(struct file *file,
+ struct video_device_state *state,
const struct v4l2_frequency *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
@@ -1105,8 +1107,8 @@ static int rtl2832_sdr_s_frequency(struct file *file, void *priv,
return ret;
}
-static int rtl2832_sdr_enum_fmt_sdr_cap(struct file *file, void *priv,
- struct v4l2_fmtdesc *f)
+static int rtl2832_sdr_enum_fmt_sdr_cap(struct file *file,
+ struct video_device_state *state, struct v4l2_fmtdesc *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -1121,8 +1123,8 @@ static int rtl2832_sdr_enum_fmt_sdr_cap(struct file *file, void *priv,
return 0;
}
-static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file,
+ struct video_device_state *state, struct v4l2_format *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -1135,8 +1137,8 @@ static int rtl2832_sdr_g_fmt_sdr_cap(struct file *file, void *priv,
return 0;
}
-static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file,
+ struct video_device_state *state, struct v4l2_format *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
@@ -1166,8 +1168,8 @@ static int rtl2832_sdr_s_fmt_sdr_cap(struct file *file, void *priv,
return 0;
}
-static int rtl2832_sdr_try_fmt_sdr_cap(struct file *file, void *priv,
- struct v4l2_format *f)
+static int rtl2832_sdr_try_fmt_sdr_cap(struct file *file,
+ struct video_device_state *state, struct v4l2_format *f)
{
struct rtl2832_sdr_dev *dev = video_drvdata(file);
struct platform_device *pdev = dev->pdev;
diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c
index 0dd991d70d538050731c0106533d6f0618853b1f..96c1b9e7db719602cada653257d77ee6e103d319 100644
--- a/drivers/media/i2c/video-i2c.c
+++ b/drivers/media/i2c/video-i2c.c
@@ -558,7 +558,8 @@ static const struct vb2_ops video_i2c_video_qops = {
.stop_streaming = stop_streaming,
};
-static int video_i2c_querycap(struct file *file, void *priv,
+static int video_i2c_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *vcap)
{
struct video_i2c_data *data = video_drvdata(file);
@@ -573,19 +574,24 @@ static int video_i2c_querycap(struct file *file, void *priv,
return 0;
}
-static int video_i2c_g_input(struct file *file, void *fh, unsigned int *inp)
+static int video_i2c_g_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int *inp)
{
*inp = 0;
return 0;
}
-static int video_i2c_s_input(struct file *file, void *fh, unsigned int inp)
+static int video_i2c_s_input(struct file *file,
+ struct video_device_state *state,
+ unsigned int inp)
{
return (inp > 0) ? -EINVAL : 0;
}
-static int video_i2c_enum_input(struct file *file, void *fh,
+static int video_i2c_enum_input(struct file *file,
+ struct video_device_state *state,
struct v4l2_input *vin)
{
if (vin->index > 0)
@@ -598,7 +604,8 @@ static int video_i2c_enum_input(struct file *file, void *fh,
return 0;
}
-static int video_i2c_enum_fmt_vid_cap(struct file *file, void *fh,
+static int video_i2c_enum_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_fmtdesc *fmt)
{
struct video_i2c_data *data = video_drvdata(file);
@@ -613,7 +620,8 @@ static int video_i2c_enum_fmt_vid_cap(struct file *file, void *fh,
return 0;
}
-static int video_i2c_enum_framesizes(struct file *file, void *fh,
+static int video_i2c_enum_framesizes(struct file *file,
+ struct video_device_state *state,
struct v4l2_frmsizeenum *fsize)
{
const struct video_i2c_data *data = video_drvdata(file);
@@ -633,7 +641,8 @@ static int video_i2c_enum_framesizes(struct file *file, void *fh,
return 0;
}
-static int video_i2c_enum_frameintervals(struct file *file, void *priv,
+static int video_i2c_enum_frameintervals(struct file *file,
+ struct video_device_state *state,
struct v4l2_frmivalenum *fe)
{
const struct video_i2c_data *data = video_drvdata(file);
@@ -651,7 +660,8 @@ static int video_i2c_enum_frameintervals(struct file *file, void *priv,
return 0;
}
-static int video_i2c_try_fmt_vid_cap(struct file *file, void *fh,
+static int video_i2c_try_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *fmt)
{
const struct video_i2c_data *data = video_drvdata(file);
@@ -670,7 +680,8 @@ static int video_i2c_try_fmt_vid_cap(struct file *file, void *fh,
return 0;
}
-static int video_i2c_s_fmt_vid_cap(struct file *file, void *fh,
+static int video_i2c_s_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *fmt)
{
struct video_i2c_data *data = video_drvdata(file);
@@ -678,10 +689,11 @@ static int video_i2c_s_fmt_vid_cap(struct file *file, void *fh,
if (vb2_is_busy(&data->vb_vidq))
return -EBUSY;
- return video_i2c_try_fmt_vid_cap(file, fh, fmt);
+ return video_i2c_try_fmt_vid_cap(file, state, fmt);
}
-static int video_i2c_g_parm(struct file *filp, void *priv,
+static int video_i2c_g_parm(struct file *filp,
+ struct video_device_state *state,
struct v4l2_streamparm *parm)
{
struct video_i2c_data *data = video_drvdata(filp);
@@ -696,7 +708,8 @@ static int video_i2c_g_parm(struct file *filp, void *priv,
return 0;
}
-static int video_i2c_s_parm(struct file *filp, void *priv,
+static int video_i2c_s_parm(struct file *filp,
+ struct video_device_state *state,
struct v4l2_streamparm *parm)
{
struct video_i2c_data *data = video_drvdata(filp);
@@ -709,7 +722,7 @@ static int video_i2c_s_parm(struct file *filp, void *priv,
}
data->frame_interval = data->chip->frame_intervals[i];
- return video_i2c_g_parm(filp, priv, parm);
+ return video_i2c_g_parm(filp, state, parm);
}
static const struct v4l2_ioctl_ops video_i2c_ioctl_ops = {
diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c
index 17e4529e537ab654bd6814dceda005ad652c8533..e9b8e7a53fdbf69262f574b52fdafe79bf9ec8f2 100644
--- a/drivers/media/pci/bt8xx/bttv-driver.c
+++ b/drivers/media/pci/bt8xx/bttv-driver.c
@@ -1597,7 +1597,8 @@ static void radio_enable(struct bttv *btv)
}
}
-static int bttv_s_std(struct file *file, void *priv, v4l2_std_id id)
+static int bttv_s_std(struct file *file, struct video_device_state *state,
+ v4l2_std_id id)
{
struct bttv *btv = video_drvdata(file);
unsigned int i;
@@ -1612,7 +1613,8 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id id)
return 0;
}
-static int bttv_g_std(struct file *file, void *priv, v4l2_std_id *id)
+static int bttv_g_std(struct file *file, struct video_device_state *state,
+ v4l2_std_id *id)
{
struct bttv *btv = video_drvdata(file);
@@ -1620,7 +1622,8 @@ static int bttv_g_std(struct file *file, void *priv, v4l2_std_id *id)
return 0;
}
-static int bttv_querystd(struct file *file, void *priv, v4l2_std_id *id)
+static int bttv_querystd(struct file *file, struct video_device_state *state,
+ v4l2_std_id *id)
{
struct bttv *btv = video_drvdata(file);
@@ -1631,7 +1634,8 @@ static int bttv_querystd(struct file *file, void *priv, v4l2_std_id *id)
return 0;
}
-static int bttv_enum_input(struct file *file, void *priv,
+static int bttv_enum_input(struct file *file,
+ struct video_device_state *state,
struct v4l2_input *i)
{
struct bttv *btv = video_drvdata(file);
@@ -1664,7 +1668,8 @@ static int bttv_enum_input(struct file *file, void *priv,
return 0;
}
-static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
+static int bttv_g_input(struct file *file, struct video_device_state *state,
+ unsigned int *i)
{
struct bttv *btv = video_drvdata(file);
@@ -1673,7 +1678,8 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i)
return 0;
}
-static int bttv_s_input(struct file *file, void *priv, unsigned int i)
+static int bttv_s_input(struct file *file, struct video_device_state *state,
+ unsigned int i)
{
struct bttv *btv = video_drvdata(file);
@@ -1684,7 +1690,8 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i)
return 0;
}
-static int bttv_s_tuner(struct file *file, void *priv,
+static int bttv_s_tuner(struct file *file,
+ struct video_device_state *state,
const struct v4l2_tuner *t)
{
struct bttv *btv = video_drvdata(file);
@@ -1702,7 +1709,8 @@ static int bttv_s_tuner(struct file *file, void *priv,
return 0;
}
-static int bttv_g_frequency(struct file *file, void *priv,
+static int bttv_g_frequency(struct file *file,
+ struct video_device_state *state,
struct v4l2_frequency *f)
{
struct bttv *btv = video_drvdata(file);
@@ -1738,7 +1746,8 @@ static void bttv_set_frequency(struct bttv *btv, const struct v4l2_frequency *f)
}
}
-static int bttv_s_frequency(struct file *file, void *priv,
+static int bttv_s_frequency(struct file *file,
+ struct video_device_state *state,
const struct v4l2_frequency *f)
{
struct bttv *btv = video_drvdata(file);
@@ -1750,7 +1759,8 @@ static int bttv_s_frequency(struct file *file, void *priv,
return 0;
}
-static int bttv_log_status(struct file *file, void *priv)
+static int bttv_log_status(struct file *file,
+ struct video_device_state *state)
{
struct video_device *vdev = video_devdata(file);
struct bttv *btv = video_drvdata(file);
@@ -1761,7 +1771,8 @@ static int bttv_log_status(struct file *file, void *priv)
}
#ifdef CONFIG_VIDEO_ADV_DEBUG
-static int bttv_g_register(struct file *file, void *priv,
+static int bttv_g_register(struct file *file,
+ struct video_device_state *state,
struct v4l2_dbg_register *reg)
{
struct bttv *btv = video_drvdata(file);
@@ -1774,7 +1785,8 @@ static int bttv_g_register(struct file *file, void *priv,
return 0;
}
-static int bttv_s_register(struct file *file, void *priv,
+static int bttv_s_register(struct file *file,
+ struct video_device_state *state,
const struct v4l2_dbg_register *reg)
{
struct bttv *btv = video_drvdata(file);
@@ -1981,7 +1993,8 @@ pix_format_set_size (struct v4l2_pix_format * f,
}
}
-static int bttv_g_fmt_vid_cap(struct file *file, void *priv,
+static int bttv_g_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
struct bttv *btv = video_drvdata(file);
@@ -2007,7 +2020,8 @@ static void bttv_get_width_mask_vid_cap(const struct bttv_format *fmt,
}
}
-static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
+static int bttv_try_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
const struct bttv_format *fmt;
@@ -2062,7 +2076,8 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
+static int bttv_s_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_format *f)
{
int retval;
@@ -2076,7 +2091,7 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
if (0 != retval)
return retval;
- retval = bttv_try_fmt_vid_cap(file, priv, f);
+ retval = bttv_try_fmt_vid_cap(file, state, f);
if (0 != retval)
return retval;
@@ -2109,7 +2124,8 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-static int bttv_querycap(struct file *file, void *priv,
+static int bttv_querycap(struct file *file,
+ struct video_device_state *state,
struct v4l2_capability *cap)
{
struct bttv *btv = video_drvdata(file);
@@ -2140,7 +2156,8 @@ static int bttv_querycap(struct file *file, void *priv,
return 0;
}
-static int bttv_enum_fmt_vid_cap(struct file *file, void *priv,
+static int bttv_enum_fmt_vid_cap(struct file *file,
+ struct video_device_state *state,
struct v4l2_fmtdesc *f)
{
int index = -1, i;
@@ -2159,7 +2176,8 @@ static int bttv_enum_fmt_vid_cap(struct file *file, void *priv,
return 0;
}
-static int bttv_g_parm(struct file *file, void *priv,
+static int bttv_g_parm(struct file *file,
+ struct video_device_state *state,
struct v4l2_streamparm *parm)
{
struct bttv *btv = video_drvdata(file);
@@ -2173,7 +2191,8 @@ static int bttv_g_parm(struct file *file, void *priv,
return 0;
}
-static int bttv_g_tuner(struct file *file, void *priv,
+static int bttv_g_tuner(struct file *file,
+ struct video_device_state *state,
struct v4l2_tuner *t)
{
struct bttv *btv = video_drvdata(file);
@@ -2195,8 +2214,9 @@ static int bttv_g_tuner(struct file *file, void *priv,
return 0;
}
-static int bttv_g_pixelaspect(struct file *file, void *priv,
- int type, struct v4l2_fract *f)
+static int bttv_g_pixelaspect(struct file *file,
+ struct video_device_state *state, int type,
+ struct v4l2_fract *f)
{
struct bttv *btv = video_drvdata(file);
@@ -2208,7 +2228,9 @@ static int bttv_g_pixelaspect(struct file *file, void *priv,
return 0;
}
-static int bttv_g_selection(struct file *file, void *priv, struct v4l2_selection *sel)
+static int bttv_g_selection(struct file *file,
+ struct video_device_state *state,
+ struct v4l2_selection *sel)
{
struct btt...
[truncated message content] |
|
From: Jai L. <jai...@id...> - 2025-09-19 10:15:26
|
Hi, This patch series introduces state management for video devices. Currently, V4L2 subdevices have a well-established state management system [1] that allows the framework to store the subdevice state at a central location. Video devices however lack this, leading to inconsistent state handling across drivers and making it difficult to implement features like hardware multiplexing in complex media pipelines [2]. The series is composed of three parts: - Core Infrastructure (PATCH 1-4) Introduces the basic state structure, try state support, initialization callbacks, and driver helpers - Framework Integration (PATCH 5-7) Integrates state passing through the ioctl wrappers and driver implementations - Driver Examples (PATCH 8-10) Use the state to store formats in TI J721E CSI2RX and Rockchip RKISP1 drivers This should also provide a foundation for drivers to extend or subclass the state structure with device-specific variables in future. I have tested capture and format negotiation with the converted drivers on SK AM62A (j721e-csi2rx) and Debix Model A (rkisp1). [1]: https://lore.kernel.org/linux-media/202...@id.../ [2]: https://lore.kernel.org/linux-media/202...@id.../ Signed-off-by: Jai Luthra <jai...@id...> --- Changes in v2: - Drop RFC tag - Rebase on top of latest media tree, that includes multiple changes by Jacopo and Laurent, which removes all usage of passing v4l2_fh through the opaque pointer in ioctl implementations, replacing it with a NULL pointer - Allocate the state dynamically, and free it when done with the device or the filehandle - Introduce an init_state callback so that drivers can initialize the state after allocation - Pass the video device state (as an explicitly typed pointer) to all ioctl implemenation across all drivers - Split the single patch introducing video device state into separate patches each making a single logical change before the state is actually passed to the drivers in PATCH 7 - In drivers, use a helper to access the current format from the state - Move the queue busy check back to the drivers, as some codecs and VBI devices may support changing formats, so the framework shouldn't return -EBUSY - Drop pixel format info and configuration storage from rkisp1 internal strucutre, and calculate them on the fly - Fix other review comments from Sakari, Laurent and Jacopo, except those around dropping the enum and using try_fmt hook to update only the state, and s_fmt hook to update hardware registers - Link to v1: https://lore.kernel.org/r/202...@id... --- Jai Luthra (10): media: v4l2-core: Introduce state management for video devices media: v4l2-dev: Add support for try state media: v4l2-dev: Add callback for initializing video device state media: v4l2-dev: Add helpers to get current format from the state media: v4l2-ioctl: Add video_device_state argument to v4l2 ioctl wrappers media: Replace void * with video_device_state * in all driver ioctl implementations media: v4l2-ioctl: Pass device state for G/S/TRY_FMT ioctls media: ti: j721e-csi2rx: Use video_device_state media: rkisp1: Use video_device_state media: rkisp1: Calculate format information on demand drivers/input/rmi4/rmi_f54.c | 22 +- drivers/input/touchscreen/atmel_mxt_ts.c | 23 +- drivers/input/touchscreen/sur40.c | 35 +- .../extron-da-hd-4k-plus/extron-da-hd-4k-plus.c | 34 +- drivers/media/common/saa7146/saa7146_video.c | 37 +- drivers/media/common/videobuf2/videobuf2-v4l2.c | 30 +- drivers/media/dvb-frontends/rtl2832_sdr.c | 38 +- drivers/media/i2c/video-i2c.c | 39 ++- drivers/media/pci/bt8xx/bttv-driver.c | 84 +++-- drivers/media/pci/bt8xx/bttv-vbi.c | 11 +- drivers/media/pci/bt8xx/bttvp.h | 9 +- drivers/media/pci/cobalt/cobalt-v4l2.c | 98 +++--- drivers/media/pci/cx18/cx18-driver.c | 9 +- drivers/media/pci/cx18/cx18-ioctl.c | 114 +++--- drivers/media/pci/cx18/cx18-ioctl.h | 9 +- drivers/media/pci/cx23885/cx23885-417.c | 53 +-- drivers/media/pci/cx23885/cx23885-ioctl.c | 8 +- drivers/media/pci/cx23885/cx23885-ioctl.h | 9 +- drivers/media/pci/cx23885/cx23885-vbi.c | 5 +- drivers/media/pci/cx23885/cx23885-video.c | 82 +++-- drivers/media/pci/cx23885/cx23885.h | 4 +- drivers/media/pci/cx25821/cx25821-video.c | 57 ++- drivers/media/pci/cx88/cx88-blackbird.c | 47 ++- drivers/media/pci/cx88/cx88-vbi.c | 2 +- drivers/media/pci/cx88/cx88-video.c | 56 ++- drivers/media/pci/cx88/cx88.h | 2 +- drivers/media/pci/dt3155/dt3155.c | 25 +- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 29 +- drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 41 ++- drivers/media/pci/ivtv/ivtv-driver.c | 8 +- drivers/media/pci/ivtv/ivtv-ioctl.c | 225 ++++++++---- drivers/media/pci/ivtv/ivtv-ioctl.h | 6 +- drivers/media/pci/mgb4/mgb4_vin.c | 55 ++- drivers/media/pci/mgb4/mgb4_vout.c | 49 ++- drivers/media/pci/saa7134/saa7134-empress.c | 12 +- drivers/media/pci/saa7134/saa7134-video.c | 96 ++++-- drivers/media/pci/saa7134/saa7134.h | 38 +- drivers/media/pci/saa7146/hexium_gemini.c | 10 +- drivers/media/pci/saa7146/hexium_orion.c | 10 +- drivers/media/pci/saa7146/mxb.c | 46 ++- drivers/media/pci/saa7164/saa7164-encoder.c | 39 ++- drivers/media/pci/saa7164/saa7164-vbi.c | 27 +- drivers/media/pci/saa7164/saa7164.h | 9 +- drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c | 46 ++- drivers/media/pci/solo6x10/solo6x10-v4l2.c | 32 +- drivers/media/pci/ttpci/budget-av.c | 10 +- drivers/media/pci/tw5864/tw5864-video.c | 49 ++- drivers/media/pci/tw68/tw68-video.c | 43 ++- drivers/media/pci/tw686x/tw686x-video.c | 53 ++- drivers/media/pci/zoran/zoran_driver.c | 44 ++- drivers/media/platform/allegro-dvt/allegro-core.c | 49 ++- .../media/platform/amlogic/c3/isp/c3-isp-capture.c | 18 +- .../media/platform/amlogic/c3/isp/c3-isp-params.c | 9 +- .../media/platform/amlogic/c3/isp/c3-isp-stats.c | 9 +- drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 36 +- drivers/media/platform/amphion/vdec.c | 30 +- drivers/media/platform/amphion/venc.c | 49 ++- drivers/media/platform/aspeed/aspeed-video.c | 50 ++- drivers/media/platform/atmel/atmel-isi.c | 36 +- drivers/media/platform/broadcom/bcm2835-unicam.c | 33 +- .../media/platform/chips-media/coda/coda-common.c | 69 ++-- .../platform/chips-media/wave5/wave5-helper.c | 2 +- .../platform/chips-media/wave5/wave5-helper.h | 3 +- .../platform/chips-media/wave5/wave5-vpu-dec.c | 54 ++- .../platform/chips-media/wave5/wave5-vpu-enc.c | 62 +++- .../media/platform/imagination/e5010-jpeg-enc.c | 34 +- drivers/media/platform/intel/pxa_camera.c | 34 +- drivers/media/platform/m2m-deinterlace.c | 34 +- drivers/media/platform/marvell/mcam-core.c | 52 +-- .../media/platform/mediatek/jpeg/mtk_jpeg_core.c | 44 ++- drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 34 +- .../media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 25 +- .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 52 ++- .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 50 ++- .../media/platform/microchip/microchip-isc-base.c | 33 +- drivers/media/platform/nuvoton/npcm-video.c | 43 ++- drivers/media/platform/nvidia/tegra-vde/v4l2.c | 38 +- drivers/media/platform/nxp/dw100/dw100.c | 35 +- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 52 ++- drivers/media/platform/nxp/imx-pxp.c | 34 +- drivers/media/platform/nxp/imx7-media-csi.c | 21 +- drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 15 +- .../media/platform/nxp/imx8-isi/imx8-isi-video.c | 18 +- drivers/media/platform/nxp/mx2_emmaprp.c | 31 +- drivers/media/platform/qcom/camss/camss-video.c | 27 +- drivers/media/platform/qcom/iris/iris_vidc.c | 48 ++- drivers/media/platform/qcom/venus/vdec.c | 29 +- drivers/media/platform/qcom/venus/venc.c | 38 +- .../media/platform/raspberrypi/pisp_be/pisp_be.c | 42 ++- drivers/media/platform/raspberrypi/rp1-cfe/cfe.c | 40 ++- .../media/platform/renesas/rcar-vin/rcar-v4l2.c | 21 +- drivers/media/platform/renesas/rcar_drif.c | 30 +- drivers/media/platform/renesas/rcar_fdp1.c | 18 +- drivers/media/platform/renesas/rcar_jpu.c | 21 +- drivers/media/platform/renesas/renesas-ceu.c | 36 +- .../media/platform/renesas/rzg2l-cru/rzg2l-video.c | 18 +- drivers/media/platform/renesas/sh_vou.c | 41 ++- drivers/media/platform/renesas/vsp1/vsp1_histo.c | 9 +- drivers/media/platform/renesas/vsp1/vsp1_video.c | 18 +- drivers/media/platform/rockchip/rga/rga.c | 24 +- .../platform/rockchip/rkisp1/rkisp1-capture.c | 289 ++++++++-------- .../media/platform/rockchip/rkisp1/rkisp1-common.h | 10 - .../media/platform/rockchip/rkisp1/rkisp1-params.c | 15 +- .../media/platform/rockchip/rkisp1/rkisp1-stats.c | 9 +- drivers/media/platform/rockchip/rkvdec/rkvdec.c | 34 +- .../media/platform/samsung/exynos-gsc/gsc-m2m.c | 44 ++- .../platform/samsung/exynos4-is/fimc-capture.c | 45 ++- .../platform/samsung/exynos4-is/fimc-isp-video.c | 32 +- .../media/platform/samsung/exynos4-is/fimc-lite.c | 36 +- .../media/platform/samsung/exynos4-is/fimc-m2m.c | 21 +- .../platform/samsung/s3c-camif/camif-capture.c | 54 ++- drivers/media/platform/samsung/s5p-g2d/g2d.c | 26 +- .../media/platform/samsung/s5p-jpeg/jpeg-core.c | 34 +- .../media/platform/samsung/s5p-mfc/s5p_mfc_dec.c | 48 ++- .../media/platform/samsung/s5p-mfc/s5p_mfc_enc.c | 51 ++- drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 26 +- drivers/media/platform/st/sti/delta/delta-v4l2.c | 44 ++- drivers/media/platform/st/sti/hva/hva-v4l2.c | 46 ++- drivers/media/platform/st/stm32/dma2d/dma2d.c | 18 +- drivers/media/platform/st/stm32/stm32-dcmi.c | 42 ++- .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c | 20 +- .../media/platform/sunxi/sun4i-csi/sun4i_v4l2.c | 25 +- .../platform/sunxi/sun6i-csi/sun6i_csi_capture.c | 24 +- drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 31 +- .../platform/sunxi/sun8i-rotate/sun8i_rotate.c | 34 +- .../media/platform/synopsys/hdmirx/snps_hdmirx.c | 47 ++- drivers/media/platform/ti/am437x/am437x-vpfe.c | 52 ++- drivers/media/platform/ti/cal/cal-video.c | 54 ++- drivers/media/platform/ti/davinci/vpif_capture.c | 94 ++--- drivers/media/platform/ti/davinci/vpif_display.c | 58 ++-- .../media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 127 +++---- drivers/media/platform/ti/omap/omap_vout.c | 49 ++- drivers/media/platform/ti/omap3isp/ispvideo.c | 53 ++- drivers/media/platform/ti/vpe/vpe.c | 25 +- drivers/media/platform/verisilicon/hantro_v4l2.c | 47 ++- drivers/media/platform/via/via-camera.c | 42 ++- drivers/media/platform/xilinx/xilinx-dma.c | 15 +- drivers/media/radio/dsbr100.c | 15 +- drivers/media/radio/radio-cadet.c | 18 +- drivers/media/radio/radio-isa.c | 18 +- drivers/media/radio/radio-keene.c | 15 +- drivers/media/radio/radio-ma901.c | 15 +- drivers/media/radio/radio-miropcm20.c | 15 +- drivers/media/radio/radio-mr800.c | 18 +- drivers/media/radio/radio-raremono.c | 19 +- drivers/media/radio/radio-sf16fmi.c | 15 +- drivers/media/radio/radio-si476x.c | 28 +- drivers/media/radio/radio-tea5764.c | 15 +- drivers/media/radio/radio-tea5777.c | 21 +- drivers/media/radio/radio-timb.c | 26 +- drivers/media/radio/si470x/radio-si470x-common.c | 25 +- drivers/media/radio/si4713/radio-platform-si4713.c | 18 +- drivers/media/radio/si4713/radio-usb-si4713.c | 15 +- drivers/media/radio/tea575x.c | 21 +- drivers/media/test-drivers/vicodec/vicodec-core.c | 54 +-- drivers/media/test-drivers/vim2m.c | 56 +-- drivers/media/test-drivers/vimc/vimc-capture.c | 20 +- drivers/media/test-drivers/visl/visl-video.c | 34 +- drivers/media/test-drivers/vivid/vivid-core.c | 203 ++++++----- drivers/media/test-drivers/vivid/vivid-meta-cap.c | 6 +- drivers/media/test-drivers/vivid/vivid-meta-cap.h | 6 +- drivers/media/test-drivers/vivid/vivid-meta-out.c | 6 +- drivers/media/test-drivers/vivid/vivid-meta-out.h | 9 +- drivers/media/test-drivers/vivid/vivid-radio-rx.c | 16 +- drivers/media/test-drivers/vivid/vivid-radio-rx.h | 16 +- drivers/media/test-drivers/vivid/vivid-radio-tx.c | 6 +- drivers/media/test-drivers/vivid/vivid-radio-tx.h | 6 +- drivers/media/test-drivers/vivid/vivid-sdr-cap.c | 30 +- drivers/media/test-drivers/vivid/vivid-sdr-cap.h | 30 +- drivers/media/test-drivers/vivid/vivid-touch-cap.c | 22 +- drivers/media/test-drivers/vivid/vivid-touch-cap.h | 22 +- drivers/media/test-drivers/vivid/vivid-vbi-cap.c | 26 +- drivers/media/test-drivers/vivid/vivid-vbi-cap.h | 22 +- drivers/media/test-drivers/vivid/vivid-vbi-out.c | 22 +- drivers/media/test-drivers/vivid/vivid-vbi-out.h | 18 +- drivers/media/test-drivers/vivid/vivid-vid-cap.c | 114 +++--- drivers/media/test-drivers/vivid/vivid-vid-cap.h | 117 +++++-- .../media/test-drivers/vivid/vivid-vid-common.c | 24 +- .../media/test-drivers/vivid/vivid-vid-common.h | 34 +- drivers/media/test-drivers/vivid/vivid-vid-out.c | 122 ++++--- drivers/media/test-drivers/vivid/vivid-vid-out.h | 95 +++-- drivers/media/usb/airspy/airspy.c | 37 +- drivers/media/usb/au0828/au0828-video.c | 74 ++-- drivers/media/usb/cx231xx/cx231xx-417.c | 28 +- drivers/media/usb/cx231xx/cx231xx-video.c | 79 +++-- drivers/media/usb/cx231xx/cx231xx.h | 39 ++- drivers/media/usb/dvb-usb/cxusb-analog.c | 48 ++- drivers/media/usb/em28xx/em28xx-video.c | 87 +++-- drivers/media/usb/go7007/go7007-v4l2.c | 75 ++-- drivers/media/usb/gspca/gspca.c | 51 ++- drivers/media/usb/hackrf/hackrf.c | 39 ++- drivers/media/usb/hdpvr/hdpvr-video.c | 60 ++-- drivers/media/usb/msi2500/msi2500.c | 31 +- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 98 ++++-- drivers/media/usb/pwc/pwc-v4l.c | 44 ++- drivers/media/usb/s2255/s2255drv.c | 55 ++- drivers/media/usb/stk1160/stk1160-v4l.c | 40 ++- drivers/media/usb/usbtv/usbtv-video.c | 24 +- drivers/media/usb/uvc/uvc_metadata.c | 17 +- drivers/media/usb/uvc/uvc_v4l2.c | 59 +++- drivers/media/v4l2-core/v4l2-ctrls-api.c | 2 +- drivers/media/v4l2-core/v4l2-dev.c | 66 ++++ drivers/media/v4l2-core/v4l2-fh.c | 6 + drivers/media/v4l2-core/v4l2-ioctl.c | 381 +++++++++++---------- drivers/media/v4l2-core/v4l2-mem2mem.c | 56 +-- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 72 ++-- drivers/staging/media/av7110/av7110_v4l.c | 60 +++- .../media/deprecated/atmel/atmel-isc-base.c | 33 +- drivers/staging/media/imx/imx-media-capture.c | 53 ++- drivers/staging/media/imx/imx-media-csc-scaler.c | 23 +- drivers/staging/media/ipu3/ipu3-v4l2.c | 29 +- drivers/staging/media/ipu7/ipu7-isys-video.c | 30 +- drivers/staging/media/meson/vdec/vdec.c | 26 +- drivers/staging/media/starfive/camss/stf-video.c | 18 +- drivers/staging/media/sunxi/cedrus/cedrus_video.c | 29 +- .../media/sunxi/sun6i-isp/sun6i_isp_capture.c | 24 +- .../media/sunxi/sun6i-isp/sun6i_isp_params.c | 9 +- drivers/staging/media/tegra-video/vi.c | 68 ++-- drivers/staging/most/video/video.c | 39 ++- .../vc04_services/bcm2835-camera/bcm2835-camera.c | 58 ++-- drivers/usb/gadget/function/uvc_v4l2.c | 50 ++- include/media/v4l2-ctrls.h | 5 +- include/media/v4l2-dev.h | 84 +++++ include/media/v4l2-fh.h | 2 + include/media/v4l2-ioctl.h | 238 ++++++------- include/media/v4l2-mem2mem.h | 48 ++- include/media/videobuf2-v4l2.h | 33 +- 227 files changed, 5946 insertions(+), 3322 deletions(-) --- base-commit: 680fa38ea3a19131871a90bac05a610e6247d928 change-id: 20250703-vdev-state-0743baa0ad4b Best regards, -- Jai Luthra <jai...@id...> |
|
From: Vladimir Z. <vla...@li...> - 2025-08-24 19:07:31
|
Hi Jacopo, thank you for the change! On 8/2/25 12:22, Jacopo Mondi wrote: > The 'file->private_data' pointer is reset in the vb2_fop_release() > call path. For this reason a custom handler for the .release > file operation is not needed and the driver can use > vb2_fop_release() directly. > > Signed-off-by: Jacopo Mondi <jac...@id...> Tested-by: Vladimir Zapolskiy <vla...@li...> Reviewed-by: Vladimir Zapolskiy <vla...@li...> -- Best wishes, Vladimir |
|
From: Vladimir Z. <vla...@li...> - 2025-08-24 19:04:55
|
Hi Jacopo, Laurent, thank you for the nice clean-up. On 8/2/25 12:22, Jacopo Mondi wrote: > From: Laurent Pinchart <lau...@id...> > > The custom video_open() function in the camss driver open-codes the > v4l2_fh_open() helper, with an additional mutex that protects the whole > function. Given that the function does not modify any data guarded by > the lock, there's no need for using the mutex and the function can be > replaced by v4l2_fh_open(). > > Signed-off-by: Laurent Pinchart <lau...@id...> > Signed-off-by: Jacopo Mondi <jac...@id...> Tested-by: Vladimir Zapolskiy <vla...@li...> Reviewed-by: Vladimir Zapolskiy <vla...@li...> -- Best wishes, Vladimir |
|
From: Lukasz S. <l.s...@sa...> - 2025-08-18 14:28:04
|
It was <2025-08-02 sob 11:22>, when Jacopo Mondi wrote:
> From: Laurent Pinchart <lau...@id...>
>
> Accessing file->private_data manually to retrieve the v4l2_fh pointer is
> error-prone, as the field is a void * and will happily cast implicitly
> to any pointer type.
>
> Replace all remaining locations that read the v4l2_fh pointer directly
> from file->private_data and cast it to driver-specific file handle
> structures with driver-specific functions that use file_to_v4l2_fh() and
> perform the same cast.
>
> No functional change is intended, this only paves the way to remove
> direct accesses to file->private_data and make V4L2 drivers safer.
> Other accesses to the field will be addressed separately.
>
> Signed-off-by: Laurent Pinchart <lau...@id...>
> Signed-off-by: Jacopo Mondi <jac...@id...>
> ---
[...]
> diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/platform/samsung/s5p-g2d/g2d.c
> index ffed16a34493be2edbdaee13619467417487c1e7..44fcedbbc90a9863827aacbcd5f56d850cb552ea 100644
> --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c
> +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c
> @@ -25,7 +25,10 @@
> #include "g2d.h"
> #include "g2d-regs.h"
>
> -#define fh2ctx(__fh) container_of(__fh, struct g2d_ctx, fh)
> +static inline struct g2d_ctx *file2ctx(struct file *filp)
> +{
> + return container_of(file_to_v4l2_fh(filp), struct g2d_ctx, fh);
> +}
>
> static struct g2d_fmt formats[] = {
> {
> @@ -272,7 +275,7 @@ static int g2d_open(struct file *file)
> static int g2d_release(struct file *file)
> {
> struct g2d_dev *dev = video_drvdata(file);
> - struct g2d_ctx *ctx = fh2ctx(file->private_data);
> + struct g2d_ctx *ctx = file2ctx(file);
>
> mutex_lock(&dev->mutex);
> v4l2_m2m_ctx_release(ctx->fh.m2m_ctx);
Acked-by: Lukasz Stelmach <l.s...@sa...>
[...]
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
|
|
From: Lukasz S. <l.s...@sa...> - 2025-08-18 14:23:09
|
It was <2025-08-02 sob 11:22>, when Jacopo Mondi wrote: > From: Laurent Pinchart <lau...@id...> > > Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset > the file->private_data pointer to NULL in their video device .release() > file operation handler. Move the code to the v4l2_fh_del() function to > avoid direct access to file->private_data in drivers. This requires > adding a file pointer argument to the function. [...] > diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/platform/samsung/s5p-g2d/g2d.c > index e34cae9c9cf65d3161822b68233d28472171f917..922262f61e7b53baf1b5840d35149bf5b4b2e7ad 100644 > --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c > +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c > @@ -280,7 +280,7 @@ static int g2d_release(struct file *file) > v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); > mutex_unlock(&dev->mutex); > v4l2_ctrl_handler_free(&ctx->ctrl_handler); > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > kfree(ctx); > v4l2_info(&dev->v4l2_dev, "instance closed\n"); > diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c > index c4ad0196ed8f1bf579365a0a21dd8c4a78bdaa10..2a57efd181540183e7d2b66d51f9f2f274ddd100 100644 > --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c > +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c > @@ -1005,7 +1005,7 @@ static int s5p_jpeg_open(struct file *file) > return 0; > > error: > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > mutex_unlock(&jpeg->lock); > free: > @@ -1021,7 +1021,7 @@ static int s5p_jpeg_release(struct file *file) > mutex_lock(&jpeg->lock); > v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); > v4l2_ctrl_handler_free(&ctx->ctrl_handler); > - v4l2_fh_del(&ctx->fh); > + v4l2_fh_del(&ctx->fh, file); > v4l2_fh_exit(&ctx->fh); > kfree(ctx); > mutex_unlock(&jpeg->lock); Acked-by: Łukasz Stelmach <l.s...@sa...> [...] -- Łukasz Stelmach Samsung R&D Institute Poland Samsung Electronics |
|
From: Laurent P. <lau...@id...> - 2025-08-10 01:32:29
|
From: Jacopo Mondi <jac...@id...>
Unless there is a good reason to do so, naming variable with double
underscore is generally not a good idea.
Rename the (mostly unused) __fh argument to ioctl handlers to fh.
Signed-off-by: Jacopo Mondi <jac...@id...>
Signed-off-by: Laurent Pinchart <lau...@id...>
---
drivers/media/pci/zoran/zoran_driver.c | 36 +++++++++++++-------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index ec7fc1da4cc0..5b4d5dd06edb 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -245,7 +245,7 @@ static int zoran_set_input(struct zoran *zr, int input)
* ioctl routine
*/
-static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap)
+static int zoran_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{
struct zoran *zr = video_drvdata(file);
@@ -278,7 +278,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
return -EINVAL;
}
-static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_enum_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_fmtdesc *f)
{
struct zoran *zr = video_drvdata(file);
@@ -286,7 +286,7 @@ static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,
return zoran_enum_fmt(zr, f, ZORAN_FORMAT_CAPTURE);
}
-static int zoran_g_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_g_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -308,13 +308,13 @@ static int zoran_g_fmt_vid_out(struct file *file, void *__fh,
return 0;
}
-static int zoran_g_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_g_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
if (zr->map_mode != ZORAN_MAP_MODE_RAW)
- return zoran_g_fmt_vid_out(file, __fh, fmt);
+ return zoran_g_fmt_vid_out(file, fh, fmt);
fmt->fmt.pix.width = zr->v4l_settings.width;
fmt->fmt.pix.height = zr->v4l_settings.height;
fmt->fmt.pix.sizeimage = zr->buffer_size;
@@ -328,7 +328,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh,
return 0;
}
-static int zoran_try_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_try_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -391,7 +391,7 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh,
return res;
}
-static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_try_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -399,7 +399,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
int i;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_try_fmt_vid_out(file, __fh, fmt);
+ return zoran_try_fmt_vid_out(file, fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat)
@@ -427,7 +427,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
return 0;
}
-static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_s_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -507,7 +507,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
return res;
}
-static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_s_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -515,7 +515,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
int res = 0;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_s_fmt_vid_out(file, __fh, fmt);
+ return zoran_s_fmt_vid_out(file, fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
@@ -555,7 +555,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
return res;
}
-static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std)
+static int zoran_g_std(struct file *file, void *fh, v4l2_std_id *std)
{
struct zoran *zr = video_drvdata(file);
@@ -563,7 +563,7 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std)
return 0;
}
-static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)
+static int zoran_s_std(struct file *file, void *fh, v4l2_std_id std)
{
struct zoran *zr = video_drvdata(file);
int res = 0;
@@ -578,7 +578,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)
return res;
}
-static int zoran_enum_input(struct file *file, void *__fh,
+static int zoran_enum_input(struct file *file, void *fh,
struct v4l2_input *inp)
{
struct zoran *zr = video_drvdata(file);
@@ -595,7 +595,7 @@ static int zoran_enum_input(struct file *file, void *__fh,
return 0;
}
-static int zoran_g_input(struct file *file, void *__fh, unsigned int *input)
+static int zoran_g_input(struct file *file, void *fh, unsigned int *input)
{
struct zoran *zr = video_drvdata(file);
@@ -604,7 +604,7 @@ static int zoran_g_input(struct file *file, void *__fh, unsigned int *input)
return 0;
}
-static int zoran_s_input(struct file *file, void *__fh, unsigned int input)
+static int zoran_s_input(struct file *file, void *fh, unsigned int input)
{
struct zoran *zr = video_drvdata(file);
int res;
@@ -617,7 +617,7 @@ static int zoran_s_input(struct file *file, void *__fh, unsigned int input)
}
/* cropping (sub-frame capture) */
-static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selection *sel)
+static int zoran_g_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{
struct zoran *zr = video_drvdata(file);
@@ -652,7 +652,7 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio
return 0;
}
-static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selection *sel)
+static int zoran_s_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{
struct zoran *zr = video_drvdata(file);
struct zoran_jpg_settings settings;
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-10 01:32:27
|
From: Jacopo Mondi <jac...@id...>
The zoran_fh structure is a wrapper around v4l2_fh. Its usage has been
mostly removed by commit 83f89a8bcbc3 ("media: zoran: convert to vb2"),
but the structure stayed by mistake. It is now used in a single
location, assigned from a void pointer and then recast to a void
pointer, without being every accessed. Drop it.
Fixes: 83f89a8bcbc3 ("media: zoran: convert to vb2")
Signed-off-by: Jacopo Mondi <jac...@id...>
Signed-off-by: Laurent Pinchart <lau...@id...>
---
drivers/media/pci/zoran/zoran.h | 6 ------
drivers/media/pci/zoran/zoran_driver.c | 3 +--
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
index 1cd990468d3d..d05e222b3921 100644
--- a/drivers/media/pci/zoran/zoran.h
+++ b/drivers/media/pci/zoran/zoran.h
@@ -154,12 +154,6 @@ struct zoran_jpg_settings {
struct zoran;
-/* zoran_fh contains per-open() settings */
-struct zoran_fh {
- struct v4l2_fh fh;
- struct zoran *zr;
-};
-
struct card_info {
enum card_type type;
char name[32];
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index f42f596d3e62..ec7fc1da4cc0 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -511,12 +511,11 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
- struct zoran_fh *fh = __fh;
int i;
int res = 0;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_s_fmt_vid_out(file, fh, fmt);
+ return zoran_s_fmt_vid_out(file, __fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-10 01:31:33
|
Hello, Apologies for sending v3 right after v2, I realized just a tad too late that I made a mistake and sent the wrong patches. This patch series refactors v4l2_fh support to make the API easier to use, simplify drivers, and overall improve consistency through the whole subsystem. In V4L2, drivers that need to store per file handle data allocate their per file handle data structure in the .open() handler and set the struct file private_data field to point to it. The private_data field is entirely managed by drivers, and is generally opaque to the V4L2 framework. The V4L2 framework also needs to store per file handle data to support features such as V4L2 events or per file handle controls. To make use of those features, driver need to use the v4l2_fh structure to store per file handle data, either as-is, or embedded in a driver-specific structure. In either case, drivers must initialize the v4l2_fh structure with v4l2_fh_init(), and set the file private_data field to point to the v4l2_fh structure. The initialization operation sets the V4L2_FL_USES_V4L2_FH flag in the video_device.flags field, which indicates to the V4L2 core that private_data points to a valid v4l2_fh. In practice, while v4l2_fh usage is optional, all V4L2 drivers make use of it. As all new drivers are required to use v4l2_fh, this situation will not change, and opens the door to lots of simplifications in the V4L2 core and in drivers. The series starts with patches 01/76 to 07/76 that align the behaviour of all drivers, ensuring they all store a v4l2_fh pointer in the file private_data. Seven drivers store a pointer to driver-specific structures that embed v4l2_fh. This causes no issue in practice as the v4l2_fh field is always the first one in all those structures, but the code lacks coherency. After that, the series eliminates direct access to the file private_data. Patch 08/76 introduces a helper to retrieve the v4l2_fh from the file, and patches 09/76 to 11/76 use the helper in drivers. Patches 12/76 to 25/76 are assorted refactoring and cleanup that prepare drivers to remove the last manual accesses to private_data. Patches 26/76 and 27/27 drop those, by setting private_data in the v4l2_fh_add() helper, and resetting it to NULL in v4l2_fh_del(). Prior refactoring makes it possible for those last two patches to be generated by coccinelle with only small manual additions. Patches 28/76 to 32/76 then move to simplify the V4L2 core. As all drivers are guaranteed to use v4l2_fh, all the V4L2_FL_USES_V4L2_FH checks can be dropped. Patch 32/76 does so. It however stops short of dropping V4L2_FL_USES_V4L2_FH completely, and instead adds a temporary check in the open file operation to verify that the driver uses v4l2_fh. That check could be dropped after a few kernel releases. The second part of the series, address a second source of inconsistent behaviours in drivers. The V4L2 core passes to most ioctl handlers both the file pointer and the file private_data pointer, with the latter being passed as a void pointer. Not only is the void pointer redundant, as driver can (and do in many cases) access the per file data from the file private_data field, but passing a v4l2_fh through a void pointer is error-prone as incorrect casts wouldn't be noticed by the compiler. To fix this, patches 33/76 to 68/76 replace all usage of the void pointer, retrieving instead the v4l2_fh from the file structure. Patches 69/76 and 70/76 then pass a NULL value through the ioctl void pointer argument, to ensure no new driver will try to access the v4l2_fh from there. They also rename the 'void *fh' argument to the ioctl handler definitions to 'void *priv'. Finally, patches 71/76 to 76/76 also rename the same arguments in several locations: - in the test drivers, the uvcvideo driver and the v4l2-pci-skeleton driver due to their role as sample and reference code (71/76 to 73/76) ; - in the V4L2 core (74/76) ; and - in all drivers that use names other than the most common 'void *priv' and 'void *fh', in order to standardize on those two names only (75/76 and 76/76). Renaming all remaining 'void *fh' to 'void *priv' would be lots of additional churn, and this series is big enough. Furthermore, we have plans to introduce a new video_device_state argument to ioctl handlers. We will likely remove the 'void *' argument at that time, to avoid modifying all ioctl handlers in all drivers twice in a short amount of time. This series is based on the latest linux-media next branch. It has a soft dependency on the "[PATCH 0/4] Remove the wl1273 FM Radio" series ([1]) in the sense that the wl1273 driver is the very last V4L2 driver that does not use v4l2_fh. Merging this series first would break the wl1273 driver (at runtime), but given that the driver is scheduled for removal due to having no user, this shouldn't be an issue. Compared to v1, all review comments have been addressed. The most notable changes are - the removal of the V4L2_FL_USES_V4L2_FH checks - the push of the NULL private pointer to the ioctl wrappers - the reintroduction of the 'void *' parameter name in the ioctl handler definitions (now named 'priv'), - the rename of the 'void *' arguments in drivers and in the V4L2 core Link to v1: https://lore.kernel.org/r/202...@id... [1] https://lore.kernel.org/linux-media/202...@tr.../ Jacopo Mondi (37): media: rcar-vin: Do not set file->private_data media: rzg2l-cru: Do not set file->private_data media: camss: Remove custom .release fop() media: zoran: Remove zoran_fh structure media: zoran: Rename __fh to fh media: v4l2-ioctl: Access v4l2_fh from private_data media: allegro: Access v4l2_fh from file media: meson-ge2d: Access v4l2_fh from file media: coda: Access v4l2_fh from file media: wave5: Access v4l2_fh from file media: m2m-deinterlace: Access v4l2_fh from file media: mtk: jpeg: Access v4l2_fh from file->private_data media: mtk_mdp_m2m: Access v4l2_fh from file media: mtk: mdp3: Access v4l2_fh from file media: mtk: vcodec: Access v4l2_fh from file media: tegra-vde: Access v4l2_fh from file media: imx-jpeg: Access v4l2_fh from file media: imx-isi: Access v4l2_fh from file media: nxp: mx2: Access v4l2_fh from file media: renesas: Access v4l2_fh from file media: rockhip: rga: Access v4l2_fh from file media: rockchip: rkvdec: Access v4l2_fh from file media: exynos-gsc: Access v4l2_fh from file media: exynos4-is: Access v4l2_fh from file media: s3c-camif: Access v4l2_fh from file media: s5p-g2d: Access v4l2_fh from file media: s5p-jpeg: Access v4l2_fh from file media: s5p-mfc: Access v4l2_fh from file media: bdisp: Access v4l2_fh from file media: st: delta: Access v4l2_fh from file media: stm32: dma2d: Access v4l2_fh from file media: omap3isp: Access v4l2_fh from file media: cx18: Access v4l2_fh from file media: ivtv: Access v4l2_fh from file media: usb: hdpvr: Access v4l2_fh from file media: usb: uvc: Access v4l2_fh from file media: staging: imx: Access v4l2_fh from file Laurent Pinchart (39): media: pci: saa7164: Store v4l2_fh pointer in file->private_data media: imagination: Store v4l2_fh pointer in file->private_data media: ti: vpe: Store v4l2_fh pointer in file->private_data media: usb: hdpvr: Store v4l2_fh pointer in file->private_data media: usb: pvrusb2: Store v4l2_fh pointer in file->private_data media: usb: uvcvideo: Store v4l2_fh pointer in file->private_data media: staging: most: Store v4l2_fh pointer in file->private_data media: Wrap file->private_data access with a helper function media: Replace file->private_data access with file_to_v4l2_fh() media: nvidia: tegra-vde: Replace file->private_data access media: Replace file->private_data access with custom functions media: pci: ivtv: Don't create fake v4l2_fh media: amphion: Make some vpu_v4l2 functions static media: amphion: Delete v4l2_fh synchronously in .release() media: visl: Drop visl_v4l2fh_to_ctx() function media: v4l2-fh: Move piece of documentation to correct function media: camss: Replace .open() file operation with v4l2_fh_open() media: chips-media: wave5: Pass file pointer to wave5_cleanup_instance() media: qcom: iris: Pass file pointer to iris_v4l2_fh_(de)init() media: qcom: iris: Set file->private_data in iris_v4l2_fh_(de)init() media: qcom: iris: Drop unused argument to iris_get_inst() media: qcom: venus: Pass file pointer to venus_close_common() media: Set file->private_data in v4l2_fh_add() media: Reset file->private_data to NULL in v4l2_fh_del() media: ipu6: isys: Don't set V4L2_FL_USES_V4L2_FH manually media: staging: ipu7: isys: Don't set V4L2_FL_USES_V4L2_FH manually media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check media: v4l2-dev: Make open and release file operations mandatory media: Drop V4L2_FL_USES_V4L2_FH checks media: s5p-mfc: Store s5p_mfc_ctx in vb2_queue.drv_priv media: hantro: Access v4l2_fh from file->private_data media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers media: v4l2-ioctl: Push NULL fh argument down to ioctl wrappers media: test-drivers: Rename second ioctl handlers argument to 'void *priv' media: uvcvideo: Rename second ioctl handlers argument to 'void *priv' media: v4l2-pci-skeleton: Rename second ioctl handlers argument to 'void *priv' media: v4l2-core: Rename second ioctl handlers argument to 'void *priv' media: v4l2: Rename second ioctl handlers argument to 'void *priv' media: staging: Rename second ioctl handlers argument to 'void *priv' Documentation/driver-api/media/v4l2-fh.rst | 59 ++- .../zh_CN/video4linux/v4l2-framework.txt | 16 +- .../extron-da-hd-4k-plus.c | 4 +- .../media/common/videobuf2/videobuf2-v4l2.c | 12 +- drivers/media/pci/bt8xx/bttv-driver.c | 14 +- drivers/media/pci/bt8xx/bttv-vbi.c | 6 +- drivers/media/pci/cobalt/cobalt-v4l2.c | 60 +-- drivers/media/pci/cx18/cx18-driver.h | 2 +- drivers/media/pci/cx18/cx18-fileops.c | 11 +- drivers/media/pci/cx18/cx18-ioctl.c | 64 +-- .../media/pci/intel/ipu6/ipu6-isys-video.c | 1 - drivers/media/pci/ivtv/ivtv-alsa-pcm.c | 2 - drivers/media/pci/ivtv/ivtv-driver.h | 7 +- drivers/media/pci/ivtv/ivtv-fileops.c | 40 +- drivers/media/pci/ivtv/ivtv-ioctl.c | 124 ++--- drivers/media/pci/ivtv/ivtv-irq.c | 4 +- drivers/media/pci/saa7134/saa7134-video.c | 4 +- drivers/media/pci/saa7164/saa7164-encoder.c | 30 +- drivers/media/pci/saa7164/saa7164-vbi.c | 25 +- drivers/media/pci/saa7164/saa7164.h | 10 + drivers/media/pci/zoran/zoran.h | 6 - drivers/media/pci/zoran/zoran_driver.c | 35 +- .../media/platform/allegro-dvt/allegro-core.c | 33 +- .../media/platform/amlogic/meson-ge2d/ge2d.c | 25 +- drivers/media/platform/amphion/vpu.h | 2 +- drivers/media/platform/amphion/vpu_v4l2.c | 22 +- drivers/media/platform/amphion/vpu_v4l2.h | 8 - .../platform/chips-media/coda/coda-common.c | 50 +- .../platform/chips-media/wave5/wave5-helper.c | 10 +- .../platform/chips-media/wave5/wave5-helper.h | 2 +- .../chips-media/wave5/wave5-vpu-dec.c | 23 +- .../chips-media/wave5/wave5-vpu-enc.c | 29 +- .../platform/chips-media/wave5/wave5-vpu.h | 5 + .../platform/imagination/e5010-jpeg-enc.c | 23 +- .../platform/imagination/e5010-jpeg-enc.h | 5 + drivers/media/platform/m2m-deinterlace.c | 26 +- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 37 +- .../media/platform/mediatek/mdp/mtk_mdp_m2m.c | 29 +- .../platform/mediatek/mdp3/mtk-mdp3-m2m.c | 25 +- .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 36 +- .../vcodec/decoder/mtk_vcodec_dec_drv.c | 9 +- .../vcodec/decoder/mtk_vcodec_dec_drv.h | 5 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 9 +- .../vcodec/encoder/mtk_vcodec_enc_drv.h | 4 +- .../media/platform/nvidia/tegra-vde/v4l2.c | 35 +- drivers/media/platform/nxp/dw100/dw100.c | 7 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 45 +- drivers/media/platform/nxp/imx-pxp.c | 7 +- .../platform/nxp/imx8-isi/imx8-isi-m2m.c | 21 +- drivers/media/platform/nxp/mx2_emmaprp.c | 24 +- .../media/platform/qcom/camss/camss-video.c | 43 +- drivers/media/platform/qcom/iris/iris_vidc.c | 36 +- drivers/media/platform/qcom/venus/core.c | 4 +- drivers/media/platform/qcom/venus/core.h | 4 +- drivers/media/platform/qcom/venus/vdec.c | 5 +- drivers/media/platform/qcom/venus/venc.c | 5 +- .../platform/renesas/rcar-vin/rcar-v4l2.c | 2 - drivers/media/platform/renesas/rcar_fdp1.c | 17 +- drivers/media/platform/renesas/rcar_jpu.c | 27 +- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 1 - .../media/platform/renesas/vsp1/vsp1_histo.c | 6 +- .../media/platform/renesas/vsp1/vsp1_video.c | 18 +- drivers/media/platform/rockchip/rga/rga.c | 30 +- drivers/media/platform/rockchip/rga/rga.h | 5 + .../media/platform/rockchip/rkvdec/rkvdec.c | 21 +- .../media/platform/rockchip/rkvdec/rkvdec.h | 4 +- .../platform/samsung/exynos-gsc/gsc-core.h | 6 +- .../platform/samsung/exynos-gsc/gsc-m2m.c | 37 +- .../platform/samsung/exynos4-is/fimc-core.h | 5 +- .../platform/samsung/exynos4-is/fimc-m2m.c | 19 +- .../samsung/s3c-camif/camif-capture.c | 26 +- drivers/media/platform/samsung/s5p-g2d/g2d.c | 40 +- .../platform/samsung/s5p-jpeg/jpeg-core.c | 33 +- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 17 +- .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 6 +- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 34 +- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 38 +- .../media/platform/st/sti/bdisp/bdisp-v4l2.c | 30 +- .../media/platform/st/sti/delta/delta-v4l2.c | 41 +- drivers/media/platform/st/sti/hva/hva-v4l2.c | 38 +- drivers/media/platform/st/sti/hva/hva.h | 2 - drivers/media/platform/st/stm32/dma2d/dma2d.c | 28 +- .../sunxi/sun6i-csi/sun6i_csi_capture.c | 16 +- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 10 +- .../sunxi/sun8i-rotate/sun8i_rotate.c | 10 +- .../platform/synopsys/hdmirx/snps_hdmirx.c | 8 +- .../platform/ti/j721e-csi2rx/j721e-csi2rx.c | 2 +- drivers/media/platform/ti/omap/omap_vout.c | 6 +- drivers/media/platform/ti/omap3isp/ispvideo.c | 36 +- drivers/media/platform/ti/omap3isp/ispvideo.h | 6 +- drivers/media/platform/ti/vpe/vpe.c | 21 +- drivers/media/platform/verisilicon/hantro.h | 4 +- .../media/platform/verisilicon/hantro_drv.c | 10 +- .../media/platform/verisilicon/hantro_v4l2.c | 22 +- drivers/media/platform/xilinx/xilinx-dma.c | 10 +- .../radio/si4713/radio-platform-si4713.c | 10 +- .../media/test-drivers/vicodec/vicodec-core.c | 21 +- drivers/media/test-drivers/vim2m.c | 7 +- .../media/test-drivers/vimc/vimc-capture.c | 2 +- drivers/media/test-drivers/visl/visl-core.c | 5 +- drivers/media/test-drivers/visl/visl.h | 7 +- drivers/media/test-drivers/vivid/vivid-core.c | 100 ++-- .../media/test-drivers/vivid/vivid-radio-rx.c | 12 +- .../media/test-drivers/vivid/vivid-radio-rx.h | 8 +- .../media/test-drivers/vivid/vivid-radio-tx.c | 8 +- .../media/test-drivers/vivid/vivid-radio-tx.h | 4 +- .../media/test-drivers/vivid/vivid-sdr-cap.c | 18 +- .../media/test-drivers/vivid/vivid-sdr-cap.h | 18 +- .../media/test-drivers/vivid/vivid-vbi-cap.c | 10 +- .../media/test-drivers/vivid/vivid-vbi-cap.h | 8 +- .../media/test-drivers/vivid/vivid-vbi-out.c | 8 +- .../media/test-drivers/vivid/vivid-vbi-out.h | 6 +- .../media/test-drivers/vivid/vivid-vid-cap.c | 24 +- .../media/test-drivers/vivid/vivid-vid-cap.h | 24 +- .../test-drivers/vivid/vivid-vid-common.c | 8 +- .../test-drivers/vivid/vivid-vid-common.h | 8 +- .../media/test-drivers/vivid/vivid-vid-out.c | 16 +- .../media/test-drivers/vivid/vivid-vid-out.h | 16 +- drivers/media/usb/cx231xx/cx231xx-417.c | 2 +- drivers/media/usb/gspca/gspca.c | 18 +- drivers/media/usb/hdpvr/hdpvr-video.c | 69 +-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 69 +-- drivers/media/usb/uvc/uvc_metadata.c | 22 +- drivers/media/usb/uvc/uvc_v4l2.c | 85 ++-- drivers/media/usb/uvc/uvcvideo.h | 5 + drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 9 +- drivers/media/v4l2-core/v4l2-ctrls-api.c | 11 +- drivers/media/v4l2-core/v4l2-dev.c | 45 +- drivers/media/v4l2-core/v4l2-fh.c | 16 +- drivers/media/v4l2-core/v4l2-ioctl.c | 456 +++++++++--------- drivers/media/v4l2-core/v4l2-mem2mem.c | 50 +- drivers/media/v4l2-core/v4l2-subdev.c | 16 +- .../staging/media/imx/imx-media-csc-scaler.c | 26 +- drivers/staging/media/ipu7/ipu7-isys-video.c | 1 - drivers/staging/media/meson/vdec/vdec.c | 29 +- drivers/staging/media/meson/vdec/vdec.h | 5 + drivers/staging/media/sunxi/cedrus/cedrus.c | 8 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 5 + .../staging/media/sunxi/cedrus/cedrus_video.c | 5 - .../media/sunxi/sun6i-isp/sun6i_isp_capture.c | 16 +- .../media/sunxi/sun6i-isp/sun6i_isp_params.c | 6 +- drivers/staging/most/video/video.c | 19 +- drivers/usb/gadget/function/uvc.h | 5 + drivers/usb/gadget/function/uvc_v4l2.c | 8 +- include/media/v4l2-ctrls.h | 4 +- include/media/v4l2-dev.h | 2 +- include/media/v4l2-fh.h | 30 +- include/media/v4l2-ioctl.h | 238 ++++----- include/media/v4l2-mem2mem.h | 42 +- samples/v4l/v4l2-pci-skeleton.c | 10 +- 151 files changed, 1792 insertions(+), 1806 deletions(-) base-commit: d968e50b5c26642754492dea23cbd3592bde62d8 -- Regards, Laurent Pinchart |
|
From: Laurent P. <lau...@id...> - 2025-08-09 21:18:24
|
From: Jacopo Mondi <jac...@id...>
Unless there is a good reason to do so, naming variable with double
underscore is generally not a good idea.
Rename the (mostly unused) __fh argument to ioctl handlers to fh.
Signed-off-by: Jacopo Mondi <jac...@id...>
Signed-off-by: Laurent Pinchart <lau...@id...>
---
drivers/media/pci/zoran/zoran_driver.c | 36 +++++++++++++-------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index ec7fc1da4cc0..5b4d5dd06edb 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -245,7 +245,7 @@ static int zoran_set_input(struct zoran *zr, int input)
* ioctl routine
*/
-static int zoran_querycap(struct file *file, void *__fh, struct v4l2_capability *cap)
+static int zoran_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{
struct zoran *zr = video_drvdata(file);
@@ -278,7 +278,7 @@ static int zoran_enum_fmt(struct zoran *zr, struct v4l2_fmtdesc *fmt, int flag)
return -EINVAL;
}
-static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_enum_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_fmtdesc *f)
{
struct zoran *zr = video_drvdata(file);
@@ -286,7 +286,7 @@ static int zoran_enum_fmt_vid_cap(struct file *file, void *__fh,
return zoran_enum_fmt(zr, f, ZORAN_FORMAT_CAPTURE);
}
-static int zoran_g_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_g_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -308,13 +308,13 @@ static int zoran_g_fmt_vid_out(struct file *file, void *__fh,
return 0;
}
-static int zoran_g_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_g_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
if (zr->map_mode != ZORAN_MAP_MODE_RAW)
- return zoran_g_fmt_vid_out(file, __fh, fmt);
+ return zoran_g_fmt_vid_out(file, fh, fmt);
fmt->fmt.pix.width = zr->v4l_settings.width;
fmt->fmt.pix.height = zr->v4l_settings.height;
fmt->fmt.pix.sizeimage = zr->buffer_size;
@@ -328,7 +328,7 @@ static int zoran_g_fmt_vid_cap(struct file *file, void *__fh,
return 0;
}
-static int zoran_try_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_try_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -391,7 +391,7 @@ static int zoran_try_fmt_vid_out(struct file *file, void *__fh,
return res;
}
-static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_try_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -399,7 +399,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
int i;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_try_fmt_vid_out(file, __fh, fmt);
+ return zoran_try_fmt_vid_out(file, fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (zoran_formats[i].fourcc == fmt->fmt.pix.pixelformat)
@@ -427,7 +427,7 @@ static int zoran_try_fmt_vid_cap(struct file *file, void *__fh,
return 0;
}
-static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
+static int zoran_s_fmt_vid_out(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -507,7 +507,7 @@ static int zoran_s_fmt_vid_out(struct file *file, void *__fh,
return res;
}
-static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
+static int zoran_s_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
@@ -515,7 +515,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
int res = 0;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_s_fmt_vid_out(file, __fh, fmt);
+ return zoran_s_fmt_vid_out(file, fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
@@ -555,7 +555,7 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
return res;
}
-static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std)
+static int zoran_g_std(struct file *file, void *fh, v4l2_std_id *std)
{
struct zoran *zr = video_drvdata(file);
@@ -563,7 +563,7 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std)
return 0;
}
-static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)
+static int zoran_s_std(struct file *file, void *fh, v4l2_std_id std)
{
struct zoran *zr = video_drvdata(file);
int res = 0;
@@ -578,7 +578,7 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id std)
return res;
}
-static int zoran_enum_input(struct file *file, void *__fh,
+static int zoran_enum_input(struct file *file, void *fh,
struct v4l2_input *inp)
{
struct zoran *zr = video_drvdata(file);
@@ -595,7 +595,7 @@ static int zoran_enum_input(struct file *file, void *__fh,
return 0;
}
-static int zoran_g_input(struct file *file, void *__fh, unsigned int *input)
+static int zoran_g_input(struct file *file, void *fh, unsigned int *input)
{
struct zoran *zr = video_drvdata(file);
@@ -604,7 +604,7 @@ static int zoran_g_input(struct file *file, void *__fh, unsigned int *input)
return 0;
}
-static int zoran_s_input(struct file *file, void *__fh, unsigned int input)
+static int zoran_s_input(struct file *file, void *fh, unsigned int input)
{
struct zoran *zr = video_drvdata(file);
int res;
@@ -617,7 +617,7 @@ static int zoran_s_input(struct file *file, void *__fh, unsigned int input)
}
/* cropping (sub-frame capture) */
-static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selection *sel)
+static int zoran_g_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{
struct zoran *zr = video_drvdata(file);
@@ -652,7 +652,7 @@ static int zoran_g_selection(struct file *file, void *__fh, struct v4l2_selectio
return 0;
}
-static int zoran_s_selection(struct file *file, void *__fh, struct v4l2_selection *sel)
+static int zoran_s_selection(struct file *file, void *fh, struct v4l2_selection *sel)
{
struct zoran *zr = video_drvdata(file);
struct zoran_jpg_settings settings;
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-09 21:18:17
|
From: Jacopo Mondi <jac...@id...>
The zoran_fh structure is a wrapper around v4l2_fh. Its usage has been
mostly removed by commit 83f89a8bcbc3 ("media: zoran: convert to vb2"),
but the structure stayed by mistake. It is now used in a single
location, assigned from a void pointer and then recast to a void
pointer, without being every accessed. Drop it.
Fixes: 83f89a8bcbc3 ("media: zoran: convert to vb2")
Signed-off-by: Jacopo Mondi <jac...@id...>
Signed-off-by: Laurent Pinchart <lau...@id...>
---
drivers/media/pci/zoran/zoran.h | 6 ------
drivers/media/pci/zoran/zoran_driver.c | 3 +--
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
index 1cd990468d3d..d05e222b3921 100644
--- a/drivers/media/pci/zoran/zoran.h
+++ b/drivers/media/pci/zoran/zoran.h
@@ -154,12 +154,6 @@ struct zoran_jpg_settings {
struct zoran;
-/* zoran_fh contains per-open() settings */
-struct zoran_fh {
- struct v4l2_fh fh;
- struct zoran *zr;
-};
-
struct card_info {
enum card_type type;
char name[32];
diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
index f42f596d3e62..ec7fc1da4cc0 100644
--- a/drivers/media/pci/zoran/zoran_driver.c
+++ b/drivers/media/pci/zoran/zoran_driver.c
@@ -511,12 +511,11 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
struct v4l2_format *fmt)
{
struct zoran *zr = video_drvdata(file);
- struct zoran_fh *fh = __fh;
int i;
int res = 0;
if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
- return zoran_s_fmt_vid_out(file, fh, fmt);
+ return zoran_s_fmt_vid_out(file, __fh, fmt);
for (i = 0; i < NUM_FORMATS; i++)
if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-09 21:17:26
|
From: Laurent Pinchart <lau...@id...> Hello, This patch series refactors v4l2_fh support to make the API easier to use, simplify drivers, and overall improve consistency through the whole subsystem. In V4L2, drivers that need to store per file handle data allocate their per file handle data structure in the .open() handler and set the struct file private_data field to point to it. The private_data field is entirely managed by drivers, and is generally opaque to the V4L2 framework. The V4L2 framework also needs to store per file handle data to support features such as V4L2 events or per file handle controls. To make use of those features, driver need to use the v4l2_fh structure to store per file handle data, either as-is, or embedded in a driver-specific structure. In either case, drivers must initialize the v4l2_fh structure with v4l2_fh_init(), and set the file private_data field to point to the v4l2_fh structure. The initialization operation sets the V4L2_FL_USES_V4L2_FH flag in the video_device.flags field, which indicates to the V4L2 core that private_data points to a valid v4l2_fh. In practice, while v4l2_fh usage is optional, all V4L2 drivers make use of it. As all new drivers are required to use v4l2_fh, this situation will not change, and opens the door to lots of simplifications in the V4L2 core and in drivers. The series starts with patches 01/76 to 07/76 that align the behaviour of all drivers, ensuring they all store a v4l2_fh pointer in the file private_data. Seven drivers store a pointer to driver-specific structures that embed v4l2_fh. This causes no issue in practice as the v4l2_fh field is always the first one in all those structures, but the code lacks coherency. After that, the series eliminates direct access to the file private_data. Patch 08/76 introduces a helper to retrieve the v4l2_fh from the file, and patches 09/76 to 11/76 use the helper in drivers. Patches 12/76 to 25/76 are assorted refactoring and cleanup that prepare drivers to remove the last manual accesses to private_data. Patches 26/76 and 27/27 drop those, by setting private_data in the v4l2_fh_add() helper, and resetting it to NULL in v4l2_fh_del(). Prior refactoring makes it possible for those last two patches to be generated by coccinelle with only small manual additions. Patches 28/76 to 32/76 then move to simplify the V4L2 core. As all drivers are guaranteed to use v4l2_fh, all the V4L2_FL_USES_V4L2_FH checks can be dropped. Patch 32/76 does so. It however stops short of dropping V4L2_FL_USES_V4L2_FH completely, and instead adds a temporary check in the open file operation to verify that the driver uses v4l2_fh. That check could be dropped after a few kernel releases. The second part of the series, address a second source of inconsistent behaviours in drivers. The V4L2 core passes to most ioctl handlers both the file pointer and the file private_data pointer, with the latter being passed as a void pointer. Not only is the void pointer redundant, as driver can (and do in many cases) access the per file data from the file private_data field, but passing a v4l2_fh through a void pointer is error-prone as incorrect casts wouldn't be noticed by the compiler. To fix this, patches 33/76 to 68/76 replace all usage of the void pointer, retrieving instead the v4l2_fh from the file structure. Patches 69/76 and 70/76 then pass a NULL value through the ioctl void pointer argument, to ensure no new driver will try to access the v4l2_fh from there. They also rename the 'void *fh' argument to the ioctl handler definitions to 'void *priv'. Finally, patches 71/76 to 76/76 also rename the same arguments in several locations: - in the test drivers, the uvcvideo driver and the v4l2-pci-skeleton driver due to their role as sample and reference code (71/76 to 73/76) ; - in the V4L2 core (74/76) ; and - in all drivers that use names other than the most common 'void *priv' and 'void *fh', in order to standardize on those two names only (75/76 and 76/76). Renaming all remaining 'void *fh' to 'void *priv' would be lots of additional churn, and this series is big enough. Furthermore, we have plans to introduce a new video_device_state argument to ioctl handlers. We will likely remove the 'void *' argument at that time, to avoid modifying all ioctl handlers in all drivers twice in a short amount of time. This series is based on a merge of the linux-media next branch, and the "[PATCH 0/4] Remove the wl1273 FM Radio" series ([1]) applied on top of v6.16. The dependency on the wl1273 removal is due to that driver being the very last V4L2 driver that does not use v4l2_fh. I'm not sure yet how that series will be merged, but technically we could also merge this series without the dependency. It would break the wl1273 driver (at runtime only), but that is not an issue as it's scheduled for removal anyway. Compared to v1, all review comments have been addressed. The most notable changes are - the removal of the V4L2_FL_USES_V4L2_FH checks - the push of the NULL private pointer to the ioctl wrappers - the reintroduction of the 'void *' parameter name in the ioctl handler definitions (now named 'priv'), - the rename of the 'void *' arguments in drivers and in the V4L2 core Link to v1: https://lore.kernel.org/r/202...@id... [1] https://lore.kernel.org/linux-media/202...@tr.../ Jacopo Mondi (21): media: rcar-vin: Do not set file->private_data media: rzg2l-cru: Do not set file->private_data media: camss: Remove custom .release fop() media: zoran: Remove zoran_fh structure media: zoran: Rename __fh to fh media: v4l2-ioctl: Access v4l2_fh from private_data media: allegro: Access v4l2_fh from file media: meson-ge2d: Access v4l2_fh from file media: coda: Access v4l2_fh from file media: wave5: Access v4l2_fh from file media: m2m-deinterlace: Access v4l2_fh from file media: tegra-vde: Access v4l2_fh from file media: nxp: mx2: Access v4l2_fh from file media: rockhip: rga: Access v4l2_fh from file media: s3c-camif: Access v4l2_fh from file media: s5p-g2d: Access v4l2_fh from file media: s5p-mfc: Access v4l2_fh from file media: stm32: dma2d: Access v4l2_fh from file media: cx18: Access v4l2_fh from file media: usb: hdpvr: Access v4l2_fh from file media: usb: uvc: Access v4l2_fh from file Laurent Pinchart (55): media: pci: saa7164: Store v4l2_fh pointer in file->private_data media: imagination: Store v4l2_fh pointer in file->private_data media: ti: vpe: Store v4l2_fh pointer in file->private_data media: usb: hdpvr: Store v4l2_fh pointer in file->private_data media: usb: pvrusb2: Store v4l2_fh pointer in file->private_data media: usb: uvcvideo: Store v4l2_fh pointer in file->private_data media: staging: most: Store v4l2_fh pointer in file->private_data media: Wrap file->private_data access with a helper function media: Replace file->private_data access with file_to_v4l2_fh() media: nvidia: tegra-vde: Replace file->private_data access media: Replace file->private_data access with custom functions media: pci: ivtv: Don't create fake v4l2_fh media: amphion: Make some vpu_v4l2 functions static media: amphion: Delete v4l2_fh synchronously in .release() media: visl: Drop visl_v4l2fh_to_ctx() function media: v4l2-fh: Move piece of documentation to correct function media: camss: Replace .open() file operation with v4l2_fh_open() media: chips-media: wave5: Pass file pointer to wave5_cleanup_instance() media: qcom: iris: Pass file pointer to iris_v4l2_fh_(de)init() media: qcom: iris: Set file->private_data in iris_v4l2_fh_(de)init() media: qcom: iris: Drop unused argument to iris_get_inst() media: qcom: venus: Pass file pointer to venus_close_common() media: Set file->private_data in v4l2_fh_add() media: Reset file->private_data to NULL in v4l2_fh_del() media: ipu6: isys: Don't set V4L2_FL_USES_V4L2_FH manually media: staging: ipu7: isys: Don't set V4L2_FL_USES_V4L2_FH manually media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check media: v4l2-dev: Make open and release file operations mandatory media: Drop V4L2_FL_USES_V4L2_FH checks media: mtk: jpeg: Access v4l2_fh from file->private_data media: mtk_mdp_m2m: Access v4l2_fh from file media: mtk: mdp3: Access v4l2_fh from file media: mtk: vcodec: Access v4l2_fh from file media: imx-jpeg: Access v4l2_fh from file media: imx-isi: Access v4l2_fh from file media: renesas: Access v4l2_fh from file media: rockchip: rkvdec: Access v4l2_fh from file media: exynos-gsc: Access v4l2_fh from file media: exynos4-is: Access v4l2_fh from file media: s5p-jpeg: Access v4l2_fh from file media: s5p-mfc: Store s5p_mfc_ctx in vb2_queue.drv_priv media: bdisp: Access v4l2_fh from file media: st: delta: Access v4l2_fh from file media: hantro: Access v4l2_fh from file->private_data media: omap3isp: Access v4l2_fh from file media: ivtv: Access v4l2_fh from file media: staging: imx: Access v4l2_fh from file media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers media: v4l2-ioctl: Push NULL fh argument down to ioctl wrappers media: test-drivers: Rename second ioctl handlers argument to 'void *priv' media: uvcvideo: Rename second ioctl handlers argument to 'void *priv' media: v4l2-pci-skeleton: Rename second ioctl handlers argument to 'void *priv' media: v4l2-core: Rename second ioctl handlers argument to 'void *priv' media: v4l2: Rename second ioctl handlers argument to 'void *priv' media: staging: Rename second ioctl handlers argument to 'void *priv' Documentation/driver-api/media/v4l2-fh.rst | 59 ++- .../zh_CN/video4linux/v4l2-framework.txt | 16 +- .../extron-da-hd-4k-plus.c | 4 +- .../media/common/videobuf2/videobuf2-v4l2.c | 12 +- drivers/media/pci/bt8xx/bttv-driver.c | 14 +- drivers/media/pci/bt8xx/bttv-vbi.c | 6 +- drivers/media/pci/cobalt/cobalt-v4l2.c | 60 +-- drivers/media/pci/cx18/cx18-driver.h | 2 +- drivers/media/pci/cx18/cx18-fileops.c | 11 +- drivers/media/pci/cx18/cx18-ioctl.c | 64 +-- .../media/pci/intel/ipu6/ipu6-isys-video.c | 1 - drivers/media/pci/ivtv/ivtv-alsa-pcm.c | 2 - drivers/media/pci/ivtv/ivtv-driver.h | 7 +- drivers/media/pci/ivtv/ivtv-fileops.c | 40 +- drivers/media/pci/ivtv/ivtv-ioctl.c | 124 ++--- drivers/media/pci/ivtv/ivtv-irq.c | 4 +- drivers/media/pci/saa7134/saa7134-video.c | 4 +- drivers/media/pci/saa7164/saa7164-encoder.c | 30 +- drivers/media/pci/saa7164/saa7164-vbi.c | 25 +- drivers/media/pci/saa7164/saa7164.h | 10 + drivers/media/pci/zoran/zoran.h | 6 - drivers/media/pci/zoran/zoran_driver.c | 35 +- .../media/platform/allegro-dvt/allegro-core.c | 33 +- .../media/platform/amlogic/meson-ge2d/ge2d.c | 25 +- drivers/media/platform/amphion/vpu.h | 2 +- drivers/media/platform/amphion/vpu_v4l2.c | 22 +- drivers/media/platform/amphion/vpu_v4l2.h | 8 - .../platform/chips-media/coda/coda-common.c | 50 +- .../platform/chips-media/wave5/wave5-helper.c | 10 +- .../platform/chips-media/wave5/wave5-helper.h | 2 +- .../chips-media/wave5/wave5-vpu-dec.c | 23 +- .../chips-media/wave5/wave5-vpu-enc.c | 29 +- .../platform/chips-media/wave5/wave5-vpu.h | 5 + .../platform/imagination/e5010-jpeg-enc.c | 23 +- .../platform/imagination/e5010-jpeg-enc.h | 5 + drivers/media/platform/m2m-deinterlace.c | 26 +- .../platform/mediatek/jpeg/mtk_jpeg_core.c | 37 +- .../media/platform/mediatek/mdp/mtk_mdp_m2m.c | 29 +- .../platform/mediatek/mdp3/mtk-mdp3-m2m.c | 25 +- .../mediatek/vcodec/decoder/mtk_vcodec_dec.c | 36 +- .../vcodec/decoder/mtk_vcodec_dec_drv.c | 9 +- .../vcodec/decoder/mtk_vcodec_dec_drv.h | 5 + .../mediatek/vcodec/encoder/mtk_vcodec_enc.c | 37 +- .../vcodec/encoder/mtk_vcodec_enc_drv.c | 9 +- .../vcodec/encoder/mtk_vcodec_enc_drv.h | 4 +- .../media/platform/nvidia/tegra-vde/v4l2.c | 35 +- drivers/media/platform/nxp/dw100/dw100.c | 7 +- .../media/platform/nxp/imx-jpeg/mxc-jpeg.c | 45 +- drivers/media/platform/nxp/imx-pxp.c | 7 +- .../platform/nxp/imx8-isi/imx8-isi-m2m.c | 21 +- drivers/media/platform/nxp/mx2_emmaprp.c | 24 +- .../media/platform/qcom/camss/camss-video.c | 43 +- drivers/media/platform/qcom/iris/iris_vidc.c | 36 +- drivers/media/platform/qcom/venus/core.c | 4 +- drivers/media/platform/qcom/venus/core.h | 4 +- drivers/media/platform/qcom/venus/vdec.c | 5 +- drivers/media/platform/qcom/venus/venc.c | 5 +- .../platform/renesas/rcar-vin/rcar-v4l2.c | 2 - drivers/media/platform/renesas/rcar_fdp1.c | 17 +- drivers/media/platform/renesas/rcar_jpu.c | 27 +- .../platform/renesas/rzg2l-cru/rzg2l-video.c | 1 - .../media/platform/renesas/vsp1/vsp1_histo.c | 6 +- .../media/platform/renesas/vsp1/vsp1_video.c | 18 +- drivers/media/platform/rockchip/rga/rga.c | 30 +- drivers/media/platform/rockchip/rga/rga.h | 5 + .../media/platform/rockchip/rkvdec/rkvdec.c | 21 +- .../media/platform/rockchip/rkvdec/rkvdec.h | 4 +- .../platform/samsung/exynos-gsc/gsc-core.h | 6 +- .../platform/samsung/exynos-gsc/gsc-m2m.c | 37 +- .../platform/samsung/exynos4-is/fimc-core.h | 5 +- .../platform/samsung/exynos4-is/fimc-m2m.c | 19 +- .../samsung/s3c-camif/camif-capture.c | 26 +- drivers/media/platform/samsung/s5p-g2d/g2d.c | 40 +- .../platform/samsung/s5p-jpeg/jpeg-core.c | 33 +- .../media/platform/samsung/s5p-mfc/s5p_mfc.c | 17 +- .../platform/samsung/s5p-mfc/s5p_mfc_common.h | 6 +- .../platform/samsung/s5p-mfc/s5p_mfc_dec.c | 34 +- .../platform/samsung/s5p-mfc/s5p_mfc_enc.c | 38 +- .../media/platform/st/sti/bdisp/bdisp-v4l2.c | 30 +- .../media/platform/st/sti/delta/delta-v4l2.c | 41 +- drivers/media/platform/st/sti/hva/hva-v4l2.c | 38 +- drivers/media/platform/st/sti/hva/hva.h | 2 - drivers/media/platform/st/stm32/dma2d/dma2d.c | 28 +- .../sunxi/sun6i-csi/sun6i_csi_capture.c | 16 +- .../media/platform/sunxi/sun8i-di/sun8i-di.c | 10 +- .../sunxi/sun8i-rotate/sun8i_rotate.c | 10 +- .../platform/synopsys/hdmirx/snps_hdmirx.c | 8 +- .../platform/ti/j721e-csi2rx/j721e-csi2rx.c | 2 +- drivers/media/platform/ti/omap/omap_vout.c | 6 +- drivers/media/platform/ti/omap3isp/ispvideo.c | 36 +- drivers/media/platform/ti/omap3isp/ispvideo.h | 6 +- drivers/media/platform/ti/vpe/vpe.c | 21 +- drivers/media/platform/verisilicon/hantro.h | 4 +- .../media/platform/verisilicon/hantro_drv.c | 10 +- .../media/platform/verisilicon/hantro_v4l2.c | 22 +- drivers/media/platform/xilinx/xilinx-dma.c | 10 +- .../radio/si4713/radio-platform-si4713.c | 10 +- .../media/test-drivers/vicodec/vicodec-core.c | 21 +- drivers/media/test-drivers/vim2m.c | 7 +- .../media/test-drivers/vimc/vimc-capture.c | 2 +- drivers/media/test-drivers/visl/visl-core.c | 5 +- drivers/media/test-drivers/visl/visl.h | 7 +- drivers/media/test-drivers/vivid/vivid-core.c | 100 ++-- .../media/test-drivers/vivid/vivid-radio-rx.c | 12 +- .../media/test-drivers/vivid/vivid-radio-rx.h | 8 +- .../media/test-drivers/vivid/vivid-radio-tx.c | 8 +- .../media/test-drivers/vivid/vivid-radio-tx.h | 4 +- .../media/test-drivers/vivid/vivid-sdr-cap.c | 18 +- .../media/test-drivers/vivid/vivid-sdr-cap.h | 18 +- .../media/test-drivers/vivid/vivid-vbi-cap.c | 10 +- .../media/test-drivers/vivid/vivid-vbi-cap.h | 8 +- .../media/test-drivers/vivid/vivid-vbi-out.c | 8 +- .../media/test-drivers/vivid/vivid-vbi-out.h | 6 +- .../media/test-drivers/vivid/vivid-vid-cap.c | 24 +- .../media/test-drivers/vivid/vivid-vid-cap.h | 24 +- .../test-drivers/vivid/vivid-vid-common.c | 8 +- .../test-drivers/vivid/vivid-vid-common.h | 8 +- .../media/test-drivers/vivid/vivid-vid-out.c | 16 +- .../media/test-drivers/vivid/vivid-vid-out.h | 16 +- drivers/media/usb/cx231xx/cx231xx-417.c | 2 +- drivers/media/usb/gspca/gspca.c | 18 +- drivers/media/usb/hdpvr/hdpvr-video.c | 69 +-- drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 69 +-- drivers/media/usb/uvc/uvc_metadata.c | 22 +- drivers/media/usb/uvc/uvc_v4l2.c | 85 ++-- drivers/media/usb/uvc/uvcvideo.h | 5 + drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 9 +- drivers/media/v4l2-core/v4l2-ctrls-api.c | 11 +- drivers/media/v4l2-core/v4l2-dev.c | 45 +- drivers/media/v4l2-core/v4l2-fh.c | 16 +- drivers/media/v4l2-core/v4l2-ioctl.c | 456 +++++++++--------- drivers/media/v4l2-core/v4l2-mem2mem.c | 50 +- drivers/media/v4l2-core/v4l2-subdev.c | 16 +- .../staging/media/imx/imx-media-csc-scaler.c | 26 +- drivers/staging/media/ipu7/ipu7-isys-video.c | 1 - drivers/staging/media/meson/vdec/vdec.c | 29 +- drivers/staging/media/meson/vdec/vdec.h | 5 + drivers/staging/media/sunxi/cedrus/cedrus.c | 8 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 5 + .../staging/media/sunxi/cedrus/cedrus_video.c | 5 - .../media/sunxi/sun6i-isp/sun6i_isp_capture.c | 16 +- .../media/sunxi/sun6i-isp/sun6i_isp_params.c | 6 +- drivers/staging/most/video/video.c | 19 +- drivers/usb/gadget/function/uvc.h | 5 + drivers/usb/gadget/function/uvc_v4l2.c | 8 +- include/media/v4l2-ctrls.h | 4 +- include/media/v4l2-dev.h | 2 +- include/media/v4l2-fh.h | 28 +- include/media/v4l2-ioctl.h | 236 ++++----- include/media/v4l2-mem2mem.h | 42 +- samples/v4l/v4l2-pci-skeleton.c | 10 +- 151 files changed, 1790 insertions(+), 1804 deletions(-) base-commit: d968e50b5c26642754492dea23cbd3592bde62d8 -- Regards, Laurent Pinchart |
|
From: Sakari A. <sak...@li...> - 2025-08-08 07:38:37
|
On Thu, Aug 07, 2025 at 08:01:35PM +0300, Laurent Pinchart wrote: > Hi Sakari, > > On Thu, Aug 07, 2025 at 09:07:13AM +0000, Sakari Ailus wrote: > > On Sat, Aug 02, 2025 at 11:23:26AM +0200, Jacopo Mondi wrote: > > > From: Laurent Pinchart <lau...@id...> > > > > > > The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant > > > to be set manually by drivers. Drop it from the ipu7-isys driver. > > > > > > Signed-off-by: Laurent Pinchart <lau...@id...> > > > Signed-off-by: Jacopo Mondi <jac...@id...> > > > > Thanks, Jacopo! > > > > Reviewed-by: Sakari Ailus <sak...@li...> > > Can we get you review on patch 63/65 too (for the IPU6 driver) too ? Done. -- Sakari Ailus |
|
From: Sakari A. <sak...@li...> - 2025-08-08 07:38:15
|
On Sat, Aug 02, 2025 at 11:23:25AM +0200, Jacopo Mondi wrote: > From: Laurent Pinchart <lau...@id...> > > The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant > to be set manually by drivers. Drop it from the ipu6-isys driver. > > Signed-off-by: Laurent Pinchart <lau...@id...> > Signed-off-by: Jacopo Mondi <jac...@id...> Reviewed-by: Sakari Ailus <sak...@li...> -- Sakari Ailus |
|
From: Laurent P. <lau...@id...> - 2025-08-08 07:01:19
|
On Thu, Aug 07, 2025 at 10:55:59PM +0200, Hans Verkuil wrote:
> On 07/08/2025 22:33, Laurent Pinchart wrote:
> > On Thu, Aug 07, 2025 at 09:58:34AM +0200, Hans Verkuil wrote:
> >> On 07/08/2025 09:26, Hans Verkuil wrote:
> >>> On 02/08/2025 11:23, Jacopo Mondi wrote:
> >>>> From: Laurent Pinchart <lau...@id...>
> >>>>
> >>>> Now that all drivers access the v4l2_fh from the file structure, there
> >>>> is no need to pass it as an explicit argument to ioctl handlers. Set the
> >>>> argument to NULL in the w__video_do_ioctl(), and drop the name of the
> >>>> void *fh argument in the ioctl handler declarations to indicate it is
> >>>> not used.
> >>>>
> >>>> The argument could be removed altogether with a mechanical change
> >>>> (probably using coccinelle), but there are plans to pass a new argument
> >>>> to the ioctl handlers in the near future. The tree-wide change to remove
> >>>> the argument, only to add another one soon after, would be too much
> >>>> churn.
> >>>>
> >>>> Signed-off-by: Laurent Pinchart <lau...@id...>
> >>>> Signed-off-by: Jacopo Mondi <jac...@id...>
> >>>> ---
> >>>> drivers/media/v4l2-core/v4l2-ioctl.c | 5 +-
> >>>> include/media/v4l2-ioctl.h | 236 +++++++++++++++++------------------
> >>>> 2 files changed, 120 insertions(+), 121 deletions(-)
> >>>>
> >>>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> >>>> index 44c2f5ef3dae407d9786c5278d13efc982be2ff0..248a0b5b56ec7a09f2d4c61114f81aa5a9b8b041 100644
> >>>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> >>>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> >>>> @@ -3078,7 +3078,6 @@ static long __video_do_ioctl(struct file *file,
> >>>> bool write_only = false;
> >>>> struct v4l2_ioctl_info default_info;
> >>>> const struct v4l2_ioctl_info *info;
> >>>> - void *fh = file_to_v4l2_fh(file);
> >>>> struct v4l2_fh *vfh = NULL;
> >>>> int dev_debug = vfd->dev_debug;
> >>>> long ret = -ENOTTY;
> >>>> @@ -3140,11 +3139,11 @@ static long __video_do_ioctl(struct file *file,
> >>>>
> >>>> write_only = _IOC_DIR(cmd) == _IOC_WRITE;
> >>>> if (info != &default_info) {
> >>>> - ret = info->func(ops, file, fh, arg);
> >>>> + ret = info->func(ops, file, NULL, arg);
> >>>> } else if (!ops->vidioc_default) {
> >>>> ret = -ENOTTY;
> >>>> } else {
> >>>> - ret = ops->vidioc_default(file, fh,
> >>>> + ret = ops->vidioc_default(file, NULL,
> >>>> vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
> >>>> cmd, arg);
> >>>> }
> >>>
> >>> drivers/media/v4l2-core/v4l2-compat-ioctl32.c also calls ops->vidioc_query_ext_ctrl
> >>> directly, but still passes the fh as second argument: that needs to be replaced by
> >>> a NULL pointer as well. That should be fixed in this patch as well.
> >
> > Oops, I missed it. Will be fixed in v2.
> >
> >>> Regarding v4l2-ioctl.c: I would like a follow-up patch that pushes the NULL pointer
> >>> down into each ioctl helper function. I.e. drop the 'void *fh' argument in the
> >>> struct v4l2_ioctl_info 'func' callback, and all callbacks like v4l_g_fmt() just
> >>> replace 'fh' by 'NULL' when they call the vidioc op.
> >
> > I'll add a patch in v2.
> >
> >>> Part of it is that the core functions currently suggest that the second argument is
> >>> a filehandle (since it's still named 'fh'), which is obviously wrong. And I also think
> >>> that the core framework shouldn't use a dummy second argument at all. I admit that
> >>> changing all vidioc callbacks in the whole subsystem to drop the second argument is
> >>> too much churn, but for this core file I think it is something that should be done.
> >>
> >> A follow-up on this: I would not be against a large patch that drops the second priv
> >> argument from all vidioc ops since it is now unused. If nothing else, it helps ensure
> >> that it is really unused by all drivers :-)
> >
> > I've considered that. We're working on introducing a video_device_state
> > that will likely be passed as an argument to the ioctl handlers, and we
> > thought that not removing the void *priv argument yet could mean less
> > churn in drivers when we add the new argument, taking over the void
> > *priv. However, the state should be passed through an explicitly typed
> > pointer, so we'll have to patch all drivers anyway. I suppose we could
> > drop the void pointer now, and add a new pointer later. What do you
> > think ?
>
> It depends on how what you think is the ETA for the video_device_state :-)
>
> I think we can shelve this for now, but as mentioned below, at least replace
> 'fh' by 'priv' for the test drivers, pci skeleton driver and (I think) uvc.
OK, I'll do that.
> >> But if you don't want to go there, then there is something that I think need to be addressed:
> >> a lot of drivers name the second argument 'fh' or '_fh' or even 'fh0'. Can we add a patch that
> >> renames the second arg to 'priv'?
> >>
> >> At minimum I think this should be done for drivers/media/test-drivers and
> >> samples/v4l/v4l2-pci-skeleton.c. These drivers are often used as reference drivers,
> >> so they should be up-to-date.
> >>
> >> I would also suggest to do this for uvc since it is by far the most widely used media
> >> driver.
> >>
> >> I also see the use of 'fh' in v4l2-mem2mem.c in a few places.
> >>
> >>>> diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
> >>>> index 82695c3a300a73219f262fb556ed61a8f09d273e..223e2c7a3516fc96fb486ab64226163e52f775a6 100644
> >>>> --- a/include/media/v4l2-ioctl.h
> >>>> +++ b/include/media/v4l2-ioctl.h
> >>>> @@ -293,144 +293,144 @@ struct v4l2_ioctl_ops {
> >>>> /* ioctl callbacks */
> >>>>
> >>>> /* VIDIOC_QUERYCAP handler */
> >>>> - int (*vidioc_querycap)(struct file *file, void *fh,
> >>>> + int (*vidioc_querycap)(struct file *file, void *,
> >>>> struct v4l2_capability *cap);
> >>>>
> >>>> /* VIDIOC_ENUM_FMT handlers */
> >>>> - int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_vid_out)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>> - int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_fmt_meta_out)(struct file *file, void *,
> >>>> struct v4l2_fmtdesc *f);
> >>>>
> >>>> /* VIDIOC_G_FMT handlers */
> >>>> - int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_sdr_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_meta_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_fmt_meta_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>>
> >>>> /* VIDIOC_S_FMT handlers */
> >>>> - int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_sdr_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_meta_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fmt_meta_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>>
> >>>> /* VIDIOC_TRY_FMT handlers */
> >>>> - int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_sdr_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_meta_cap)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>> - int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_fmt_meta_out)(struct file *file, void *,
> >>>> struct v4l2_format *f);
> >>>>
> >>>> /* Buffer handlers */
> >>>> - int (*vidioc_reqbufs)(struct file *file, void *fh,
> >>>> + int (*vidioc_reqbufs)(struct file *file, void *,
> >>>> struct v4l2_requestbuffers *b);
> >>>> - int (*vidioc_querybuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_querybuf)(struct file *file, void *,
> >>>> struct v4l2_buffer *b);
> >>>> - int (*vidioc_qbuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_qbuf)(struct file *file, void *,
> >>>> struct v4l2_buffer *b);
> >>>> - int (*vidioc_expbuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_expbuf)(struct file *file, void *,
> >>>> struct v4l2_exportbuffer *e);
> >>>> - int (*vidioc_dqbuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_dqbuf)(struct file *file, void *,
> >>>> struct v4l2_buffer *b);
> >>>>
> >>>> - int (*vidioc_create_bufs)(struct file *file, void *fh,
> >>>> + int (*vidioc_create_bufs)(struct file *file, void *,
> >>>> struct v4l2_create_buffers *b);
> >>>> - int (*vidioc_prepare_buf)(struct file *file, void *fh,
> >>>> + int (*vidioc_prepare_buf)(struct file *file, void *,
> >>>> struct v4l2_buffer *b);
> >>>> - int (*vidioc_remove_bufs)(struct file *file, void *fh,
> >>>> + int (*vidioc_remove_bufs)(struct file *file, void *,
> >>>> struct v4l2_remove_buffers *d);
> >>>>
> >>>> - int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
> >>>> - int (*vidioc_g_fbuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_overlay)(struct file *file, void *, unsigned int i);
> >>>> + int (*vidioc_g_fbuf)(struct file *file, void *,
> >>>> struct v4l2_framebuffer *a);
> >>>> - int (*vidioc_s_fbuf)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_fbuf)(struct file *file, void *,
> >>>> const struct v4l2_framebuffer *a);
> >>>>
> >>>> /* Stream on/off */
> >>>> - int (*vidioc_streamon)(struct file *file, void *fh,
> >>>> + int (*vidioc_streamon)(struct file *file, void *,
> >>>> enum v4l2_buf_type i);
> >>>> - int (*vidioc_streamoff)(struct file *file, void *fh,
> >>>> + int (*vidioc_streamoff)(struct file *file, void *,
> >>>> enum v4l2_buf_type i);
> >>>>
> >>>> /*
> >>>> @@ -438,135 +438,135 @@ struct v4l2_ioctl_ops {
> >>>> *
> >>>> * Note: ENUMSTD is handled by videodev.c
> >>>> */
> >>>> - int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
> >>>> - int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
> >>>> - int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
> >>>> + int (*vidioc_g_std)(struct file *file, void *, v4l2_std_id *norm);
> >>>> + int (*vidioc_s_std)(struct file *file, void *, v4l2_std_id norm);
> >>>> + int (*vidioc_querystd)(struct file *file, void *, v4l2_std_id *a);
> >>>>
> >>>> /* Input handling */
> >>>> - int (*vidioc_enum_input)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_input)(struct file *file, void *,
> >>>> struct v4l2_input *inp);
> >>>> - int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
> >>>> - int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
> >>>> + int (*vidioc_g_input)(struct file *file, void *, unsigned int *i);
> >>>> + int (*vidioc_s_input)(struct file *file, void *, unsigned int i);
> >>>>
> >>>> /* Output handling */
> >>>> - int (*vidioc_enum_output)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_output)(struct file *file, void *,
> >>>> struct v4l2_output *a);
> >>>> - int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
> >>>> - int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
> >>>> + int (*vidioc_g_output)(struct file *file, void *, unsigned int *i);
> >>>> + int (*vidioc_s_output)(struct file *file, void *, unsigned int i);
> >>>>
> >>>> /* Control handling */
> >>>> - int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
> >>>> + int (*vidioc_query_ext_ctrl)(struct file *file, void *,
> >>>> struct v4l2_query_ext_ctrl *a);
> >>>> - int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_ext_ctrls)(struct file *file, void *,
> >>>> struct v4l2_ext_controls *a);
> >>>> - int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_ext_ctrls)(struct file *file, void *,
> >>>> struct v4l2_ext_controls *a);
> >>>> - int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_ext_ctrls)(struct file *file, void *,
> >>>> struct v4l2_ext_controls *a);
> >>>> - int (*vidioc_querymenu)(struct file *file, void *fh,
> >>>> + int (*vidioc_querymenu)(struct file *file, void *,
> >>>> struct v4l2_querymenu *a);
> >>>>
> >>>> /* Audio ioctls */
> >>>> - int (*vidioc_enumaudio)(struct file *file, void *fh,
> >>>> + int (*vidioc_enumaudio)(struct file *file, void *,
> >>>> struct v4l2_audio *a);
> >>>> - int (*vidioc_g_audio)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_audio)(struct file *file, void *,
> >>>> struct v4l2_audio *a);
> >>>> - int (*vidioc_s_audio)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_audio)(struct file *file, void *,
> >>>> const struct v4l2_audio *a);
> >>>>
> >>>> /* Audio out ioctls */
> >>>> - int (*vidioc_enumaudout)(struct file *file, void *fh,
> >>>> + int (*vidioc_enumaudout)(struct file *file, void *,
> >>>> struct v4l2_audioout *a);
> >>>> - int (*vidioc_g_audout)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_audout)(struct file *file, void *,
> >>>> struct v4l2_audioout *a);
> >>>> - int (*vidioc_s_audout)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_audout)(struct file *file, void *,
> >>>> const struct v4l2_audioout *a);
> >>>> - int (*vidioc_g_modulator)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_modulator)(struct file *file, void *,
> >>>> struct v4l2_modulator *a);
> >>>> - int (*vidioc_s_modulator)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_modulator)(struct file *file, void *,
> >>>> const struct v4l2_modulator *a);
> >>>> /* Crop ioctls */
> >>>> - int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_pixelaspect)(struct file *file, void *,
> >>>> int buf_type, struct v4l2_fract *aspect);
> >>>> - int (*vidioc_g_selection)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_selection)(struct file *file, void *,
> >>>> struct v4l2_selection *s);
> >>>> - int (*vidioc_s_selection)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_selection)(struct file *file, void *,
> >>>> struct v4l2_selection *s);
> >>>> /* Compression ioctls */
> >>>> - int (*vidioc_g_jpegcomp)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_jpegcomp)(struct file *file, void *,
> >>>> struct v4l2_jpegcompression *a);
> >>>> - int (*vidioc_s_jpegcomp)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_jpegcomp)(struct file *file, void *,
> >>>> const struct v4l2_jpegcompression *a);
> >>>> - int (*vidioc_g_enc_index)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_enc_index)(struct file *file, void *,
> >>>> struct v4l2_enc_idx *a);
> >>>> - int (*vidioc_encoder_cmd)(struct file *file, void *fh,
> >>>> + int (*vidioc_encoder_cmd)(struct file *file, void *,
> >>>> struct v4l2_encoder_cmd *a);
> >>>> - int (*vidioc_try_encoder_cmd)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_encoder_cmd)(struct file *file, void *,
> >>>> struct v4l2_encoder_cmd *a);
> >>>> - int (*vidioc_decoder_cmd)(struct file *file, void *fh,
> >>>> + int (*vidioc_decoder_cmd)(struct file *file, void *,
> >>>> struct v4l2_decoder_cmd *a);
> >>>> - int (*vidioc_try_decoder_cmd)(struct file *file, void *fh,
> >>>> + int (*vidioc_try_decoder_cmd)(struct file *file, void *,
> >>>> struct v4l2_decoder_cmd *a);
> >>>>
> >>>> /* Stream type-dependent parameter ioctls */
> >>>> - int (*vidioc_g_parm)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_parm)(struct file *file, void *,
> >>>> struct v4l2_streamparm *a);
> >>>> - int (*vidioc_s_parm)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_parm)(struct file *file, void *,
> >>>> struct v4l2_streamparm *a);
> >>>>
> >>>> /* Tuner ioctls */
> >>>> - int (*vidioc_g_tuner)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_tuner)(struct file *file, void *,
> >>>> struct v4l2_tuner *a);
> >>>> - int (*vidioc_s_tuner)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_tuner)(struct file *file, void *,
> >>>> const struct v4l2_tuner *a);
> >>>> - int (*vidioc_g_frequency)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_frequency)(struct file *file, void *,
> >>>> struct v4l2_frequency *a);
> >>>> - int (*vidioc_s_frequency)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_frequency)(struct file *file, void *,
> >>>> const struct v4l2_frequency *a);
> >>>> - int (*vidioc_enum_freq_bands)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_freq_bands)(struct file *file, void *,
> >>>> struct v4l2_frequency_band *band);
> >>>>
> >>>> /* Sliced VBI cap */
> >>>> - int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *,
> >>>> struct v4l2_sliced_vbi_cap *a);
> >>>>
> >>>> /* Log status ioctl */
> >>>> - int (*vidioc_log_status)(struct file *file, void *fh);
> >>>> + int (*vidioc_log_status)(struct file *file, void *);
> >>>>
> >>>> - int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_hw_freq_seek)(struct file *file, void *,
> >>>> const struct v4l2_hw_freq_seek *a);
> >>>>
> >>>> /* Debugging ioctls */
> >>>> #ifdef CONFIG_VIDEO_ADV_DEBUG
> >>>> - int (*vidioc_g_register)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_register)(struct file *file, void *,
> >>>> struct v4l2_dbg_register *reg);
> >>>> - int (*vidioc_s_register)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_register)(struct file *file, void *,
> >>>> const struct v4l2_dbg_register *reg);
> >>>>
> >>>> - int (*vidioc_g_chip_info)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_chip_info)(struct file *file, void *,
> >>>> struct v4l2_dbg_chip_info *chip);
> >>>> #endif
> >>>>
> >>>> - int (*vidioc_enum_framesizes)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_framesizes)(struct file *file, void *,
> >>>> struct v4l2_frmsizeenum *fsize);
> >>>>
> >>>> - int (*vidioc_enum_frameintervals)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_frameintervals)(struct file *file, void *,
> >>>> struct v4l2_frmivalenum *fival);
> >>>>
> >>>> /* DV Timings IOCTLs */
> >>>> - int (*vidioc_s_dv_timings)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_dv_timings)(struct file *file, void *,
> >>>> struct v4l2_dv_timings *timings);
> >>>> - int (*vidioc_g_dv_timings)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_dv_timings)(struct file *file, void *,
> >>>> struct v4l2_dv_timings *timings);
> >>>> - int (*vidioc_query_dv_timings)(struct file *file, void *fh,
> >>>> + int (*vidioc_query_dv_timings)(struct file *file, void *,
> >>>> struct v4l2_dv_timings *timings);
> >>>> - int (*vidioc_enum_dv_timings)(struct file *file, void *fh,
> >>>> + int (*vidioc_enum_dv_timings)(struct file *file, void *,
> >>>> struct v4l2_enum_dv_timings *timings);
> >>>> - int (*vidioc_dv_timings_cap)(struct file *file, void *fh,
> >>>> + int (*vidioc_dv_timings_cap)(struct file *file, void *,
> >>>> struct v4l2_dv_timings_cap *cap);
> >>>> - int (*vidioc_g_edid)(struct file *file, void *fh,
> >>>> + int (*vidioc_g_edid)(struct file *file, void *,
> >>>> struct v4l2_edid *edid);
> >>>> - int (*vidioc_s_edid)(struct file *file, void *fh,
> >>>> + int (*vidioc_s_edid)(struct file *file, void *,
> >>>> struct v4l2_edid *edid);
> >>>>
> >>>> int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
> >>>> @@ -575,7 +575,7 @@ struct v4l2_ioctl_ops {
> >>>> const struct v4l2_event_subscription *sub);
> >>>>
> >>>> /* For other private ioctls */
> >>>> - long (*vidioc_default)(struct file *file, void *fh,
> >>>> + long (*vidioc_default)(struct file *file, void *,
> >>>> bool valid_prio, unsigned int cmd, void *arg);
> >>>> };
> >>>>
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-08 06:30:41
|
On Thu, Aug 07, 2025 at 10:51:27PM +0200, Hans Verkuil wrote:
> On 07/08/2025 22:25, Laurent Pinchart wrote:
> > On Thu, Aug 07, 2025 at 08:00:06PM +0300, Laurent Pinchart wrote:
> >> On Thu, Aug 07, 2025 at 11:50:07AM +0300, Laurent Pinchart wrote:
> >>> On Wed, Aug 06, 2025 at 02:45:14PM +0200, Hans Verkuil wrote:
> >>>> On 02/08/2025 11:22, Jacopo Mondi wrote:
> >>>>> From: Laurent Pinchart <lau...@id...>
> >>>>>
> >>>>> Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
> >>>>> the file->private_data pointer to NULL in their video device .release()
> >>>>> file operation handler. Move the code to the v4l2_fh_del() function to
> >>>>> avoid direct access to file->private_data in drivers. This requires
> >>>>> adding a file pointer argument to the function.
> >>>>>
> >>>>> Changes to drivers have been generated with the following coccinelle
> >>>>> semantic patch:
> >>>>>
> >>>>> @@
> >>>>> expression fh;
> >>>>> identifier filp;
> >>>>> identifier release;
> >>>>> type ret;
> >>>>> @@
> >>>>> ret release(..., struct file *filp, ...)
> >>>>> {
> >>>>> <...
> >>>>> - filp->private_data = NULL;
> >>>>> ...
> >>>>> - v4l2_fh_del(fh);
> >>>>> + v4l2_fh_del(fh, filp);
> >>>>> ...>
> >>>>> }
> >>>>>
> >>>>> @@
> >>>>> expression fh;
> >>>>> identifier filp;
> >>>>> identifier release;
> >>>>> type ret;
> >>>>> @@
> >>>>> ret release(..., struct file *filp, ...)
> >>>>> {
> >>>>> <...
> >>>>> - v4l2_fh_del(fh);
> >>>>> + v4l2_fh_del(fh, filp);
> >>>>> ...
> >>>>> - filp->private_data = NULL;
> >>>>> ...>
> >>>>> }
> >>>>>
> >>>>> @@
> >>>>> expression fh;
> >>>>> identifier filp;
> >>>>> identifier release;
> >>>>> type ret;
> >>>>> @@
> >>>>> ret release(..., struct file *filp, ...)
> >>>>> {
> >>>>> <...
> >>>>> - v4l2_fh_del(fh);
> >>>>> + v4l2_fh_del(fh, filp);
> >>>>> ...>
> >>>>> }
> >>>>>
> >>>>> Manual changes have been applied to Documentation/ to update the usage
> >>>>> patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
> >>>>> v4l2_fh_del() prototype and reset file->private_data, and to
> >>>>> include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
> >>>>> and its documentation.
> >>>>>
> >>>>> Additionally, white space issues have been fixed manually in
> >>>>> drivers/usb/gadget/function/uvc_v4l2.c
> >>>>>
> >>>>> Signed-off-by: Laurent Pinchart <lau...@id...>
> >>>>> Signed-off-by: Jacopo Mondi <jac...@id...>
> >>>>> ---
> >>>>> Documentation/driver-api/media/v4l2-fh.rst | 4 ++--
> >>>>> Documentation/translations/zh_CN/video4linux/v4l2-framework.txt | 4 ++--
> >>>>> drivers/media/pci/cx18/cx18-fileops.c | 4 ++--
> >>>>> drivers/media/pci/ivtv/ivtv-fileops.c | 4 ++--
> >>>>> drivers/media/pci/saa7164/saa7164-encoder.c | 2 +-
> >>>>> drivers/media/pci/saa7164/saa7164-vbi.c | 2 +-
> >>>>> drivers/media/platform/allegro-dvt/allegro-core.c | 2 +-
> >>>>> drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 2 +-
> >>>>> drivers/media/platform/amphion/vpu_v4l2.c | 4 ++--
> >>>>> drivers/media/platform/chips-media/coda/coda-common.c | 4 ++--
> >>>>> drivers/media/platform/chips-media/wave5/wave5-helper.c | 2 +-
> >>>>> drivers/media/platform/imagination/e5010-jpeg-enc.c | 4 ++--
> >>>>> drivers/media/platform/m2m-deinterlace.c | 2 +-
> >>>>> drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++--
> >>>>> drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 4 ++--
> >>>>> drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 4 ++--
> >>>>> .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 4 ++--
> >>>>> .../media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 4 ++--
> >>>>> drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +-
> >>>>> drivers/media/platform/nxp/dw100/dw100.c | 2 +-
> >>>>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ++--
> >>>>> drivers/media/platform/nxp/imx-pxp.c | 2 +-
> >>>>> drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +-
> >>>>> drivers/media/platform/nxp/mx2_emmaprp.c | 2 +-
> >>>>> drivers/media/platform/qcom/iris/iris_vidc.c | 3 +--
> >>>>> drivers/media/platform/qcom/venus/core.c | 2 +-
> >>>>> drivers/media/platform/renesas/rcar_fdp1.c | 2 +-
> >>>>> drivers/media/platform/renesas/rcar_jpu.c | 4 ++--
> >>>>> drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 +-
> >>>>> drivers/media/platform/rockchip/rga/rga.c | 2 +-
> >>>>> drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +-
> >>>>> drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 4 ++--
> >>>>> drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 4 ++--
> >>>>> drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +-
> >>>>> drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 4 ++--
> >>>>> drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++--
> >>>>> drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 4 ++--
> >>>>> drivers/media/platform/st/sti/delta/delta-v4l2.c | 4 ++--
> >>>>> drivers/media/platform/st/sti/hva/hva-v4l2.c | 4 ++--
> >>>>> drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +-
> >>>>> drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +-
> >>>>> drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +-
> >>>>> drivers/media/platform/ti/omap3isp/ispvideo.c | 5 ++---
> >>>>> drivers/media/platform/ti/vpe/vpe.c | 2 +-
> >>>>> drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
> >>>>> drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +-
> >>>>> drivers/media/test-drivers/vim2m.c | 2 +-
> >>>>> drivers/media/test-drivers/visl/visl-core.c | 2 +-
> >>>>> drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +--
> >>>>> drivers/media/v4l2-core/v4l2-fh.c | 7 ++++---
> >>>>> drivers/media/v4l2-core/v4l2-subdev.c | 5 ++---
> >>>>> drivers/staging/media/imx/imx-media-csc-scaler.c | 4 ++--
> >>>>> drivers/staging/media/meson/vdec/vdec.c | 2 +-
> >>>>> drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +-
> >>>>> drivers/staging/most/video/video.c | 4 ++--
> >>>>> drivers/usb/gadget/function/uvc_v4l2.c | 3 +--
> >>>>> include/media/v4l2-fh.h | 5 ++++-
> >>>>> 57 files changed, 89 insertions(+), 90 deletions(-)
> >>>>>
> >>>>
> >>>> <snip>
> >>>>
> >>>>> diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
> >>>>> index b59b1084d8cdf1b62da12879e21dbe56c2109648..df3ba9d4674bd25626cfcddc2d0cb28c233e3cc3 100644
> >>>>> --- a/drivers/media/v4l2-core/v4l2-fh.c
> >>>>> +++ b/drivers/media/v4l2-core/v4l2-fh.c
> >>>>> @@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp)
> >>>>> }
> >>>>> EXPORT_SYMBOL_GPL(v4l2_fh_open);
> >>>>>
> >>>>> -void v4l2_fh_del(struct v4l2_fh *fh)
> >>>>> +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
> >>>>
> >>>> Instead of adding a second argument, perhaps it is better to
> >>>> just provide the filp pointer. After all, you can get the v4l2_fh
> >>>> from filp->private_data.
> >>>>
> >>>> It simplifies the code a bit.
> >>>
> >>> That's an interesting idea. I'll give it a try.
> >>
> >> We end up with code like (e.g. in v4l2_fh_release(), with similar
> >> constructs in lots of drivers)
> >>
> >> if (fh) {
> >> v4l2_fh_del(filp);
> >> v4l2_fh_exit(fh);
> >> kfree(fh);
> >> }
> >>
> >> compared to
> >>
> >> if (fh) {
> >> v4l2_fh_del(fh, filp);
> >> v4l2_fh_exit(fh);
> >> kfree(fh);
> >> }
> >>
> >> with the existing patch. I find the fact that v4l2_fh_del() takes a
> >> different pointer than v4l2_fh_exit() a bit disturbing. If you think
> >> it's better I'll drop the fh argument in v2.
> >
> > I gave it a try, and looking at the function prototype, its
> > documentation, the imbalance with v4l2_fh_add(), and the code in the
> > callers, I think keeping both arguments would look cleaner. Please tell
> > me if you feel strongly about this, I can still submit a patch to drop
> > the argument. It can very easily be scripted with coccinelle and doesn't
> > conflict with the rest of the series, so it could also be done later.
>
> Looking at all the drivers that call v4l2_fh_del/exit I always see v4l2_fh_del()
> directly followed by v4l2_fh_exit(). I think it would make a lot of sense to just
> combine the two as a single function: v4l2_fh_del_exit(filp).
>
> That simplifies the code and solves the imbalance.
I'll try that as a separate patch on top of this one. Keeping the two
separate will ease review (both patches will be simpler, and will be
generated by coccinelle), and will also make it easier to drop the
second patch if we decide it's not the way to go.
> >>>>> {
> >>>>> unsigned long flags;
> >>>>>
> >>>>> @@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh)
> >>>>> list_del_init(&fh->list);
> >>>>> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
> >>>>> v4l2_prio_close(fh->vdev->prio, fh->prio);
> >>>>> +
> >>>>> + filp->private_data = NULL;
> >>>>> }
> >>>>> EXPORT_SYMBOL_GPL(v4l2_fh_del);
> >>>>>
> >>>>> @@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp)
> >>>>> struct v4l2_fh *fh = file_to_v4l2_fh(filp);
> >>>>>
> >>>>> if (fh) {
> >>>>> - v4l2_fh_del(fh);
> >>>>> + v4l2_fh_del(fh, filp);
> >>>>> v4l2_fh_exit(fh);
> >>>>> kfree(fh);
> >>>>> - filp->private_data = NULL;
> >>>>> }
> >>>>> return 0;
> >>>>> }
> >>>>
> >>>> <snip>
> >>>>
> >>>>> diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
> >>>>> index d8fcf49f10e09452b73499f4a9bd1285bc2835a5..5e4c761635120608e0b588e0b0daf63e69588d38 100644
> >>>>> --- a/include/media/v4l2-fh.h
> >>>>> +++ b/include/media/v4l2-fh.h
> >>>>> @@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp);
> >>>>> * v4l2_fh_del - Remove file handle from the list of file handles.
> >>>>> *
> >>>>> * @fh: pointer to &struct v4l2_fh
> >>>>> + * @filp: pointer to &struct file associated with @fh
> >>>>> + *
> >>>>> + * The function resets filp->private_data to NULL.
> >>>>> *
> >>>>> * .. note::
> >>>>> * Must be called in v4l2_file_operations->release\(\) handler if the driver
> >>>>> * uses &struct v4l2_fh.
> >>>>> */
> >>>>> -void v4l2_fh_del(struct v4l2_fh *fh);
> >>>>> +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
> >>>>>
> >>>>> /**
> >>>>> * v4l2_fh_exit - Release resources related to a file handle.
--
Regards,
Laurent Pinchart
|
|
From: Cao, B. <bin...@in...> - 2025-08-08 01:01:45
|
Jacopo, >-----Original Message----- >From: Jacopo Mondi <jac...@id...> >Sent: Saturday, August 2, 2025 5:23 PM >To: Mauro Carvalho Chehab <mc...@ke...>; Devarsh Thakkar ><dev...@ti...>; Benoit Parrot <bp...@ti...>; Hans Verkuil ><hve...@ke...>; Mike Isely <is...@po...>; Laurent Pinchart ><lau...@id...>; Hans de Goede <ha...@ke...>; >Parthiban Veerasooran <par...@mi...>; Christian >Gromm <chr...@mi...>; Greg Kroah-Hartman ><gr...@li...>; Alex Shi <al...@ke...>; Yanteng Si ><si....@li...>; Dongliang Mu <dz...@hu...>; Jonathan >Corbet <co...@lw...>; Tomasz Figa <tf...@ch...>; Marek >Szyprowski <m.s...@sa...>; Andy Walls ><aw...@md...>; Michael Tretter <m.t...@pe...>; >Pengutronix Kernel Team <ke...@pe...>; Bin Liu ><bi...@me...>; Matthias Brugger <mat...@gm...>; >AngeloGioacchino Del Regno <ang...@co...>; >Dmitry Osipenko <di...@gm...>; Thierry Reding ><thi...@gm...>; Jonathan Hunter <jon...@nv...>; >Mirela Rabulea <mir...@nx...>; Shawn Guo ><sha...@ke...>; Sascha Hauer <s....@pe...>; Fabio >Estevam <fes...@gm...>; Kieran Bingham ><kie...@id...>; Michal Simek ><mic...@am...>; Ming Qian <min...@nx...>; Zhou Peng ><eag...@nx...>; Xavier Roumegue <xav...@os...>; >Philipp Zabel <p....@pe...>; Vikash Garodia ><qui...@qu...>; Dikshita Agarwal ><qui...@qu...>; Abhinav Kumar <abh...@li...>; >Bryan O'Donoghue <bry...@li...>; Sylwester Nawrocki ><syl...@gm...>; Jernej Skrabec ><jer...@gm...>; Chen-Yu Tsai <we...@cs...>; Samuel >Holland <sa...@sh...>; Daniel Almeida ><dan...@co...>; Neil Armstrong ><nei...@li...>; Kevin Hilman <kh...@ba...>; >Jerome Brunet <jb...@ba...>; Martin Blumenstingl ><mar...@go...>; Nas Chung ><nas...@ch...>; Jackson Lee <jac...@ch...>; >Minghsiu Tsai <min...@me...>; Houlong Wei ><hou...@me...>; Andrew-CT Chen <andrew- >ct...@me...>; Tiffany Lin <tif...@me...>; Yunfei >Dong <yun...@me...>; Geert Uytterhoeven ><gee...@gl...>; Magnus Damm <mag...@gm...>; Mikhail >Ulyanov <mik...@co...>; Jacob Chen <jacob- >ch...@io...>; Ezequiel Garcia <eze...@va...>; >Heiko Stuebner <he...@sn...>; Detlev Casanova ><det...@co...>; Krzysztof Kozlowski <kr...@ke...>; >Alim Akhtar <ali...@sa...>; Sylwester Nawrocki ><s.n...@sa...>; Łukasz Stelmach <l.s...@sa...>; >Andrzej Pietrasiewicz <and...@gm...>; Jacek Anaszewski ><jac...@gm...>; Hajda, Andrzej <and...@in...>; >Fabien Dessenne <fab...@fo...>; Hugues Fruchet ><hug...@fo...>; Jean-Christophe Trotin <jean- >chr...@fo...>; Maxime Coquelin ><mco...@gm...>; Alexandre Torgue ><ale...@fo...>; Nicolas Dufresne ><nic...@co...>; Benjamin Gaignard ><ben...@co...>; Steve Longerbeam ><slo...@gm...>; Maxime Ripard <mr...@ke...>; Paul >Kocialkowski <pa...@sy...>; Niklas Söderlund ><nik...@ra...>; Robert Foss <rf...@ke...>; Todor >Tomov <tod...@gm...>; Vladimir Zapolskiy ><vla...@li...>; Corentin Labbe <cl...@ba...>; >Sakari Ailus <sak...@li...>; Cao, Bingbu ><bin...@in...>; Qiu, Tian Shu <tia...@in...>; >Stanislaw Gruszka <sta...@li...> >Cc: lin...@vg...; lin...@vg...; linux- >st...@li...; lin...@vg...; linux-arm- >ke...@li...; lin...@li...; linux- >te...@vg...; im...@li...; linux-renesas- >so...@vg...; lin...@vg...; linux-samsung- >so...@vg...; lin...@li...; linux- >us...@vg...; lin...@li...; linux- >roc...@li...; lin...@st...; >mjp...@li...; Jacopo Mondi ><jac...@id...> >Subject: [PATCH 63/65] media: ipu6: isys: Don't set >V4L2_FL_USES_V4L2_FH manually > >From: Laurent Pinchart <lau...@id...> > >The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant >to be set manually by drivers. Drop it from the ipu6-isys driver. > >Signed-off-by: Laurent Pinchart <lau...@id...> >Signed-off-by: Jacopo Mondi <jac...@id...> >--- > drivers/media/pci/intel/ipu6/ipu6-isys-video.c | 1 - > 1 file changed, 1 deletion(-) > >diff --git a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c >b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c >index >24a2ef93474cc400f64eb1d50bc760ee66124d1b..f3f3bc0615e5dc698be5c479dfed8 >ef2eb49cbfb 100644 >--- a/drivers/media/pci/intel/ipu6/ipu6-isys-video.c >+++ b/drivers/media/pci/intel/ipu6/ipu6-isys-video.c >@@ -1306,7 +1306,6 @@ int ipu6_isys_video_init(struct ipu6_isys_video >*av) > __ipu6_isys_vidioc_try_fmt_meta_cap(av, &format_meta); > av->meta_fmt = format_meta.fmt.meta; > >- set_bit(V4L2_FL_USES_V4L2_FH, &av->vdev.flags); > video_set_drvdata(&av->vdev, av); > > ret = video_register_device(&av->vdev, VFL_TYPE_VIDEO, -1); > >-- >2.49.0 Thanks for the patch. Reviewed-by: Bingbu Cao <bin...@in...> |
|
From: Hans V. <hve...@ke...> - 2025-08-07 20:56:34
|
On 07/08/2025 22:33, Laurent Pinchart wrote:
> Hi Hans,
>
> On Thu, Aug 07, 2025 at 09:58:34AM +0200, Hans Verkuil wrote:
>> On 07/08/2025 09:26, Hans Verkuil wrote:
>>> On 02/08/2025 11:23, Jacopo Mondi wrote:
>>>> From: Laurent Pinchart <lau...@id...>
>>>>
>>>> Now that all drivers access the v4l2_fh from the file structure, there
>>>> is no need to pass it as an explicit argument to ioctl handlers. Set the
>>>> argument to NULL in the w__video_do_ioctl(), and drop the name of the
>>>> void *fh argument in the ioctl handler declarations to indicate it is
>>>> not used.
>>>>
>>>> The argument could be removed altogether with a mechanical change
>>>> (probably using coccinelle), but there are plans to pass a new argument
>>>> to the ioctl handlers in the near future. The tree-wide change to remove
>>>> the argument, only to add another one soon after, would be too much
>>>> churn.
>>>>
>>>> Signed-off-by: Laurent Pinchart <lau...@id...>
>>>> Signed-off-by: Jacopo Mondi <jac...@id...>
>>>> ---
>>>> drivers/media/v4l2-core/v4l2-ioctl.c | 5 +-
>>>> include/media/v4l2-ioctl.h | 236 +++++++++++++++++------------------
>>>> 2 files changed, 120 insertions(+), 121 deletions(-)
>>>>
>>>> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
>>>> index 44c2f5ef3dae407d9786c5278d13efc982be2ff0..248a0b5b56ec7a09f2d4c61114f81aa5a9b8b041 100644
>>>> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
>>>> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
>>>> @@ -3078,7 +3078,6 @@ static long __video_do_ioctl(struct file *file,
>>>> bool write_only = false;
>>>> struct v4l2_ioctl_info default_info;
>>>> const struct v4l2_ioctl_info *info;
>>>> - void *fh = file_to_v4l2_fh(file);
>>>> struct v4l2_fh *vfh = NULL;
>>>> int dev_debug = vfd->dev_debug;
>>>> long ret = -ENOTTY;
>>>> @@ -3140,11 +3139,11 @@ static long __video_do_ioctl(struct file *file,
>>>>
>>>> write_only = _IOC_DIR(cmd) == _IOC_WRITE;
>>>> if (info != &default_info) {
>>>> - ret = info->func(ops, file, fh, arg);
>>>> + ret = info->func(ops, file, NULL, arg);
>>>> } else if (!ops->vidioc_default) {
>>>> ret = -ENOTTY;
>>>> } else {
>>>> - ret = ops->vidioc_default(file, fh,
>>>> + ret = ops->vidioc_default(file, NULL,
>>>> vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
>>>> cmd, arg);
>>>> }
>>>
>>> drivers/media/v4l2-core/v4l2-compat-ioctl32.c also calls ops->vidioc_query_ext_ctrl
>>> directly, but still passes the fh as second argument: that needs to be replaced by
>>> a NULL pointer as well. That should be fixed in this patch as well.
>
> Oops, I missed it. Will be fixed in v2.
>
>>> Regarding v4l2-ioctl.c: I would like a follow-up patch that pushes the NULL pointer
>>> down into each ioctl helper function. I.e. drop the 'void *fh' argument in the
>>> struct v4l2_ioctl_info 'func' callback, and all callbacks like v4l_g_fmt() just
>>> replace 'fh' by 'NULL' when they call the vidioc op.
>
> I'll add a patch in v2.
>
>>> Part of it is that the core functions currently suggest that the second argument is
>>> a filehandle (since it's still named 'fh'), which is obviously wrong. And I also think
>>> that the core framework shouldn't use a dummy second argument at all. I admit that
>>> changing all vidioc callbacks in the whole subsystem to drop the second argument is
>>> too much churn, but for this core file I think it is something that should be done.
>>
>> A follow-up on this: I would not be against a large patch that drops the second priv
>> argument from all vidioc ops since it is now unused. If nothing else, it helps ensure
>> that it is really unused by all drivers :-)
>
> I've considered that. We're working on introducing a video_device_state
> that will likely be passed as an argument to the ioctl handlers, and we
> thought that not removing the void *priv argument yet could mean less
> churn in drivers when we add the new argument, taking over the void
> *priv. However, the state should be passed through an explicitly typed
> pointer, so we'll have to patch all drivers anyway. I suppose we could
> drop the void pointer now, and add a new pointer later. What do you
> think ?
It depends on how what you think is the ETA for the video_device_state :-)
I think we can shelve this for now, but as mentioned below, at least replace
'fh' by 'priv' for the test drivers, pci skeleton driver and (I think) uvc.
Regards,
Hans
>
>> But if you don't want to go there, then there is something that I think need to be addressed:
>> a lot of drivers name the second argument 'fh' or '_fh' or even 'fh0'. Can we add a patch that
>> renames the second arg to 'priv'?
>>
>> At minimum I think this should be done for drivers/media/test-drivers and
>> samples/v4l/v4l2-pci-skeleton.c. These drivers are often used as reference drivers,
>> so they should be up-to-date.
>>
>> I would also suggest to do this for uvc since it is by far the most widely used media
>> driver.
>>
>> I also see the use of 'fh' in v4l2-mem2mem.c in a few places.
>>
>>>> diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
>>>> index 82695c3a300a73219f262fb556ed61a8f09d273e..223e2c7a3516fc96fb486ab64226163e52f775a6 100644
>>>> --- a/include/media/v4l2-ioctl.h
>>>> +++ b/include/media/v4l2-ioctl.h
>>>> @@ -293,144 +293,144 @@ struct v4l2_ioctl_ops {
>>>> /* ioctl callbacks */
>>>>
>>>> /* VIDIOC_QUERYCAP handler */
>>>> - int (*vidioc_querycap)(struct file *file, void *fh,
>>>> + int (*vidioc_querycap)(struct file *file, void *,
>>>> struct v4l2_capability *cap);
>>>>
>>>> /* VIDIOC_ENUM_FMT handlers */
>>>> - int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_vid_out)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>> - int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_fmt_meta_out)(struct file *file, void *,
>>>> struct v4l2_fmtdesc *f);
>>>>
>>>> /* VIDIOC_G_FMT handlers */
>>>> - int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_sdr_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_meta_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh,
>>>> + int (*vidioc_g_fmt_meta_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>>
>>>> /* VIDIOC_S_FMT handlers */
>>>> - int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_sdr_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_meta_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fmt_meta_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>>
>>>> /* VIDIOC_TRY_FMT handlers */
>>>> - int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_sdr_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_meta_cap)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>> - int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh,
>>>> + int (*vidioc_try_fmt_meta_out)(struct file *file, void *,
>>>> struct v4l2_format *f);
>>>>
>>>> /* Buffer handlers */
>>>> - int (*vidioc_reqbufs)(struct file *file, void *fh,
>>>> + int (*vidioc_reqbufs)(struct file *file, void *,
>>>> struct v4l2_requestbuffers *b);
>>>> - int (*vidioc_querybuf)(struct file *file, void *fh,
>>>> + int (*vidioc_querybuf)(struct file *file, void *,
>>>> struct v4l2_buffer *b);
>>>> - int (*vidioc_qbuf)(struct file *file, void *fh,
>>>> + int (*vidioc_qbuf)(struct file *file, void *,
>>>> struct v4l2_buffer *b);
>>>> - int (*vidioc_expbuf)(struct file *file, void *fh,
>>>> + int (*vidioc_expbuf)(struct file *file, void *,
>>>> struct v4l2_exportbuffer *e);
>>>> - int (*vidioc_dqbuf)(struct file *file, void *fh,
>>>> + int (*vidioc_dqbuf)(struct file *file, void *,
>>>> struct v4l2_buffer *b);
>>>>
>>>> - int (*vidioc_create_bufs)(struct file *file, void *fh,
>>>> + int (*vidioc_create_bufs)(struct file *file, void *,
>>>> struct v4l2_create_buffers *b);
>>>> - int (*vidioc_prepare_buf)(struct file *file, void *fh,
>>>> + int (*vidioc_prepare_buf)(struct file *file, void *,
>>>> struct v4l2_buffer *b);
>>>> - int (*vidioc_remove_bufs)(struct file *file, void *fh,
>>>> + int (*vidioc_remove_bufs)(struct file *file, void *,
>>>> struct v4l2_remove_buffers *d);
>>>>
>>>> - int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
>>>> - int (*vidioc_g_fbuf)(struct file *file, void *fh,
>>>> + int (*vidioc_overlay)(struct file *file, void *, unsigned int i);
>>>> + int (*vidioc_g_fbuf)(struct file *file, void *,
>>>> struct v4l2_framebuffer *a);
>>>> - int (*vidioc_s_fbuf)(struct file *file, void *fh,
>>>> + int (*vidioc_s_fbuf)(struct file *file, void *,
>>>> const struct v4l2_framebuffer *a);
>>>>
>>>> /* Stream on/off */
>>>> - int (*vidioc_streamon)(struct file *file, void *fh,
>>>> + int (*vidioc_streamon)(struct file *file, void *,
>>>> enum v4l2_buf_type i);
>>>> - int (*vidioc_streamoff)(struct file *file, void *fh,
>>>> + int (*vidioc_streamoff)(struct file *file, void *,
>>>> enum v4l2_buf_type i);
>>>>
>>>> /*
>>>> @@ -438,135 +438,135 @@ struct v4l2_ioctl_ops {
>>>> *
>>>> * Note: ENUMSTD is handled by videodev.c
>>>> */
>>>> - int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
>>>> - int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
>>>> - int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
>>>> + int (*vidioc_g_std)(struct file *file, void *, v4l2_std_id *norm);
>>>> + int (*vidioc_s_std)(struct file *file, void *, v4l2_std_id norm);
>>>> + int (*vidioc_querystd)(struct file *file, void *, v4l2_std_id *a);
>>>>
>>>> /* Input handling */
>>>> - int (*vidioc_enum_input)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_input)(struct file *file, void *,
>>>> struct v4l2_input *inp);
>>>> - int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
>>>> - int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
>>>> + int (*vidioc_g_input)(struct file *file, void *, unsigned int *i);
>>>> + int (*vidioc_s_input)(struct file *file, void *, unsigned int i);
>>>>
>>>> /* Output handling */
>>>> - int (*vidioc_enum_output)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_output)(struct file *file, void *,
>>>> struct v4l2_output *a);
>>>> - int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
>>>> - int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
>>>> + int (*vidioc_g_output)(struct file *file, void *, unsigned int *i);
>>>> + int (*vidioc_s_output)(struct file *file, void *, unsigned int i);
>>>>
>>>> /* Control handling */
>>>> - int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
>>>> + int (*vidioc_query_ext_ctrl)(struct file *file, void *,
>>>> struct v4l2_query_ext_ctrl *a);
>>>> - int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
>>>> + int (*vidioc_g_ext_ctrls)(struct file *file, void *,
>>>> struct v4l2_ext_controls *a);
>>>> - int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
>>>> + int (*vidioc_s_ext_ctrls)(struct file *file, void *,
>>>> struct v4l2_ext_controls *a);
>>>> - int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
>>>> + int (*vidioc_try_ext_ctrls)(struct file *file, void *,
>>>> struct v4l2_ext_controls *a);
>>>> - int (*vidioc_querymenu)(struct file *file, void *fh,
>>>> + int (*vidioc_querymenu)(struct file *file, void *,
>>>> struct v4l2_querymenu *a);
>>>>
>>>> /* Audio ioctls */
>>>> - int (*vidioc_enumaudio)(struct file *file, void *fh,
>>>> + int (*vidioc_enumaudio)(struct file *file, void *,
>>>> struct v4l2_audio *a);
>>>> - int (*vidioc_g_audio)(struct file *file, void *fh,
>>>> + int (*vidioc_g_audio)(struct file *file, void *,
>>>> struct v4l2_audio *a);
>>>> - int (*vidioc_s_audio)(struct file *file, void *fh,
>>>> + int (*vidioc_s_audio)(struct file *file, void *,
>>>> const struct v4l2_audio *a);
>>>>
>>>> /* Audio out ioctls */
>>>> - int (*vidioc_enumaudout)(struct file *file, void *fh,
>>>> + int (*vidioc_enumaudout)(struct file *file, void *,
>>>> struct v4l2_audioout *a);
>>>> - int (*vidioc_g_audout)(struct file *file, void *fh,
>>>> + int (*vidioc_g_audout)(struct file *file, void *,
>>>> struct v4l2_audioout *a);
>>>> - int (*vidioc_s_audout)(struct file *file, void *fh,
>>>> + int (*vidioc_s_audout)(struct file *file, void *,
>>>> const struct v4l2_audioout *a);
>>>> - int (*vidioc_g_modulator)(struct file *file, void *fh,
>>>> + int (*vidioc_g_modulator)(struct file *file, void *,
>>>> struct v4l2_modulator *a);
>>>> - int (*vidioc_s_modulator)(struct file *file, void *fh,
>>>> + int (*vidioc_s_modulator)(struct file *file, void *,
>>>> const struct v4l2_modulator *a);
>>>> /* Crop ioctls */
>>>> - int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
>>>> + int (*vidioc_g_pixelaspect)(struct file *file, void *,
>>>> int buf_type, struct v4l2_fract *aspect);
>>>> - int (*vidioc_g_selection)(struct file *file, void *fh,
>>>> + int (*vidioc_g_selection)(struct file *file, void *,
>>>> struct v4l2_selection *s);
>>>> - int (*vidioc_s_selection)(struct file *file, void *fh,
>>>> + int (*vidioc_s_selection)(struct file *file, void *,
>>>> struct v4l2_selection *s);
>>>> /* Compression ioctls */
>>>> - int (*vidioc_g_jpegcomp)(struct file *file, void *fh,
>>>> + int (*vidioc_g_jpegcomp)(struct file *file, void *,
>>>> struct v4l2_jpegcompression *a);
>>>> - int (*vidioc_s_jpegcomp)(struct file *file, void *fh,
>>>> + int (*vidioc_s_jpegcomp)(struct file *file, void *,
>>>> const struct v4l2_jpegcompression *a);
>>>> - int (*vidioc_g_enc_index)(struct file *file, void *fh,
>>>> + int (*vidioc_g_enc_index)(struct file *file, void *,
>>>> struct v4l2_enc_idx *a);
>>>> - int (*vidioc_encoder_cmd)(struct file *file, void *fh,
>>>> + int (*vidioc_encoder_cmd)(struct file *file, void *,
>>>> struct v4l2_encoder_cmd *a);
>>>> - int (*vidioc_try_encoder_cmd)(struct file *file, void *fh,
>>>> + int (*vidioc_try_encoder_cmd)(struct file *file, void *,
>>>> struct v4l2_encoder_cmd *a);
>>>> - int (*vidioc_decoder_cmd)(struct file *file, void *fh,
>>>> + int (*vidioc_decoder_cmd)(struct file *file, void *,
>>>> struct v4l2_decoder_cmd *a);
>>>> - int (*vidioc_try_decoder_cmd)(struct file *file, void *fh,
>>>> + int (*vidioc_try_decoder_cmd)(struct file *file, void *,
>>>> struct v4l2_decoder_cmd *a);
>>>>
>>>> /* Stream type-dependent parameter ioctls */
>>>> - int (*vidioc_g_parm)(struct file *file, void *fh,
>>>> + int (*vidioc_g_parm)(struct file *file, void *,
>>>> struct v4l2_streamparm *a);
>>>> - int (*vidioc_s_parm)(struct file *file, void *fh,
>>>> + int (*vidioc_s_parm)(struct file *file, void *,
>>>> struct v4l2_streamparm *a);
>>>>
>>>> /* Tuner ioctls */
>>>> - int (*vidioc_g_tuner)(struct file *file, void *fh,
>>>> + int (*vidioc_g_tuner)(struct file *file, void *,
>>>> struct v4l2_tuner *a);
>>>> - int (*vidioc_s_tuner)(struct file *file, void *fh,
>>>> + int (*vidioc_s_tuner)(struct file *file, void *,
>>>> const struct v4l2_tuner *a);
>>>> - int (*vidioc_g_frequency)(struct file *file, void *fh,
>>>> + int (*vidioc_g_frequency)(struct file *file, void *,
>>>> struct v4l2_frequency *a);
>>>> - int (*vidioc_s_frequency)(struct file *file, void *fh,
>>>> + int (*vidioc_s_frequency)(struct file *file, void *,
>>>> const struct v4l2_frequency *a);
>>>> - int (*vidioc_enum_freq_bands)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_freq_bands)(struct file *file, void *,
>>>> struct v4l2_frequency_band *band);
>>>>
>>>> /* Sliced VBI cap */
>>>> - int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *,
>>>> struct v4l2_sliced_vbi_cap *a);
>>>>
>>>> /* Log status ioctl */
>>>> - int (*vidioc_log_status)(struct file *file, void *fh);
>>>> + int (*vidioc_log_status)(struct file *file, void *);
>>>>
>>>> - int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh,
>>>> + int (*vidioc_s_hw_freq_seek)(struct file *file, void *,
>>>> const struct v4l2_hw_freq_seek *a);
>>>>
>>>> /* Debugging ioctls */
>>>> #ifdef CONFIG_VIDEO_ADV_DEBUG
>>>> - int (*vidioc_g_register)(struct file *file, void *fh,
>>>> + int (*vidioc_g_register)(struct file *file, void *,
>>>> struct v4l2_dbg_register *reg);
>>>> - int (*vidioc_s_register)(struct file *file, void *fh,
>>>> + int (*vidioc_s_register)(struct file *file, void *,
>>>> const struct v4l2_dbg_register *reg);
>>>>
>>>> - int (*vidioc_g_chip_info)(struct file *file, void *fh,
>>>> + int (*vidioc_g_chip_info)(struct file *file, void *,
>>>> struct v4l2_dbg_chip_info *chip);
>>>> #endif
>>>>
>>>> - int (*vidioc_enum_framesizes)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_framesizes)(struct file *file, void *,
>>>> struct v4l2_frmsizeenum *fsize);
>>>>
>>>> - int (*vidioc_enum_frameintervals)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_frameintervals)(struct file *file, void *,
>>>> struct v4l2_frmivalenum *fival);
>>>>
>>>> /* DV Timings IOCTLs */
>>>> - int (*vidioc_s_dv_timings)(struct file *file, void *fh,
>>>> + int (*vidioc_s_dv_timings)(struct file *file, void *,
>>>> struct v4l2_dv_timings *timings);
>>>> - int (*vidioc_g_dv_timings)(struct file *file, void *fh,
>>>> + int (*vidioc_g_dv_timings)(struct file *file, void *,
>>>> struct v4l2_dv_timings *timings);
>>>> - int (*vidioc_query_dv_timings)(struct file *file, void *fh,
>>>> + int (*vidioc_query_dv_timings)(struct file *file, void *,
>>>> struct v4l2_dv_timings *timings);
>>>> - int (*vidioc_enum_dv_timings)(struct file *file, void *fh,
>>>> + int (*vidioc_enum_dv_timings)(struct file *file, void *,
>>>> struct v4l2_enum_dv_timings *timings);
>>>> - int (*vidioc_dv_timings_cap)(struct file *file, void *fh,
>>>> + int (*vidioc_dv_timings_cap)(struct file *file, void *,
>>>> struct v4l2_dv_timings_cap *cap);
>>>> - int (*vidioc_g_edid)(struct file *file, void *fh,
>>>> + int (*vidioc_g_edid)(struct file *file, void *,
>>>> struct v4l2_edid *edid);
>>>> - int (*vidioc_s_edid)(struct file *file, void *fh,
>>>> + int (*vidioc_s_edid)(struct file *file, void *,
>>>> struct v4l2_edid *edid);
>>>>
>>>> int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
>>>> @@ -575,7 +575,7 @@ struct v4l2_ioctl_ops {
>>>> const struct v4l2_event_subscription *sub);
>>>>
>>>> /* For other private ioctls */
>>>> - long (*vidioc_default)(struct file *file, void *fh,
>>>> + long (*vidioc_default)(struct file *file, void *,
>>>> bool valid_prio, unsigned int cmd, void *arg);
>>>> };
>>>>
>
|
|
From: Hans V. <hve...@ke...> - 2025-08-07 20:51:56
|
On 07/08/2025 22:25, Laurent Pinchart wrote:
> On Thu, Aug 07, 2025 at 08:00:06PM +0300, Laurent Pinchart wrote:
>> On Thu, Aug 07, 2025 at 11:50:07AM +0300, Laurent Pinchart wrote:
>>> On Wed, Aug 06, 2025 at 02:45:14PM +0200, Hans Verkuil wrote:
>>>> On 02/08/2025 11:22, Jacopo Mondi wrote:
>>>>> From: Laurent Pinchart <lau...@id...>
>>>>>
>>>>> Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
>>>>> the file->private_data pointer to NULL in their video device .release()
>>>>> file operation handler. Move the code to the v4l2_fh_del() function to
>>>>> avoid direct access to file->private_data in drivers. This requires
>>>>> adding a file pointer argument to the function.
>>>>>
>>>>> Changes to drivers have been generated with the following coccinelle
>>>>> semantic patch:
>>>>>
>>>>> @@
>>>>> expression fh;
>>>>> identifier filp;
>>>>> identifier release;
>>>>> type ret;
>>>>> @@
>>>>> ret release(..., struct file *filp, ...)
>>>>> {
>>>>> <...
>>>>> - filp->private_data = NULL;
>>>>> ...
>>>>> - v4l2_fh_del(fh);
>>>>> + v4l2_fh_del(fh, filp);
>>>>> ...>
>>>>> }
>>>>>
>>>>> @@
>>>>> expression fh;
>>>>> identifier filp;
>>>>> identifier release;
>>>>> type ret;
>>>>> @@
>>>>> ret release(..., struct file *filp, ...)
>>>>> {
>>>>> <...
>>>>> - v4l2_fh_del(fh);
>>>>> + v4l2_fh_del(fh, filp);
>>>>> ...
>>>>> - filp->private_data = NULL;
>>>>> ...>
>>>>> }
>>>>>
>>>>> @@
>>>>> expression fh;
>>>>> identifier filp;
>>>>> identifier release;
>>>>> type ret;
>>>>> @@
>>>>> ret release(..., struct file *filp, ...)
>>>>> {
>>>>> <...
>>>>> - v4l2_fh_del(fh);
>>>>> + v4l2_fh_del(fh, filp);
>>>>> ...>
>>>>> }
>>>>>
>>>>> Manual changes have been applied to Documentation/ to update the usage
>>>>> patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
>>>>> v4l2_fh_del() prototype and reset file->private_data, and to
>>>>> include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
>>>>> and its documentation.
>>>>>
>>>>> Additionally, white space issues have been fixed manually in
>>>>> drivers/usb/gadget/function/uvc_v4l2.c
>>>>>
>>>>> Signed-off-by: Laurent Pinchart <lau...@id...>
>>>>> Signed-off-by: Jacopo Mondi <jac...@id...>
>>>>> ---
>>>>> Documentation/driver-api/media/v4l2-fh.rst | 4 ++--
>>>>> Documentation/translations/zh_CN/video4linux/v4l2-framework.txt | 4 ++--
>>>>> drivers/media/pci/cx18/cx18-fileops.c | 4 ++--
>>>>> drivers/media/pci/ivtv/ivtv-fileops.c | 4 ++--
>>>>> drivers/media/pci/saa7164/saa7164-encoder.c | 2 +-
>>>>> drivers/media/pci/saa7164/saa7164-vbi.c | 2 +-
>>>>> drivers/media/platform/allegro-dvt/allegro-core.c | 2 +-
>>>>> drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 2 +-
>>>>> drivers/media/platform/amphion/vpu_v4l2.c | 4 ++--
>>>>> drivers/media/platform/chips-media/coda/coda-common.c | 4 ++--
>>>>> drivers/media/platform/chips-media/wave5/wave5-helper.c | 2 +-
>>>>> drivers/media/platform/imagination/e5010-jpeg-enc.c | 4 ++--
>>>>> drivers/media/platform/m2m-deinterlace.c | 2 +-
>>>>> drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++--
>>>>> drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 4 ++--
>>>>> drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 4 ++--
>>>>> .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 4 ++--
>>>>> .../media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 4 ++--
>>>>> drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +-
>>>>> drivers/media/platform/nxp/dw100/dw100.c | 2 +-
>>>>> drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ++--
>>>>> drivers/media/platform/nxp/imx-pxp.c | 2 +-
>>>>> drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +-
>>>>> drivers/media/platform/nxp/mx2_emmaprp.c | 2 +-
>>>>> drivers/media/platform/qcom/iris/iris_vidc.c | 3 +--
>>>>> drivers/media/platform/qcom/venus/core.c | 2 +-
>>>>> drivers/media/platform/renesas/rcar_fdp1.c | 2 +-
>>>>> drivers/media/platform/renesas/rcar_jpu.c | 4 ++--
>>>>> drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 +-
>>>>> drivers/media/platform/rockchip/rga/rga.c | 2 +-
>>>>> drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +-
>>>>> drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 4 ++--
>>>>> drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 4 ++--
>>>>> drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +-
>>>>> drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 4 ++--
>>>>> drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++--
>>>>> drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 4 ++--
>>>>> drivers/media/platform/st/sti/delta/delta-v4l2.c | 4 ++--
>>>>> drivers/media/platform/st/sti/hva/hva-v4l2.c | 4 ++--
>>>>> drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +-
>>>>> drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +-
>>>>> drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +-
>>>>> drivers/media/platform/ti/omap3isp/ispvideo.c | 5 ++---
>>>>> drivers/media/platform/ti/vpe/vpe.c | 2 +-
>>>>> drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
>>>>> drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +-
>>>>> drivers/media/test-drivers/vim2m.c | 2 +-
>>>>> drivers/media/test-drivers/visl/visl-core.c | 2 +-
>>>>> drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +--
>>>>> drivers/media/v4l2-core/v4l2-fh.c | 7 ++++---
>>>>> drivers/media/v4l2-core/v4l2-subdev.c | 5 ++---
>>>>> drivers/staging/media/imx/imx-media-csc-scaler.c | 4 ++--
>>>>> drivers/staging/media/meson/vdec/vdec.c | 2 +-
>>>>> drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +-
>>>>> drivers/staging/most/video/video.c | 4 ++--
>>>>> drivers/usb/gadget/function/uvc_v4l2.c | 3 +--
>>>>> include/media/v4l2-fh.h | 5 ++++-
>>>>> 57 files changed, 89 insertions(+), 90 deletions(-)
>>>>>
>>>>
>>>> <snip>
>>>>
>>>>> diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
>>>>> index b59b1084d8cdf1b62da12879e21dbe56c2109648..df3ba9d4674bd25626cfcddc2d0cb28c233e3cc3 100644
>>>>> --- a/drivers/media/v4l2-core/v4l2-fh.c
>>>>> +++ b/drivers/media/v4l2-core/v4l2-fh.c
>>>>> @@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp)
>>>>> }
>>>>> EXPORT_SYMBOL_GPL(v4l2_fh_open);
>>>>>
>>>>> -void v4l2_fh_del(struct v4l2_fh *fh)
>>>>> +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
>>>>
>>>> Instead of adding a second argument, perhaps it is better to
>>>> just provide the filp pointer. After all, you can get the v4l2_fh
>>>> from filp->private_data.
>>>>
>>>> It simplifies the code a bit.
>>>
>>> That's an interesting idea. I'll give it a try.
>>
>> We end up with code like (e.g. in v4l2_fh_release(), with similar
>> constructs in lots of drivers)
>>
>> if (fh) {
>> v4l2_fh_del(filp);
>> v4l2_fh_exit(fh);
>> kfree(fh);
>> }
>>
>> compared to
>>
>> if (fh) {
>> v4l2_fh_del(fh, filp);
>> v4l2_fh_exit(fh);
>> kfree(fh);
>> }
>>
>> with the existing patch. I find the fact that v4l2_fh_del() takes a
>> different pointer than v4l2_fh_exit() a bit disturbing. If you think
>> it's better I'll drop the fh argument in v2.
>
> I gave it a try, and looking at the function prototype, its
> documentation, the imbalance with v4l2_fh_add(), and the code in the
> callers, I think keeping both arguments would look cleaner. Please tell
> me if you feel strongly about this, I can still submit a patch to drop
> the argument. It can very easily be scripted with coccinelle and doesn't
> conflict with the rest of the series, so it could also be done later.
Looking at all the drivers that call v4l2_fh_del/exit I always see v4l2_fh_del()
directly followed by v4l2_fh_exit(). I think it would make a lot of sense to just
combine the two as a single function: v4l2_fh_del_exit(filp).
That simplifies the code and solves the imbalance.
Regards,
Hans
>
>>>>> {
>>>>> unsigned long flags;
>>>>>
>>>>> @@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh)
>>>>> list_del_init(&fh->list);
>>>>> spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
>>>>> v4l2_prio_close(fh->vdev->prio, fh->prio);
>>>>> +
>>>>> + filp->private_data = NULL;
>>>>> }
>>>>> EXPORT_SYMBOL_GPL(v4l2_fh_del);
>>>>>
>>>>> @@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp)
>>>>> struct v4l2_fh *fh = file_to_v4l2_fh(filp);
>>>>>
>>>>> if (fh) {
>>>>> - v4l2_fh_del(fh);
>>>>> + v4l2_fh_del(fh, filp);
>>>>> v4l2_fh_exit(fh);
>>>>> kfree(fh);
>>>>> - filp->private_data = NULL;
>>>>> }
>>>>> return 0;
>>>>> }
>>>>
>>>> <snip>
>>>>
>>>>> diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
>>>>> index d8fcf49f10e09452b73499f4a9bd1285bc2835a5..5e4c761635120608e0b588e0b0daf63e69588d38 100644
>>>>> --- a/include/media/v4l2-fh.h
>>>>> +++ b/include/media/v4l2-fh.h
>>>>> @@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp);
>>>>> * v4l2_fh_del - Remove file handle from the list of file handles.
>>>>> *
>>>>> * @fh: pointer to &struct v4l2_fh
>>>>> + * @filp: pointer to &struct file associated with @fh
>>>>> + *
>>>>> + * The function resets filp->private_data to NULL.
>>>>> *
>>>>> * .. note::
>>>>> * Must be called in v4l2_file_operations->release\(\) handler if the driver
>>>>> * uses &struct v4l2_fh.
>>>>> */
>>>>> -void v4l2_fh_del(struct v4l2_fh *fh);
>>>>> +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
>>>>>
>>>>> /**
>>>>> * v4l2_fh_exit - Release resources related to a file handle.
>
|
|
From: Laurent P. <lau...@id...> - 2025-08-07 20:33:52
|
Hi Hans,
On Thu, Aug 07, 2025 at 09:58:34AM +0200, Hans Verkuil wrote:
> On 07/08/2025 09:26, Hans Verkuil wrote:
> > On 02/08/2025 11:23, Jacopo Mondi wrote:
> >> From: Laurent Pinchart <lau...@id...>
> >>
> >> Now that all drivers access the v4l2_fh from the file structure, there
> >> is no need to pass it as an explicit argument to ioctl handlers. Set the
> >> argument to NULL in the w__video_do_ioctl(), and drop the name of the
> >> void *fh argument in the ioctl handler declarations to indicate it is
> >> not used.
> >>
> >> The argument could be removed altogether with a mechanical change
> >> (probably using coccinelle), but there are plans to pass a new argument
> >> to the ioctl handlers in the near future. The tree-wide change to remove
> >> the argument, only to add another one soon after, would be too much
> >> churn.
> >>
> >> Signed-off-by: Laurent Pinchart <lau...@id...>
> >> Signed-off-by: Jacopo Mondi <jac...@id...>
> >> ---
> >> drivers/media/v4l2-core/v4l2-ioctl.c | 5 +-
> >> include/media/v4l2-ioctl.h | 236 +++++++++++++++++------------------
> >> 2 files changed, 120 insertions(+), 121 deletions(-)
> >>
> >> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> >> index 44c2f5ef3dae407d9786c5278d13efc982be2ff0..248a0b5b56ec7a09f2d4c61114f81aa5a9b8b041 100644
> >> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> >> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> >> @@ -3078,7 +3078,6 @@ static long __video_do_ioctl(struct file *file,
> >> bool write_only = false;
> >> struct v4l2_ioctl_info default_info;
> >> const struct v4l2_ioctl_info *info;
> >> - void *fh = file_to_v4l2_fh(file);
> >> struct v4l2_fh *vfh = NULL;
> >> int dev_debug = vfd->dev_debug;
> >> long ret = -ENOTTY;
> >> @@ -3140,11 +3139,11 @@ static long __video_do_ioctl(struct file *file,
> >>
> >> write_only = _IOC_DIR(cmd) == _IOC_WRITE;
> >> if (info != &default_info) {
> >> - ret = info->func(ops, file, fh, arg);
> >> + ret = info->func(ops, file, NULL, arg);
> >> } else if (!ops->vidioc_default) {
> >> ret = -ENOTTY;
> >> } else {
> >> - ret = ops->vidioc_default(file, fh,
> >> + ret = ops->vidioc_default(file, NULL,
> >> vfh ? v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
> >> cmd, arg);
> >> }
> >
> > drivers/media/v4l2-core/v4l2-compat-ioctl32.c also calls ops->vidioc_query_ext_ctrl
> > directly, but still passes the fh as second argument: that needs to be replaced by
> > a NULL pointer as well. That should be fixed in this patch as well.
Oops, I missed it. Will be fixed in v2.
> > Regarding v4l2-ioctl.c: I would like a follow-up patch that pushes the NULL pointer
> > down into each ioctl helper function. I.e. drop the 'void *fh' argument in the
> > struct v4l2_ioctl_info 'func' callback, and all callbacks like v4l_g_fmt() just
> > replace 'fh' by 'NULL' when they call the vidioc op.
I'll add a patch in v2.
> > Part of it is that the core functions currently suggest that the second argument is
> > a filehandle (since it's still named 'fh'), which is obviously wrong. And I also think
> > that the core framework shouldn't use a dummy second argument at all. I admit that
> > changing all vidioc callbacks in the whole subsystem to drop the second argument is
> > too much churn, but for this core file I think it is something that should be done.
>
> A follow-up on this: I would not be against a large patch that drops the second priv
> argument from all vidioc ops since it is now unused. If nothing else, it helps ensure
> that it is really unused by all drivers :-)
I've considered that. We're working on introducing a video_device_state
that will likely be passed as an argument to the ioctl handlers, and we
thought that not removing the void *priv argument yet could mean less
churn in drivers when we add the new argument, taking over the void
*priv. However, the state should be passed through an explicitly typed
pointer, so we'll have to patch all drivers anyway. I suppose we could
drop the void pointer now, and add a new pointer later. What do you
think ?
> But if you don't want to go there, then there is something that I think need to be addressed:
> a lot of drivers name the second argument 'fh' or '_fh' or even 'fh0'. Can we add a patch that
> renames the second arg to 'priv'?
>
> At minimum I think this should be done for drivers/media/test-drivers and
> samples/v4l/v4l2-pci-skeleton.c. These drivers are often used as reference drivers,
> so they should be up-to-date.
>
> I would also suggest to do this for uvc since it is by far the most widely used media
> driver.
>
> I also see the use of 'fh' in v4l2-mem2mem.c in a few places.
>
> >> diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h
> >> index 82695c3a300a73219f262fb556ed61a8f09d273e..223e2c7a3516fc96fb486ab64226163e52f775a6 100644
> >> --- a/include/media/v4l2-ioctl.h
> >> +++ b/include/media/v4l2-ioctl.h
> >> @@ -293,144 +293,144 @@ struct v4l2_ioctl_ops {
> >> /* ioctl callbacks */
> >>
> >> /* VIDIOC_QUERYCAP handler */
> >> - int (*vidioc_querycap)(struct file *file, void *fh,
> >> + int (*vidioc_querycap)(struct file *file, void *,
> >> struct v4l2_capability *cap);
> >>
> >> /* VIDIOC_ENUM_FMT handlers */
> >> - int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_vid_cap)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_vid_overlay)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_vid_out)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_vid_out)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_sdr_cap)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_sdr_out)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_meta_cap)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >> - int (*vidioc_enum_fmt_meta_out)(struct file *file, void *fh,
> >> + int (*vidioc_enum_fmt_meta_out)(struct file *file, void *,
> >> struct v4l2_fmtdesc *f);
> >>
> >> /* VIDIOC_G_FMT handlers */
> >> - int (*vidioc_g_fmt_vid_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vid_out)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_out_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_sliced_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_sliced_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_cap_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_vid_out_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_sdr_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_sdr_out)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_sdr_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_meta_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_meta_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_g_fmt_meta_out)(struct file *file, void *fh,
> >> + int (*vidioc_g_fmt_meta_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >>
> >> /* VIDIOC_S_FMT handlers */
> >> - int (*vidioc_s_fmt_vid_cap)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vid_out)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_out_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_sliced_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_sliced_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_cap_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_vid_out_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_sdr_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_sdr_out)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_sdr_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_meta_cap)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_meta_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_s_fmt_meta_out)(struct file *file, void *fh,
> >> + int (*vidioc_s_fmt_meta_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >>
> >> /* VIDIOC_TRY_FMT handlers */
> >> - int (*vidioc_try_fmt_vid_cap)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vid_out)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_out_overlay)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_sliced_vbi_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_sliced_vbi_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_cap_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_vid_out_mplane)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_sdr_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_sdr_out)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_sdr_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_meta_cap)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_meta_cap)(struct file *file, void *,
> >> struct v4l2_format *f);
> >> - int (*vidioc_try_fmt_meta_out)(struct file *file, void *fh,
> >> + int (*vidioc_try_fmt_meta_out)(struct file *file, void *,
> >> struct v4l2_format *f);
> >>
> >> /* Buffer handlers */
> >> - int (*vidioc_reqbufs)(struct file *file, void *fh,
> >> + int (*vidioc_reqbufs)(struct file *file, void *,
> >> struct v4l2_requestbuffers *b);
> >> - int (*vidioc_querybuf)(struct file *file, void *fh,
> >> + int (*vidioc_querybuf)(struct file *file, void *,
> >> struct v4l2_buffer *b);
> >> - int (*vidioc_qbuf)(struct file *file, void *fh,
> >> + int (*vidioc_qbuf)(struct file *file, void *,
> >> struct v4l2_buffer *b);
> >> - int (*vidioc_expbuf)(struct file *file, void *fh,
> >> + int (*vidioc_expbuf)(struct file *file, void *,
> >> struct v4l2_exportbuffer *e);
> >> - int (*vidioc_dqbuf)(struct file *file, void *fh,
> >> + int (*vidioc_dqbuf)(struct file *file, void *,
> >> struct v4l2_buffer *b);
> >>
> >> - int (*vidioc_create_bufs)(struct file *file, void *fh,
> >> + int (*vidioc_create_bufs)(struct file *file, void *,
> >> struct v4l2_create_buffers *b);
> >> - int (*vidioc_prepare_buf)(struct file *file, void *fh,
> >> + int (*vidioc_prepare_buf)(struct file *file, void *,
> >> struct v4l2_buffer *b);
> >> - int (*vidioc_remove_bufs)(struct file *file, void *fh,
> >> + int (*vidioc_remove_bufs)(struct file *file, void *,
> >> struct v4l2_remove_buffers *d);
> >>
> >> - int (*vidioc_overlay)(struct file *file, void *fh, unsigned int i);
> >> - int (*vidioc_g_fbuf)(struct file *file, void *fh,
> >> + int (*vidioc_overlay)(struct file *file, void *, unsigned int i);
> >> + int (*vidioc_g_fbuf)(struct file *file, void *,
> >> struct v4l2_framebuffer *a);
> >> - int (*vidioc_s_fbuf)(struct file *file, void *fh,
> >> + int (*vidioc_s_fbuf)(struct file *file, void *,
> >> const struct v4l2_framebuffer *a);
> >>
> >> /* Stream on/off */
> >> - int (*vidioc_streamon)(struct file *file, void *fh,
> >> + int (*vidioc_streamon)(struct file *file, void *,
> >> enum v4l2_buf_type i);
> >> - int (*vidioc_streamoff)(struct file *file, void *fh,
> >> + int (*vidioc_streamoff)(struct file *file, void *,
> >> enum v4l2_buf_type i);
> >>
> >> /*
> >> @@ -438,135 +438,135 @@ struct v4l2_ioctl_ops {
> >> *
> >> * Note: ENUMSTD is handled by videodev.c
> >> */
> >> - int (*vidioc_g_std)(struct file *file, void *fh, v4l2_std_id *norm);
> >> - int (*vidioc_s_std)(struct file *file, void *fh, v4l2_std_id norm);
> >> - int (*vidioc_querystd)(struct file *file, void *fh, v4l2_std_id *a);
> >> + int (*vidioc_g_std)(struct file *file, void *, v4l2_std_id *norm);
> >> + int (*vidioc_s_std)(struct file *file, void *, v4l2_std_id norm);
> >> + int (*vidioc_querystd)(struct file *file, void *, v4l2_std_id *a);
> >>
> >> /* Input handling */
> >> - int (*vidioc_enum_input)(struct file *file, void *fh,
> >> + int (*vidioc_enum_input)(struct file *file, void *,
> >> struct v4l2_input *inp);
> >> - int (*vidioc_g_input)(struct file *file, void *fh, unsigned int *i);
> >> - int (*vidioc_s_input)(struct file *file, void *fh, unsigned int i);
> >> + int (*vidioc_g_input)(struct file *file, void *, unsigned int *i);
> >> + int (*vidioc_s_input)(struct file *file, void *, unsigned int i);
> >>
> >> /* Output handling */
> >> - int (*vidioc_enum_output)(struct file *file, void *fh,
> >> + int (*vidioc_enum_output)(struct file *file, void *,
> >> struct v4l2_output *a);
> >> - int (*vidioc_g_output)(struct file *file, void *fh, unsigned int *i);
> >> - int (*vidioc_s_output)(struct file *file, void *fh, unsigned int i);
> >> + int (*vidioc_g_output)(struct file *file, void *, unsigned int *i);
> >> + int (*vidioc_s_output)(struct file *file, void *, unsigned int i);
> >>
> >> /* Control handling */
> >> - int (*vidioc_query_ext_ctrl)(struct file *file, void *fh,
> >> + int (*vidioc_query_ext_ctrl)(struct file *file, void *,
> >> struct v4l2_query_ext_ctrl *a);
> >> - int (*vidioc_g_ext_ctrls)(struct file *file, void *fh,
> >> + int (*vidioc_g_ext_ctrls)(struct file *file, void *,
> >> struct v4l2_ext_controls *a);
> >> - int (*vidioc_s_ext_ctrls)(struct file *file, void *fh,
> >> + int (*vidioc_s_ext_ctrls)(struct file *file, void *,
> >> struct v4l2_ext_controls *a);
> >> - int (*vidioc_try_ext_ctrls)(struct file *file, void *fh,
> >> + int (*vidioc_try_ext_ctrls)(struct file *file, void *,
> >> struct v4l2_ext_controls *a);
> >> - int (*vidioc_querymenu)(struct file *file, void *fh,
> >> + int (*vidioc_querymenu)(struct file *file, void *,
> >> struct v4l2_querymenu *a);
> >>
> >> /* Audio ioctls */
> >> - int (*vidioc_enumaudio)(struct file *file, void *fh,
> >> + int (*vidioc_enumaudio)(struct file *file, void *,
> >> struct v4l2_audio *a);
> >> - int (*vidioc_g_audio)(struct file *file, void *fh,
> >> + int (*vidioc_g_audio)(struct file *file, void *,
> >> struct v4l2_audio *a);
> >> - int (*vidioc_s_audio)(struct file *file, void *fh,
> >> + int (*vidioc_s_audio)(struct file *file, void *,
> >> const struct v4l2_audio *a);
> >>
> >> /* Audio out ioctls */
> >> - int (*vidioc_enumaudout)(struct file *file, void *fh,
> >> + int (*vidioc_enumaudout)(struct file *file, void *,
> >> struct v4l2_audioout *a);
> >> - int (*vidioc_g_audout)(struct file *file, void *fh,
> >> + int (*vidioc_g_audout)(struct file *file, void *,
> >> struct v4l2_audioout *a);
> >> - int (*vidioc_s_audout)(struct file *file, void *fh,
> >> + int (*vidioc_s_audout)(struct file *file, void *,
> >> const struct v4l2_audioout *a);
> >> - int (*vidioc_g_modulator)(struct file *file, void *fh,
> >> + int (*vidioc_g_modulator)(struct file *file, void *,
> >> struct v4l2_modulator *a);
> >> - int (*vidioc_s_modulator)(struct file *file, void *fh,
> >> + int (*vidioc_s_modulator)(struct file *file, void *,
> >> const struct v4l2_modulator *a);
> >> /* Crop ioctls */
> >> - int (*vidioc_g_pixelaspect)(struct file *file, void *fh,
> >> + int (*vidioc_g_pixelaspect)(struct file *file, void *,
> >> int buf_type, struct v4l2_fract *aspect);
> >> - int (*vidioc_g_selection)(struct file *file, void *fh,
> >> + int (*vidioc_g_selection)(struct file *file, void *,
> >> struct v4l2_selection *s);
> >> - int (*vidioc_s_selection)(struct file *file, void *fh,
> >> + int (*vidioc_s_selection)(struct file *file, void *,
> >> struct v4l2_selection *s);
> >> /* Compression ioctls */
> >> - int (*vidioc_g_jpegcomp)(struct file *file, void *fh,
> >> + int (*vidioc_g_jpegcomp)(struct file *file, void *,
> >> struct v4l2_jpegcompression *a);
> >> - int (*vidioc_s_jpegcomp)(struct file *file, void *fh,
> >> + int (*vidioc_s_jpegcomp)(struct file *file, void *,
> >> const struct v4l2_jpegcompression *a);
> >> - int (*vidioc_g_enc_index)(struct file *file, void *fh,
> >> + int (*vidioc_g_enc_index)(struct file *file, void *,
> >> struct v4l2_enc_idx *a);
> >> - int (*vidioc_encoder_cmd)(struct file *file, void *fh,
> >> + int (*vidioc_encoder_cmd)(struct file *file, void *,
> >> struct v4l2_encoder_cmd *a);
> >> - int (*vidioc_try_encoder_cmd)(struct file *file, void *fh,
> >> + int (*vidioc_try_encoder_cmd)(struct file *file, void *,
> >> struct v4l2_encoder_cmd *a);
> >> - int (*vidioc_decoder_cmd)(struct file *file, void *fh,
> >> + int (*vidioc_decoder_cmd)(struct file *file, void *,
> >> struct v4l2_decoder_cmd *a);
> >> - int (*vidioc_try_decoder_cmd)(struct file *file, void *fh,
> >> + int (*vidioc_try_decoder_cmd)(struct file *file, void *,
> >> struct v4l2_decoder_cmd *a);
> >>
> >> /* Stream type-dependent parameter ioctls */
> >> - int (*vidioc_g_parm)(struct file *file, void *fh,
> >> + int (*vidioc_g_parm)(struct file *file, void *,
> >> struct v4l2_streamparm *a);
> >> - int (*vidioc_s_parm)(struct file *file, void *fh,
> >> + int (*vidioc_s_parm)(struct file *file, void *,
> >> struct v4l2_streamparm *a);
> >>
> >> /* Tuner ioctls */
> >> - int (*vidioc_g_tuner)(struct file *file, void *fh,
> >> + int (*vidioc_g_tuner)(struct file *file, void *,
> >> struct v4l2_tuner *a);
> >> - int (*vidioc_s_tuner)(struct file *file, void *fh,
> >> + int (*vidioc_s_tuner)(struct file *file, void *,
> >> const struct v4l2_tuner *a);
> >> - int (*vidioc_g_frequency)(struct file *file, void *fh,
> >> + int (*vidioc_g_frequency)(struct file *file, void *,
> >> struct v4l2_frequency *a);
> >> - int (*vidioc_s_frequency)(struct file *file, void *fh,
> >> + int (*vidioc_s_frequency)(struct file *file, void *,
> >> const struct v4l2_frequency *a);
> >> - int (*vidioc_enum_freq_bands)(struct file *file, void *fh,
> >> + int (*vidioc_enum_freq_bands)(struct file *file, void *,
> >> struct v4l2_frequency_band *band);
> >>
> >> /* Sliced VBI cap */
> >> - int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *fh,
> >> + int (*vidioc_g_sliced_vbi_cap)(struct file *file, void *,
> >> struct v4l2_sliced_vbi_cap *a);
> >>
> >> /* Log status ioctl */
> >> - int (*vidioc_log_status)(struct file *file, void *fh);
> >> + int (*vidioc_log_status)(struct file *file, void *);
> >>
> >> - int (*vidioc_s_hw_freq_seek)(struct file *file, void *fh,
> >> + int (*vidioc_s_hw_freq_seek)(struct file *file, void *,
> >> const struct v4l2_hw_freq_seek *a);
> >>
> >> /* Debugging ioctls */
> >> #ifdef CONFIG_VIDEO_ADV_DEBUG
> >> - int (*vidioc_g_register)(struct file *file, void *fh,
> >> + int (*vidioc_g_register)(struct file *file, void *,
> >> struct v4l2_dbg_register *reg);
> >> - int (*vidioc_s_register)(struct file *file, void *fh,
> >> + int (*vidioc_s_register)(struct file *file, void *,
> >> const struct v4l2_dbg_register *reg);
> >>
> >> - int (*vidioc_g_chip_info)(struct file *file, void *fh,
> >> + int (*vidioc_g_chip_info)(struct file *file, void *,
> >> struct v4l2_dbg_chip_info *chip);
> >> #endif
> >>
> >> - int (*vidioc_enum_framesizes)(struct file *file, void *fh,
> >> + int (*vidioc_enum_framesizes)(struct file *file, void *,
> >> struct v4l2_frmsizeenum *fsize);
> >>
> >> - int (*vidioc_enum_frameintervals)(struct file *file, void *fh,
> >> + int (*vidioc_enum_frameintervals)(struct file *file, void *,
> >> struct v4l2_frmivalenum *fival);
> >>
> >> /* DV Timings IOCTLs */
> >> - int (*vidioc_s_dv_timings)(struct file *file, void *fh,
> >> + int (*vidioc_s_dv_timings)(struct file *file, void *,
> >> struct v4l2_dv_timings *timings);
> >> - int (*vidioc_g_dv_timings)(struct file *file, void *fh,
> >> + int (*vidioc_g_dv_timings)(struct file *file, void *,
> >> struct v4l2_dv_timings *timings);
> >> - int (*vidioc_query_dv_timings)(struct file *file, void *fh,
> >> + int (*vidioc_query_dv_timings)(struct file *file, void *,
> >> struct v4l2_dv_timings *timings);
> >> - int (*vidioc_enum_dv_timings)(struct file *file, void *fh,
> >> + int (*vidioc_enum_dv_timings)(struct file *file, void *,
> >> struct v4l2_enum_dv_timings *timings);
> >> - int (*vidioc_dv_timings_cap)(struct file *file, void *fh,
> >> + int (*vidioc_dv_timings_cap)(struct file *file, void *,
> >> struct v4l2_dv_timings_cap *cap);
> >> - int (*vidioc_g_edid)(struct file *file, void *fh,
> >> + int (*vidioc_g_edid)(struct file *file, void *,
> >> struct v4l2_edid *edid);
> >> - int (*vidioc_s_edid)(struct file *file, void *fh,
> >> + int (*vidioc_s_edid)(struct file *file, void *,
> >> struct v4l2_edid *edid);
> >>
> >> int (*vidioc_subscribe_event)(struct v4l2_fh *fh,
> >> @@ -575,7 +575,7 @@ struct v4l2_ioctl_ops {
> >> const struct v4l2_event_subscription *sub);
> >>
> >> /* For other private ioctls */
> >> - long (*vidioc_default)(struct file *file, void *fh,
> >> + long (*vidioc_default)(struct file *file, void *,
> >> bool valid_prio, unsigned int cmd, void *arg);
> >> };
> >>
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-07 20:26:22
|
On Thu, Aug 07, 2025 at 08:00:06PM +0300, Laurent Pinchart wrote:
> On Thu, Aug 07, 2025 at 11:50:07AM +0300, Laurent Pinchart wrote:
> > On Wed, Aug 06, 2025 at 02:45:14PM +0200, Hans Verkuil wrote:
> > > On 02/08/2025 11:22, Jacopo Mondi wrote:
> > > > From: Laurent Pinchart <lau...@id...>
> > > >
> > > > Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
> > > > the file->private_data pointer to NULL in their video device .release()
> > > > file operation handler. Move the code to the v4l2_fh_del() function to
> > > > avoid direct access to file->private_data in drivers. This requires
> > > > adding a file pointer argument to the function.
> > > >
> > > > Changes to drivers have been generated with the following coccinelle
> > > > semantic patch:
> > > >
> > > > @@
> > > > expression fh;
> > > > identifier filp;
> > > > identifier release;
> > > > type ret;
> > > > @@
> > > > ret release(..., struct file *filp, ...)
> > > > {
> > > > <...
> > > > - filp->private_data = NULL;
> > > > ...
> > > > - v4l2_fh_del(fh);
> > > > + v4l2_fh_del(fh, filp);
> > > > ...>
> > > > }
> > > >
> > > > @@
> > > > expression fh;
> > > > identifier filp;
> > > > identifier release;
> > > > type ret;
> > > > @@
> > > > ret release(..., struct file *filp, ...)
> > > > {
> > > > <...
> > > > - v4l2_fh_del(fh);
> > > > + v4l2_fh_del(fh, filp);
> > > > ...
> > > > - filp->private_data = NULL;
> > > > ...>
> > > > }
> > > >
> > > > @@
> > > > expression fh;
> > > > identifier filp;
> > > > identifier release;
> > > > type ret;
> > > > @@
> > > > ret release(..., struct file *filp, ...)
> > > > {
> > > > <...
> > > > - v4l2_fh_del(fh);
> > > > + v4l2_fh_del(fh, filp);
> > > > ...>
> > > > }
> > > >
> > > > Manual changes have been applied to Documentation/ to update the usage
> > > > patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
> > > > v4l2_fh_del() prototype and reset file->private_data, and to
> > > > include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
> > > > and its documentation.
> > > >
> > > > Additionally, white space issues have been fixed manually in
> > > > drivers/usb/gadget/function/uvc_v4l2.c
> > > >
> > > > Signed-off-by: Laurent Pinchart <lau...@id...>
> > > > Signed-off-by: Jacopo Mondi <jac...@id...>
> > > > ---
> > > > Documentation/driver-api/media/v4l2-fh.rst | 4 ++--
> > > > Documentation/translations/zh_CN/video4linux/v4l2-framework.txt | 4 ++--
> > > > drivers/media/pci/cx18/cx18-fileops.c | 4 ++--
> > > > drivers/media/pci/ivtv/ivtv-fileops.c | 4 ++--
> > > > drivers/media/pci/saa7164/saa7164-encoder.c | 2 +-
> > > > drivers/media/pci/saa7164/saa7164-vbi.c | 2 +-
> > > > drivers/media/platform/allegro-dvt/allegro-core.c | 2 +-
> > > > drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 2 +-
> > > > drivers/media/platform/amphion/vpu_v4l2.c | 4 ++--
> > > > drivers/media/platform/chips-media/coda/coda-common.c | 4 ++--
> > > > drivers/media/platform/chips-media/wave5/wave5-helper.c | 2 +-
> > > > drivers/media/platform/imagination/e5010-jpeg-enc.c | 4 ++--
> > > > drivers/media/platform/m2m-deinterlace.c | 2 +-
> > > > drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++--
> > > > drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 4 ++--
> > > > drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 4 ++--
> > > > .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 4 ++--
> > > > .../media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 4 ++--
> > > > drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +-
> > > > drivers/media/platform/nxp/dw100/dw100.c | 2 +-
> > > > drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ++--
> > > > drivers/media/platform/nxp/imx-pxp.c | 2 +-
> > > > drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +-
> > > > drivers/media/platform/nxp/mx2_emmaprp.c | 2 +-
> > > > drivers/media/platform/qcom/iris/iris_vidc.c | 3 +--
> > > > drivers/media/platform/qcom/venus/core.c | 2 +-
> > > > drivers/media/platform/renesas/rcar_fdp1.c | 2 +-
> > > > drivers/media/platform/renesas/rcar_jpu.c | 4 ++--
> > > > drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 +-
> > > > drivers/media/platform/rockchip/rga/rga.c | 2 +-
> > > > drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +-
> > > > drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 4 ++--
> > > > drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 4 ++--
> > > > drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +-
> > > > drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 4 ++--
> > > > drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++--
> > > > drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 4 ++--
> > > > drivers/media/platform/st/sti/delta/delta-v4l2.c | 4 ++--
> > > > drivers/media/platform/st/sti/hva/hva-v4l2.c | 4 ++--
> > > > drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +-
> > > > drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +-
> > > > drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +-
> > > > drivers/media/platform/ti/omap3isp/ispvideo.c | 5 ++---
> > > > drivers/media/platform/ti/vpe/vpe.c | 2 +-
> > > > drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
> > > > drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +-
> > > > drivers/media/test-drivers/vim2m.c | 2 +-
> > > > drivers/media/test-drivers/visl/visl-core.c | 2 +-
> > > > drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +--
> > > > drivers/media/v4l2-core/v4l2-fh.c | 7 ++++---
> > > > drivers/media/v4l2-core/v4l2-subdev.c | 5 ++---
> > > > drivers/staging/media/imx/imx-media-csc-scaler.c | 4 ++--
> > > > drivers/staging/media/meson/vdec/vdec.c | 2 +-
> > > > drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +-
> > > > drivers/staging/most/video/video.c | 4 ++--
> > > > drivers/usb/gadget/function/uvc_v4l2.c | 3 +--
> > > > include/media/v4l2-fh.h | 5 ++++-
> > > > 57 files changed, 89 insertions(+), 90 deletions(-)
> > > >
> > >
> > > <snip>
> > >
> > > > diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
> > > > index b59b1084d8cdf1b62da12879e21dbe56c2109648..df3ba9d4674bd25626cfcddc2d0cb28c233e3cc3 100644
> > > > --- a/drivers/media/v4l2-core/v4l2-fh.c
> > > > +++ b/drivers/media/v4l2-core/v4l2-fh.c
> > > > @@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp)
> > > > }
> > > > EXPORT_SYMBOL_GPL(v4l2_fh_open);
> > > >
> > > > -void v4l2_fh_del(struct v4l2_fh *fh)
> > > > +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
> > >
> > > Instead of adding a second argument, perhaps it is better to
> > > just provide the filp pointer. After all, you can get the v4l2_fh
> > > from filp->private_data.
> > >
> > > It simplifies the code a bit.
> >
> > That's an interesting idea. I'll give it a try.
>
> We end up with code like (e.g. in v4l2_fh_release(), with similar
> constructs in lots of drivers)
>
> if (fh) {
> v4l2_fh_del(filp);
> v4l2_fh_exit(fh);
> kfree(fh);
> }
>
> compared to
>
> if (fh) {
> v4l2_fh_del(fh, filp);
> v4l2_fh_exit(fh);
> kfree(fh);
> }
>
> with the existing patch. I find the fact that v4l2_fh_del() takes a
> different pointer than v4l2_fh_exit() a bit disturbing. If you think
> it's better I'll drop the fh argument in v2.
I gave it a try, and looking at the function prototype, its
documentation, the imbalance with v4l2_fh_add(), and the code in the
callers, I think keeping both arguments would look cleaner. Please tell
me if you feel strongly about this, I can still submit a patch to drop
the argument. It can very easily be scripted with coccinelle and doesn't
conflict with the rest of the series, so it could also be done later.
> > > > {
> > > > unsigned long flags;
> > > >
> > > > @@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh)
> > > > list_del_init(&fh->list);
> > > > spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
> > > > v4l2_prio_close(fh->vdev->prio, fh->prio);
> > > > +
> > > > + filp->private_data = NULL;
> > > > }
> > > > EXPORT_SYMBOL_GPL(v4l2_fh_del);
> > > >
> > > > @@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp)
> > > > struct v4l2_fh *fh = file_to_v4l2_fh(filp);
> > > >
> > > > if (fh) {
> > > > - v4l2_fh_del(fh);
> > > > + v4l2_fh_del(fh, filp);
> > > > v4l2_fh_exit(fh);
> > > > kfree(fh);
> > > > - filp->private_data = NULL;
> > > > }
> > > > return 0;
> > > > }
> > >
> > > <snip>
> > >
> > > > diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
> > > > index d8fcf49f10e09452b73499f4a9bd1285bc2835a5..5e4c761635120608e0b588e0b0daf63e69588d38 100644
> > > > --- a/include/media/v4l2-fh.h
> > > > +++ b/include/media/v4l2-fh.h
> > > > @@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp);
> > > > * v4l2_fh_del - Remove file handle from the list of file handles.
> > > > *
> > > > * @fh: pointer to &struct v4l2_fh
> > > > + * @filp: pointer to &struct file associated with @fh
> > > > + *
> > > > + * The function resets filp->private_data to NULL.
> > > > *
> > > > * .. note::
> > > > * Must be called in v4l2_file_operations->release\(\) handler if the driver
> > > > * uses &struct v4l2_fh.
> > > > */
> > > > -void v4l2_fh_del(struct v4l2_fh *fh);
> > > > +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
> > > >
> > > > /**
> > > > * v4l2_fh_exit - Release resources related to a file handle.
--
Regards,
Laurent Pinchart
|
|
From: Laurent P. <lau...@id...> - 2025-08-07 17:01:56
|
Hi Sakari, On Thu, Aug 07, 2025 at 09:07:13AM +0000, Sakari Ailus wrote: > On Sat, Aug 02, 2025 at 11:23:26AM +0200, Jacopo Mondi wrote: > > From: Laurent Pinchart <lau...@id...> > > > > The V4L2_FL_USES_V4L2_FH flag is set by v4l2_fh_init(). It is not meant > > to be set manually by drivers. Drop it from the ipu7-isys driver. > > > > Signed-off-by: Laurent Pinchart <lau...@id...> > > Signed-off-by: Jacopo Mondi <jac...@id...> > > Thanks, Jacopo! > > Reviewed-by: Sakari Ailus <sak...@li...> Can we get you review on patch 63/65 too (for the IPU6 driver) too ? -- Regards, Laurent Pinchart |
|
From: Laurent P. <lau...@id...> - 2025-08-07 17:00:33
|
On Thu, Aug 07, 2025 at 11:50:07AM +0300, Laurent Pinchart wrote:
> On Wed, Aug 06, 2025 at 02:45:14PM +0200, Hans Verkuil wrote:
> > On 02/08/2025 11:22, Jacopo Mondi wrote:
> > > From: Laurent Pinchart <lau...@id...>
> > >
> > > Multiple drivers that use v4l2_fh and call v4l2_fh_del() manually reset
> > > the file->private_data pointer to NULL in their video device .release()
> > > file operation handler. Move the code to the v4l2_fh_del() function to
> > > avoid direct access to file->private_data in drivers. This requires
> > > adding a file pointer argument to the function.
> > >
> > > Changes to drivers have been generated with the following coccinelle
> > > semantic patch:
> > >
> > > @@
> > > expression fh;
> > > identifier filp;
> > > identifier release;
> > > type ret;
> > > @@
> > > ret release(..., struct file *filp, ...)
> > > {
> > > <...
> > > - filp->private_data = NULL;
> > > ...
> > > - v4l2_fh_del(fh);
> > > + v4l2_fh_del(fh, filp);
> > > ...>
> > > }
> > >
> > > @@
> > > expression fh;
> > > identifier filp;
> > > identifier release;
> > > type ret;
> > > @@
> > > ret release(..., struct file *filp, ...)
> > > {
> > > <...
> > > - v4l2_fh_del(fh);
> > > + v4l2_fh_del(fh, filp);
> > > ...
> > > - filp->private_data = NULL;
> > > ...>
> > > }
> > >
> > > @@
> > > expression fh;
> > > identifier filp;
> > > identifier release;
> > > type ret;
> > > @@
> > > ret release(..., struct file *filp, ...)
> > > {
> > > <...
> > > - v4l2_fh_del(fh);
> > > + v4l2_fh_del(fh, filp);
> > > ...>
> > > }
> > >
> > > Manual changes have been applied to Documentation/ to update the usage
> > > patterns, to drivers/media/v4l2-core/v4l2-fh.c to update the
> > > v4l2_fh_del() prototype and reset file->private_data, and to
> > > include/media/v4l2-fh.h to update the v4l2_fh_del() function prototype
> > > and its documentation.
> > >
> > > Additionally, white space issues have been fixed manually in
> > > drivers/usb/gadget/function/uvc_v4l2.c
> > >
> > > Signed-off-by: Laurent Pinchart <lau...@id...>
> > > Signed-off-by: Jacopo Mondi <jac...@id...>
> > > ---
> > > Documentation/driver-api/media/v4l2-fh.rst | 4 ++--
> > > Documentation/translations/zh_CN/video4linux/v4l2-framework.txt | 4 ++--
> > > drivers/media/pci/cx18/cx18-fileops.c | 4 ++--
> > > drivers/media/pci/ivtv/ivtv-fileops.c | 4 ++--
> > > drivers/media/pci/saa7164/saa7164-encoder.c | 2 +-
> > > drivers/media/pci/saa7164/saa7164-vbi.c | 2 +-
> > > drivers/media/platform/allegro-dvt/allegro-core.c | 2 +-
> > > drivers/media/platform/amlogic/meson-ge2d/ge2d.c | 2 +-
> > > drivers/media/platform/amphion/vpu_v4l2.c | 4 ++--
> > > drivers/media/platform/chips-media/coda/coda-common.c | 4 ++--
> > > drivers/media/platform/chips-media/wave5/wave5-helper.c | 2 +-
> > > drivers/media/platform/imagination/e5010-jpeg-enc.c | 4 ++--
> > > drivers/media/platform/m2m-deinterlace.c | 2 +-
> > > drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++--
> > > drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c | 4 ++--
> > > drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c | 4 ++--
> > > .../media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c | 4 ++--
> > > .../media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c | 4 ++--
> > > drivers/media/platform/nvidia/tegra-vde/v4l2.c | 2 +-
> > > drivers/media/platform/nxp/dw100/dw100.c | 2 +-
> > > drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 4 ++--
> > > drivers/media/platform/nxp/imx-pxp.c | 2 +-
> > > drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c | 2 +-
> > > drivers/media/platform/nxp/mx2_emmaprp.c | 2 +-
> > > drivers/media/platform/qcom/iris/iris_vidc.c | 3 +--
> > > drivers/media/platform/qcom/venus/core.c | 2 +-
> > > drivers/media/platform/renesas/rcar_fdp1.c | 2 +-
> > > drivers/media/platform/renesas/rcar_jpu.c | 4 ++--
> > > drivers/media/platform/renesas/vsp1/vsp1_video.c | 2 +-
> > > drivers/media/platform/rockchip/rga/rga.c | 2 +-
> > > drivers/media/platform/rockchip/rkvdec/rkvdec.c | 2 +-
> > > drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c | 4 ++--
> > > drivers/media/platform/samsung/exynos4-is/fimc-m2m.c | 4 ++--
> > > drivers/media/platform/samsung/s5p-g2d/g2d.c | 2 +-
> > > drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c | 4 ++--
> > > drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c | 4 ++--
> > > drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c | 4 ++--
> > > drivers/media/platform/st/sti/delta/delta-v4l2.c | 4 ++--
> > > drivers/media/platform/st/sti/hva/hva-v4l2.c | 4 ++--
> > > drivers/media/platform/st/stm32/dma2d/dma2d.c | 2 +-
> > > drivers/media/platform/sunxi/sun8i-di/sun8i-di.c | 2 +-
> > > drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c | 2 +-
> > > drivers/media/platform/ti/omap3isp/ispvideo.c | 5 ++---
> > > drivers/media/platform/ti/vpe/vpe.c | 2 +-
> > > drivers/media/platform/verisilicon/hantro_drv.c | 4 ++--
> > > drivers/media/test-drivers/vicodec/vicodec-core.c | 2 +-
> > > drivers/media/test-drivers/vim2m.c | 2 +-
> > > drivers/media/test-drivers/visl/visl-core.c | 2 +-
> > > drivers/media/usb/pvrusb2/pvrusb2-v4l2.c | 3 +--
> > > drivers/media/v4l2-core/v4l2-fh.c | 7 ++++---
> > > drivers/media/v4l2-core/v4l2-subdev.c | 5 ++---
> > > drivers/staging/media/imx/imx-media-csc-scaler.c | 4 ++--
> > > drivers/staging/media/meson/vdec/vdec.c | 2 +-
> > > drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +-
> > > drivers/staging/most/video/video.c | 4 ++--
> > > drivers/usb/gadget/function/uvc_v4l2.c | 3 +--
> > > include/media/v4l2-fh.h | 5 ++++-
> > > 57 files changed, 89 insertions(+), 90 deletions(-)
> > >
> >
> > <snip>
> >
> > > diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c
> > > index b59b1084d8cdf1b62da12879e21dbe56c2109648..df3ba9d4674bd25626cfcddc2d0cb28c233e3cc3 100644
> > > --- a/drivers/media/v4l2-core/v4l2-fh.c
> > > +++ b/drivers/media/v4l2-core/v4l2-fh.c
> > > @@ -67,7 +67,7 @@ int v4l2_fh_open(struct file *filp)
> > > }
> > > EXPORT_SYMBOL_GPL(v4l2_fh_open);
> > >
> > > -void v4l2_fh_del(struct v4l2_fh *fh)
> > > +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp)
> >
> > Instead of adding a second argument, perhaps it is better to
> > just provide the filp pointer. After all, you can get the v4l2_fh
> > from filp->private_data.
> >
> > It simplifies the code a bit.
>
> That's an interesting idea. I'll give it a try.
We end up with code like (e.g. in v4l2_fh_release(), with similar
constructs in lots of drivers)
if (fh) {
v4l2_fh_del(filp);
v4l2_fh_exit(fh);
kfree(fh);
}
compared to
if (fh) {
v4l2_fh_del(fh, filp);
v4l2_fh_exit(fh);
kfree(fh);
}
with the existing patch. I find the fact that v4l2_fh_del() takes a
different pointer than v4l2_fh_exit() a bit disturbing. If you think
it's better I'll drop the fh argument in v2.
> > > {
> > > unsigned long flags;
> > >
> > > @@ -75,6 +75,8 @@ void v4l2_fh_del(struct v4l2_fh *fh)
> > > list_del_init(&fh->list);
> > > spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
> > > v4l2_prio_close(fh->vdev->prio, fh->prio);
> > > +
> > > + filp->private_data = NULL;
> > > }
> > > EXPORT_SYMBOL_GPL(v4l2_fh_del);
> > >
> > > @@ -94,10 +96,9 @@ int v4l2_fh_release(struct file *filp)
> > > struct v4l2_fh *fh = file_to_v4l2_fh(filp);
> > >
> > > if (fh) {
> > > - v4l2_fh_del(fh);
> > > + v4l2_fh_del(fh, filp);
> > > v4l2_fh_exit(fh);
> > > kfree(fh);
> > > - filp->private_data = NULL;
> > > }
> > > return 0;
> > > }
> >
> > <snip>
> >
> > > diff --git a/include/media/v4l2-fh.h b/include/media/v4l2-fh.h
> > > index d8fcf49f10e09452b73499f4a9bd1285bc2835a5..5e4c761635120608e0b588e0b0daf63e69588d38 100644
> > > --- a/include/media/v4l2-fh.h
> > > +++ b/include/media/v4l2-fh.h
> > > @@ -114,12 +114,15 @@ int v4l2_fh_open(struct file *filp);
> > > * v4l2_fh_del - Remove file handle from the list of file handles.
> > > *
> > > * @fh: pointer to &struct v4l2_fh
> > > + * @filp: pointer to &struct file associated with @fh
> > > + *
> > > + * The function resets filp->private_data to NULL.
> > > *
> > > * .. note::
> > > * Must be called in v4l2_file_operations->release\(\) handler if the driver
> > > * uses &struct v4l2_fh.
> > > */
> > > -void v4l2_fh_del(struct v4l2_fh *fh);
> > > +void v4l2_fh_del(struct v4l2_fh *fh, struct file *filp);
> > >
> > > /**
> > > * v4l2_fh_exit - Release resources related to a file handle.
--
Regards,
Laurent Pinchart
|
|
From: Hans V. <hve...@ke...> - 2025-08-07 13:18:53
|
On 8/7/25 14:31, Laurent Pinchart wrote:
> On Thu, Aug 07, 2025 at 08:58:01AM +0200, Hans Verkuil wrote:
>> On 02/08/2025 11:23, Jacopo Mondi wrote:
>>> The __fh parameter is assigned to an unsued variable. Remove it
>>> and remove the unused struct zoran_fh type.
>>>
>>> Signed-off-by: Jacopo Mondi <jac...@id...>
>>> ---
>>> drivers/media/pci/zoran/zoran.h | 6 ------
>>> drivers/media/pci/zoran/zoran_driver.c | 3 +--
>>> 2 files changed, 1 insertion(+), 8 deletions(-)
>>>
>>> diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
>>> index 1cd990468d3de9db8b14b72483972041c57bfee2..d05e222b392156bf1b3b4c83c6591db642c3c377 100644
>>> --- a/drivers/media/pci/zoran/zoran.h
>>> +++ b/drivers/media/pci/zoran/zoran.h
>>> @@ -154,12 +154,6 @@ struct zoran_jpg_settings {
>>>
>>> struct zoran;
>>>
>>> -/* zoran_fh contains per-open() settings */
>>> -struct zoran_fh {
>>> - struct v4l2_fh fh;
>>> - struct zoran *zr;
>>> -};
>>> -
>>> struct card_info {
>>> enum card_type type;
>>> char name[32];
>>> diff --git a/drivers/media/pci/zoran/zoran_driver.c b/drivers/media/pci/zoran/zoran_driver.c
>>> index f42f596d3e6295e31e3b33cd83c5f7243911bd30..ec7fc1da4cc02f5a344cb49bb9a783c41c758195 100644
>>> --- a/drivers/media/pci/zoran/zoran_driver.c
>>> +++ b/drivers/media/pci/zoran/zoran_driver.c
>>> @@ -511,12 +511,11 @@ static int zoran_s_fmt_vid_cap(struct file *file, void *__fh,
>>
>> This driver uses __fh as the name for the second argument of the ioctl
>> callbacks. Can you take this opportunity to rename it to either 'fh' or 'priv'?
>
> It's a bit of yak shaving, but not too difficult so it will be addressed
> in the next version (Jacopo already wrote the patches, thanks).
>
>> Generally it's not a good idea to prefix variables with __ for no good reason.
>>
>> Grepping for __fh also shows two other drivers:
>>
>> drivers/media/platform/chips-media/coda/coda-common.c:#define fh_to_ctx(__fh) container_of(__fh, struct coda_ctx, fh)
>> drivers/media/platform/samsung/s5p-mfc/s5p_mfc_common.h:#define fh_to_ctx(__fh) container_of(__fh, struct s5p_mfc_ctx, fh)
>>
>> I think it is a good idea to rename __fh to fh there as well.
>
> That can't be done, otherwise things like
>
> #define fh_to_ctx(fh) container_of(fh, struct coda_ctx, fh)
>
> static inline struct coda_ctx *file_to_ctx(struct file *filp)
> {
> return fh_to_ctx(file_to_v4l2_fh(filp));
> }
>
> will expand in the file_to_ctx() function to
>
> return container_of(file_to_v4l2_fh(filp), struct coda_ctx, file_to_v4l2_fh(filp))
If the fh_to_ctx #define is changed to a static inline, then there is no problem.
That said, it is overkill.
Regards,
Hans
>
> We could rename the __fh argument to vfh or v4l2fh, but I think __fh is
> equally good there. It's just the macro argument name.
>
>>> struct v4l2_format *fmt)
>>> {
>>> struct zoran *zr = video_drvdata(file);
>>> - struct zoran_fh *fh = __fh;
>>> int i;
>>> int res = 0;
>>>
>>> if (fmt->fmt.pix.pixelformat == V4L2_PIX_FMT_MJPEG)
>>> - return zoran_s_fmt_vid_out(file, fh, fmt);
>>> + return zoran_s_fmt_vid_out(file, __fh, fmt);
>>>
>>> for (i = 0; i < NUM_FORMATS; i++)
>>> if (fmt->fmt.pix.pixelformat == zoran_formats[i].fourcc)
>
|