diff options
author | Sakari Ailus <[email protected]> | 2023-03-29 14:54:05 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <[email protected]> | 2023-08-10 07:58:31 +0200 |
commit | 5073d10cbabae8117b4e176244d5e30881bb75ff (patch) | |
tree | f96e2d0b0f9a893774bb2d1c85d8466ba6f135f0 | |
parent | 6e1e132e0038a2a4bce11ff1ad0db3b4564042c9 (diff) |
media: pxa_camera: Register V4L2 device early
Register V4L2 device before initialising 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 <[email protected]>
Tested-by: Philipp Zabel <[email protected]> # imx6qp
Tested-by: Niklas Söderlund <[email protected]> # rcar + adv746x
Tested-by: Aishwarya Kothari <[email protected]> # Apalis i.MX6Q with TC358743
Tested-by: Lad Prabhakar <[email protected]> # Renesas RZ/G2L SMARC
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
-rw-r--r-- | drivers/media/platform/intel/pxa_camera.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/platform/intel/pxa_camera.c b/drivers/media/platform/intel/pxa_camera.c index 2453bf58f92d..6112d31c2228 100644 --- a/drivers/media/platform/intel/pxa_camera.c +++ b/drivers/media/platform/intel/pxa_camera.c @@ -2298,6 +2298,10 @@ static int pxa_camera_probe(struct platform_device *pdev) pcdev->irq = irq; pcdev->base = base; + err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); + if (err) + return err; + v4l2_async_nf_init(&pcdev->notifier); pcdev->res = res; pcdev->pdata = pdev->dev.platform_data; @@ -2315,10 +2319,10 @@ static int pxa_camera_probe(struct platform_device *pdev) } else if (pdev->dev.of_node) { err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev); } else { - return -ENODEV; + err = -ENODEV; } if (err < 0) - return err; + goto exit_v4l2_device_unregister; if (!(pcdev->platform_flags & (PXA_CAMERA_DATAWIDTH_8 | PXA_CAMERA_DATAWIDTH_9 | PXA_CAMERA_DATAWIDTH_10))) { @@ -2384,13 +2388,10 @@ static int pxa_camera_probe(struct platform_device *pdev) pxa_camera_activate(pcdev); platform_set_drvdata(pdev, pcdev); - err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev); - if (err) - goto exit_deactivate; err = pxa_camera_init_videobuf2(pcdev); if (err) - goto exit_v4l2_device_unregister; + goto exit_deactivate; /* request irq */ err = devm_request_irq(&pdev->dev, pcdev->irq, pxa_camera_irq, 0, @@ -2403,11 +2404,9 @@ static int pxa_camera_probe(struct platform_device *pdev) pcdev->notifier.ops = &pxa_camera_sensor_ops; err = v4l2_async_nf_register(&pcdev->v4l2_dev, &pcdev->notifier); if (err) - goto exit_v4l2_device_unregister; + goto exit_deactivate; return 0; -exit_v4l2_device_unregister: - v4l2_device_unregister(&pcdev->v4l2_dev); exit_deactivate: pxa_camera_deactivate(pcdev); tasklet_kill(&pcdev->task_eof); @@ -2419,6 +2418,8 @@ exit_free_dma_y: dma_release_channel(pcdev->dma_chans[0]); exit_notifier_cleanup: v4l2_async_nf_cleanup(&pcdev->notifier); +exit_v4l2_device_unregister: + v4l2_device_unregister(&pcdev->v4l2_dev); return err; } |