media: omap3isp: Initialise V4L2 async notifier later
authorSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 29 Mar 2023 13:22:16 +0000 (15:22 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 10 Aug 2023 05:58:31 +0000 (07:58 +0200)
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 <sakari.ailus@linux.intel.com>
Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp
Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x
Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/ti/omap3isp/isp.c

index 84ac5b7..f0de621 100644 (file)
@@ -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);