]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: nxp: imx8-isi: better handle the m2m usage_count
authorLaurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Wed, 23 Oct 2024 08:56:43 +0000 (11:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:11:16 +0000 (11:11 +0100)
commitfb50ee19aa69f3dc332928ca1d408a9a25762d8a
treef5c1452b730f2d7e2e6c816328833f73617da846
parentb93864e0865f235a791e69dc9ef4f896e559ef77
media: nxp: imx8-isi: better handle the m2m usage_count

commit 910efa649076be9c2e1326059830327cf4228cf6 upstream.

Currently, if streamon/streamoff calls are imbalanced we can either end up
with a negative ISI m2m usage_count (if streamoff() is called more times
than streamon()) in which case we'll not be able to restart the ISI pipe
next time, or the usage_count never gets to 0 and the pipe is never
switched off.

To avoid that, add a 'streaming' flag to mxc_isi_m2m_ctx_queue_data and use it
in the streamon/streamoff to avoid incrementing/decrementing the usage_count
uselessly, if called multiple times from the same context.

Fixes: cf21f328fcafac ("media: nxp: Add i.MX8 ISI driver")
Cc: stable@vger.kernel.org
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://lore.kernel.org/r/20241023085643.978729-1-laurentiu.palcu@oss.nxp.com
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c