syzbot is reporting that imon has three problems which result in
hung tasks due to forever holding device lock [1].
First problem is that when usb_rx_callback_intf0() once got -EPROTO error
after ictx->dev_present_intf0 became true, usb_rx_callback_intf0()
resubmits urb after printk(), and resubmitted urb causes
usb_rx_callback_intf0() to again get -EPROTO error. This results in
printk() flooding (RCU stalls).
Alan Stern commented [2] that
In theory it's okay to resubmit _if_ the driver has a robust
error-recovery scheme (such as giving up after some fixed limit on the
number of errors or after some fixed time has elapsed, perhaps with a
time delay to prevent a flood of errors). Most drivers don't bother to
do this; they simply give up right away. This makes them more
vulnerable to short-term noise interference during USB transfers, but in
reality such interference is quite rare. There's nothing really wrong
with giving up right away.
but imon has a poor error-recovery scheme which just retries forever;
this behavior should be fixed.
Since I'm not sure whether it is safe for imon users to give up upon any
error code, this patch takes care of only union of error codes chosen from
modules in drivers/media/rc/ directory which handle -EPROTO error (i.e.
ir_toy, mceusb and igorplugusb).
Second problem is that when usb_rx_callback_intf0() once got -EPROTO error
before ictx->dev_present_intf0 becomes true, usb_rx_callback_intf0() always
resubmits urb due to commit 8791d63af0cf ("[media] imon: don't wedge
hardware after early callbacks"). Move the ictx->dev_present_intf0 test
introduced by commit 6f6b90c9231a ("[media] imon: don't parse scancodes
until intf configured") to immediately before imon_incoming_packet(), or
the first problem explained above happens without printk() flooding (i.e.
hung task).
Third problem is that when usb_rx_callback_intf0() is not called for some
reason (e.g. flaky hardware; the reproducer for this problem sometimes
prevents usb_rx_callback_intf0() from being called),
wait_for_completion_interruptible() in send_packet() never returns (i.e.
hung task). As a workaround for such situation, change send_packet() to
wait for completion with timeout of 10 seconds.
Ma Ke [Fri, 18 Jul 2025 09:50:54 +0000 (17:50 +0800)]
media: lirc: Fix error handling in lirc_register()
When cdev_device_add() failed, calling put_device() to explicitly
release dev->lirc_dev. Otherwise, it could cause the fault of the
reference count.
Found by code review.
Cc: stable@vger.kernel.org Fixes: a6ddd4fecbb0 ("media: lirc: remove last remnants of lirc kapi") Signed-off-by: Ma Ke <make24@iscas.ac.cn> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Remove the extra leading period and provide more elaborate explanation for
why devm_v4l2_sensor_clk_get() is only allowed to be used on camera sensor
devices.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:39 +0000 (15:34 +0200)]
media: i2c: ov2680: Use the v4l2 helper for obtaining the clock
Use the new v4l2 helper devm_v4l2_sensor_clk_get() that works on both
DT- and ACPI-based platforms to retrieve a reference to the clock
producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:38 +0000 (15:34 +0200)]
media: i2c: vgxy61: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:37 +0000 (15:34 +0200)]
media: i2c: vd56g3: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:36 +0000 (15:34 +0200)]
media: i2c: vd55g1: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:35 +0000 (15:34 +0200)]
media: i2c: s5k6a3: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:34 +0000 (15:34 +0200)]
media: i2c: s5k5baf: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:33 +0000 (15:34 +0200)]
media: i2c: s5c73m3: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:32 +0000 (15:34 +0200)]
media: i2c: ov9650: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:31 +0000 (15:34 +0200)]
media: i2c: ov9640: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:30 +0000 (15:34 +0200)]
media: i2c: ov9282: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:29 +0000 (15:34 +0200)]
media: i2c: ov8865: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:28 +0000 (15:34 +0200)]
media: i2c: ov8858: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:27 +0000 (15:34 +0200)]
media: i2c: ov8856: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:26 +0000 (15:34 +0200)]
media: i2c: ov7740: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:25 +0000 (15:34 +0200)]
media: i2c: ov6650: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:24 +0000 (15:34 +0200)]
media: i2c: ov64a40: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:23 +0000 (15:34 +0200)]
media: i2c: ov5695: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:22 +0000 (15:34 +0200)]
media: i2c: ov5648: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:21 +0000 (15:34 +0200)]
media: i2c: ov5647: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:20 +0000 (15:34 +0200)]
media: i2c: ov5645: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:19 +0000 (15:34 +0200)]
media: i2c: ov5640: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:18 +0000 (15:34 +0200)]
media: i2c: ov2685: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:17 +0000 (15:34 +0200)]
media: i2c: ov2659: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:16 +0000 (15:34 +0200)]
media: i2c: ov02a10: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:15 +0000 (15:34 +0200)]
media: i2c: mt9v111: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:14 +0000 (15:34 +0200)]
media: i2c: mt9v032: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:13 +0000 (15:34 +0200)]
media: i2c: mt9t112: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:12 +0000 (15:34 +0200)]
media: i2c: mt9p031: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:11 +0000 (15:34 +0200)]
media: i2c: mt9m114: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:10 +0000 (15:34 +0200)]
media: i2c: mt9m111: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:09 +0000 (15:34 +0200)]
media: i2c: mt9m001: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:08 +0000 (15:34 +0200)]
media: i2c: imx415: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Reviewed-by: Michael Riesch <michael.riesch@collabora.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:07 +0000 (15:34 +0200)]
media: i2c: imx412: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:06 +0000 (15:34 +0200)]
media: i2c: imx335: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:05 +0000 (15:34 +0200)]
media: i2c: imx334: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:04 +0000 (15:34 +0200)]
media: i2c: imx296: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:03 +0000 (15:34 +0200)]
media: i2c: imx290: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:02 +0000 (15:34 +0200)]
media: i2c: imx283: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:01 +0000 (15:34 +0200)]
media: i2c: imx219: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:34:00 +0000 (15:34 +0200)]
media: i2c: imx214: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:59 +0000 (15:33 +0200)]
media: i2c: hi846: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:58 +0000 (15:33 +0200)]
media: i2c: gc2145: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:57 +0000 (15:33 +0200)]
media: i2c: gc08a3: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:56 +0000 (15:33 +0200)]
media: i2c: gc05a2: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:55 +0000 (15:33 +0200)]
media: i2c: et8ek8: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper
devm_v4l2_sensor_clk_get() that works on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:54 +0000 (15:33 +0200)]
media: i2c: ar0521: Use the v4l2 helper for obtaining the clock
devm_clk_get() fails on ACPI-based platforms, where firmware does not
provide a direct reference to the clock producer.
Replace devm_clk_get() with the new v4l2 helper devm_v4l2_sensor_clk_get()
that works on both DT- and ACPI-based platforms to retrieve a reference to
the clock producer from firmware.
Acked-by: Krzysztof Hałasa <khalasa@piap.pl> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Thu, 26 Jun 2025 13:33:53 +0000 (15:33 +0200)]
Documentation: media: camera-sensor: Mention v4l2_devm_sensor_clk_get() for obtaining the clock
Add the new v4l2 helper devm_v4l2_sensor_clk_get() to Documentation. the
helper works on both DT- and ACPI-based platforms to retrieve a
reference to the clock producer from firmware.
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Co-developed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Mehdi Djait [Mon, 7 Jul 2025 14:32:53 +0000 (16:32 +0200)]
media: v4l2-common: Add a helper for obtaining the clock producer
Introduce a helper for v4l2 sensor drivers on both DT- and ACPI-based
platforms to retrieve a reference to the clock producer from firmware.
This helper behaves the same as devm_clk_get() except where there is
no clock producer like in ACPI-based platforms.
For ACPI-based platforms the function will read the "clock-frequency"
ACPI _DSD property and register a fixed frequency clock with the frequency
indicated in the property.
This function also handles the special ACPI-based system case where:
. The clock-frequency _DSD property is present.
. A reference to the clock producer is present, where the clock is provided
by a camera sensor PMIC driver (e.g. int3472/tps68470.c)
In this case try to set the clock-frequency value to the provided clock.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:58 +0000 (04:30 +0300)]
media: staging: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
The standard practice is to name it 'void *priv' in drivers. Many
drivers still name it 'void *fh', and a few use more exotic names.
Replace those more exotic names with 'void *priv' in all media staging
drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:57 +0000 (04:30 +0300)]
media: v4l2: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
The standard practice is to name it 'void *priv' in drivers. Many
drivers still name it 'void *fh', and a few use more exotic names.
Replace those more exotic names with 'void *priv' in all media drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Acked-by: Jai Luthra <jai.luthra@linux.dev> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:56 +0000 (04:30 +0300)]
media: v4l2-core: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
Rename it from 'void *fh' to 'void *priv' in the V4L2 core, to avoid
misconceptions.
While at it, align function arguments in include/media/v4l2-mem2mem.h.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:55 +0000 (04:30 +0300)]
media: v4l2-pci-skeleton: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
Rename it to 'void *priv', to avoid misconceptions. This is particularly
important in the v4l2-pci-skeleton driver, as it is meant to be a base
for new drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:54 +0000 (04:30 +0300)]
media: uvcvideo: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
Rename it from 'void *fh' to 'void *priv', to avoid misconceptions. This
is particularly important in the uvcvideo driver, as it is widely used
and can be taken as an example for new drivers.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:53 +0000 (04:30 +0300)]
media: test-drivers: Rename second ioctl handlers argument to 'void *priv'
The second argument to the ioctl handlers is not a file handle any more.
Rename it from 'void *fh' to 'void *priv', to avoid misconceptions. This
is particularly important in test drivers as they are meant to be used
as reference implementations.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:52 +0000 (04:30 +0300)]
media: v4l2-ioctl: Push NULL fh argument down to ioctl wrappers
As ioctl handlers do not expect a priv argument anymore, start pushing
the NULL pointer down from __video_do_ioctl() to the ioctl wrappers.
This paves the way to dropping the void *priv argument to ioctl handlers
themselves.
Changes to ioctl wrappers have been generated with the following
coccinelle semantic patch:
Manual changes have been added to handle the calls to
v4l_[gs]_selection(), drop the fh argument in the v4l2_ioctl_info
structure definition and in the DEFINE_V4L_STUB_FUNC() macro, and stop
passing NULL to the wrappers in __video_do_ioctl()
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:51 +0000 (04:30 +0300)]
media: v4l2-ioctl: Stop passing fh pointer to ioctl handlers
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 __video_do_ioctl() function, and rename the 'fh'
argument in the ioctl handler declarations to 'priv' indicate it does
not contain a file handle.
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.
While at it, fix argument alignment in vidioc_try_fmt_vid_out_overlay().
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:44 +0000 (04:30 +0300)]
media: hantro: Access v4l2_fh from file->private_data
To prepare for the introduction of video_device_state as second argument
of the v4l2_ioctl_ops handler, access the v4l2_fh from
file->private_data instead of using void *priv.
The file->private_data is initialized to point to the v4l2_fh
by the usage of v4l2_fh_init() in the v4l2_file_operations.open()
handler.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Paul Kocialkowski <paulk@sys-base.io> Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:39 +0000 (04:30 +0300)]
media: s5p-mfc: Store s5p_mfc_ctx in vb2_queue.drv_priv
The driver stores a pointer to a v4l2_fh in the vb2_queue.drv_priv,
which it then has to cast to a s5p_mfc_ctx pointer in all vb2 queue
operations. Store the pointer to the s5p_mfc_ctx instead to avoid the
cast. While at it, use the vb2_get_drv_priv() helper to access the
field.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Jacopo Mondi [Sun, 10 Aug 2025 01:30:17 +0000 (04:30 +0300)]
media: v4l2-ioctl: Access v4l2_fh from private_data
Now that it is guaranteed that file->private_data is set to point to the
'struct v4l2_fh' initialised by v4l2_fh_add() the v4l2-ioctl layer can
be modified to retrieve the v4l2_fh pointer from the file *.
As the __video_do_ioctl() function, that calls all the handlers modified
by this patch goes as:
static long __video_do_ioctl(struct file *file,
unsigned int cmd, void *arg)
{
void *fh = file->private_data;
...
ret = info->func(ops, file, fh, arg);
}
This patch introduces no functional changes and makes it possible to
remove in future the 'fh' argument to all ioctl handlers.
Jacopo Mondi [Sun, 10 Aug 2025 01:30:15 +0000 (04:30 +0300)]
media: zoran: Remove zoran_fh structure
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 <jacopo.mondi@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:14 +0000 (04:30 +0300)]
media: Drop V4L2_FL_USES_V4L2_FH checks
Now that all drivers use v4l2_fh, we can drop the V4L2_FL_USES_V4L2_FH
checks through the V4L2 core.
To ensure that all new drivers use v4l2_fh, keep setting the
V4L2_FL_USES_V4L2_FH flag in v4l2_fh_init(), and verify it is set after
the .open() file operation returns.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:13 +0000 (04:30 +0300)]
media: v4l2-dev: Make open and release file operations mandatory
All V4L2 drivers implement the open and release file operations. As all
new drivers will need to use v4l2_fh, this situation won't change. Make
those two file operation mandatory at registration time. This allows
simplifying v4l2_open() and v4l2_release().
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Laurent Pinchart [Sun, 10 Aug 2025 01:30:12 +0000 (04:30 +0300)]
media: v4l2-ctrls: Move v4l2_fh retrieval after V4L2_FL_USES_V4L2_FH check
The v4l2_ctrl_log_status() function retrieves the v4l2_fh from the file
with file_to_v4l2_fh() before checking the V4L2_FL_USES_V4L2_FH to see
if the device makes use of v4l2_fh. While this doesn't cause any
practical issue given the current implementation of file_to_v4l2_fh(),
it is cleaner to retrieve the v4l2_fh after checking the flag. This
could prevent future issues if the implementation of file_to_v4l2_fh()
changes.
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>