[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20260210-v4l2_init_register-v1-3-8fe43f7d349f@nxp.com>
Date: Tue, 10 Feb 2026 16:42:23 -0500
From: Frank Li <Frank.Li@....com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Michael Riesch <michael.riesch@...labora.com>,
Maxime Ripard <mripard@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev, Frank Li <Frank.Li@....com>
Subject: [PATCH 3/3] media: cadence: cdns-csi2rx: Use
v4l2_async_pad_init_and_register_subdev() to simplify code
Use v4l2_async_pad_init_and_register_subdev() to simplify the code.
No functional changes.
Signed-off-by: Frank Li <Frank.Li@....com>
---
build test only
---
drivers/media/platform/cadence/cdns-csi2rx.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index 8c19f125da3e50f55a0ae280b05e7918ce115101..1a18a9d0ea602c91c07a4bf4573ec0346edc7650 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -855,11 +855,6 @@ static int csi2rx_probe(struct platform_device *pdev)
csi2rx->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
csi2rx->subdev.entity.ops = &csi2rx_media_ops;
- ret = media_entity_pads_init(&csi2rx->subdev.entity, CSI2RX_PAD_MAX,
- csi2rx->pads);
- if (ret)
- goto err_cleanup;
-
csi2rx->error_irq = platform_get_irq_byname_optional(pdev, "error_irq");
if (csi2rx->error_irq < 0) {
@@ -875,13 +870,11 @@ static int csi2rx_probe(struct platform_device *pdev)
}
}
- ret = v4l2_subdev_init_finalize(&csi2rx->subdev);
- if (ret)
- goto err_cleanup;
-
- ret = v4l2_async_register_subdev(&csi2rx->subdev);
+ ret = v4l2_async_pad_init_and_register_subdev(&csi2rx->subdev,
+ CSI2RX_PAD_MAX,
+ csi2rx->pads);
if (ret < 0)
- goto err_free_state;
+ goto err_cleanup;
dev_info(&pdev->dev,
"Probed CSI2RX with %u/%u lanes, %u streams, %s D-PHY\n",
@@ -891,12 +884,9 @@ static int csi2rx_probe(struct platform_device *pdev)
return 0;
-err_free_state:
- v4l2_subdev_cleanup(&csi2rx->subdev);
err_cleanup:
v4l2_async_nf_unregister(&csi2rx->notifier);
v4l2_async_nf_cleanup(&csi2rx->notifier);
- media_entity_cleanup(&csi2rx->subdev.entity);
err_free_priv:
kfree(csi2rx);
return ret;
--
2.43.0
Powered by blists - more mailing lists