Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: Frank Li <Frank.Li@nxp.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Michael Riesch <michael.riesch@collabora.com>,
	 Maxime Ripard <mripard@kernel.org>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 imx@lists.linux.dev, Frank Li <Frank.Li@nxp.com>
Subject: [PATCH 3/3] media: cadence: cdns-csi2rx: Use v4l2_async_pad_init_and_register_subdev() to simplify code
Date: Tue, 10 Feb 2026 16:42:23 -0500	[thread overview]
Message-ID: <20260210-v4l2_init_register-v1-3-8fe43f7d349f@nxp.com> (raw)
In-Reply-To: <20260210-v4l2_init_register-v1-0-8fe43f7d349f@nxp.com>

Use v4l2_async_pad_init_and_register_subdev() to simplify the code.

No functional changes.

Signed-off-by: Frank Li <Frank.Li@nxp.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


  parent reply	other threads:[~2026-02-10 21:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10 21:42 [PATCH 0/3] media: v4l: async: add helper API v4l2_async_pad_init_and_register_subdev() Frank Li
2026-02-10 21:42 ` [PATCH 1/3] " Frank Li
2026-02-10 21:42 ` [PATCH 2/3] media: synopsys: Use v4l2_async_pad_init_and_register_subdev() to simplify code Frank Li
2026-02-10 21:42 ` Frank Li [this message]
2026-02-20  9:01 ` [PATCH 0/3] media: v4l: async: add helper API v4l2_async_pad_init_and_register_subdev() Michael Riesch
2026-02-20 15:46   ` Frank Li
2026-02-23  8:34     ` Michael Riesch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260210-v4l2_init_register-v1-3-8fe43f7d349f@nxp.com \
    --to=frank.li@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=michael.riesch@collabora.com \
    --cc=mripard@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox