From f6336d89062d0c802366705eedc87cbd8270af61 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Wed, 29 Mar 2023 15:22:16 +0200 Subject: [PATCH] media: omap3isp: Initialise V4L2 async notifier later MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Initialise V4L2 async notifier and parse DT for async sub-devices later, just before registering the notifier. This way the device can be made available to the V4L2 async framework from the notifier init time onwards. A subsequent patch will add struct v4l2_device as an argument to v4l2_async_nf_init(). Signed-off-by: Sakari Ailus Tested-by: Philipp Zabel # imx6qp Tested-by: Niklas Söderlund # rcar + adv746x Tested-by: Aishwarya Kothari # Apalis i.MX6Q with TC358743 Tested-by: Lad Prabhakar # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/ti/omap3isp/isp.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c index 84ac5b74f5cf..f0de621f7f8b 100644 --- a/drivers/media/platform/ti/omap3isp/isp.c +++ b/drivers/media/platform/ti/omap3isp/isp.c @@ -2002,6 +2002,7 @@ static void isp_remove(struct platform_device *pdev) struct isp_device *isp = platform_get_drvdata(pdev); v4l2_async_nf_unregister(&isp->notifier); + v4l2_async_nf_cleanup(&isp->notifier); isp_unregister_entities(isp); isp_cleanup_modules(isp); isp_xclk_cleanup(isp); @@ -2011,7 +2012,6 @@ static void isp_remove(struct platform_device *pdev) __omap3isp_put(isp, false); media_entity_enum_cleanup(&isp->crashed); - v4l2_async_nf_cleanup(&isp->notifier); kfree(isp); } @@ -2288,13 +2288,8 @@ static int isp_probe(struct platform_device *pdev) mutex_init(&isp->isp_mutex); spin_lock_init(&isp->stat_lock); - v4l2_async_nf_init(&isp->notifier); isp->dev = &pdev->dev; - ret = isp_parse_of_endpoints(isp); - if (ret < 0) - goto error; - isp->ref_count = 0; ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32)); @@ -2425,6 +2420,12 @@ static int isp_probe(struct platform_device *pdev) isp->notifier.ops = &isp_subdev_notifier_ops; + v4l2_async_nf_init(&isp->notifier); + + ret = isp_parse_of_endpoints(isp); + if (ret < 0) + goto error_register_entities; + ret = v4l2_async_nf_register(&isp->v4l2_dev, &isp->notifier); if (ret) goto error_register_entities; @@ -2435,6 +2436,7 @@ static int isp_probe(struct platform_device *pdev) return 0; error_register_entities: + v4l2_async_nf_cleanup(&isp->notifier); isp_unregister_entities(isp); error_modules: isp_cleanup_modules(isp); @@ -2444,7 +2446,6 @@ error_isp: isp_xclk_cleanup(isp); __omap3isp_put(isp, false); error: - v4l2_async_nf_cleanup(&isp->notifier); mutex_destroy(&isp->isp_mutex); error_release_isp: kfree(isp); -- 2.20.1