Skip to content

Commit 5073d10

Browse files
Sakari Ailusmchehab
authored andcommitted
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]>
1 parent 6e1e132 commit 5073d10

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

drivers/media/platform/intel/pxa_camera.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2298,6 +2298,10 @@ static int pxa_camera_probe(struct platform_device *pdev)
22982298
pcdev->irq = irq;
22992299
pcdev->base = base;
23002300

2301+
err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
2302+
if (err)
2303+
return err;
2304+
23012305
v4l2_async_nf_init(&pcdev->notifier);
23022306
pcdev->res = res;
23032307
pcdev->pdata = pdev->dev.platform_data;
@@ -2315,10 +2319,10 @@ static int pxa_camera_probe(struct platform_device *pdev)
23152319
} else if (pdev->dev.of_node) {
23162320
err = pxa_camera_pdata_from_dt(&pdev->dev, pcdev);
23172321
} else {
2318-
return -ENODEV;
2322+
err = -ENODEV;
23192323
}
23202324
if (err < 0)
2321-
return err;
2325+
goto exit_v4l2_device_unregister;
23222326

23232327
if (!(pcdev->platform_flags & (PXA_CAMERA_DATAWIDTH_8 |
23242328
PXA_CAMERA_DATAWIDTH_9 | PXA_CAMERA_DATAWIDTH_10))) {
@@ -2384,13 +2388,10 @@ static int pxa_camera_probe(struct platform_device *pdev)
23842388
pxa_camera_activate(pcdev);
23852389

23862390
platform_set_drvdata(pdev, pcdev);
2387-
err = v4l2_device_register(&pdev->dev, &pcdev->v4l2_dev);
2388-
if (err)
2389-
goto exit_deactivate;
23902391

23912392
err = pxa_camera_init_videobuf2(pcdev);
23922393
if (err)
2393-
goto exit_v4l2_device_unregister;
2394+
goto exit_deactivate;
23942395

23952396
/* request irq */
23962397
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)
24032404
pcdev->notifier.ops = &pxa_camera_sensor_ops;
24042405
err = v4l2_async_nf_register(&pcdev->v4l2_dev, &pcdev->notifier);
24052406
if (err)
2406-
goto exit_v4l2_device_unregister;
2407+
goto exit_deactivate;
24072408

24082409
return 0;
2409-
exit_v4l2_device_unregister:
2410-
v4l2_device_unregister(&pcdev->v4l2_dev);
24112410
exit_deactivate:
24122411
pxa_camera_deactivate(pcdev);
24132412
tasklet_kill(&pcdev->task_eof);
@@ -2419,6 +2418,8 @@ static int pxa_camera_probe(struct platform_device *pdev)
24192418
dma_release_channel(pcdev->dma_chans[0]);
24202419
exit_notifier_cleanup:
24212420
v4l2_async_nf_cleanup(&pcdev->notifier);
2421+
exit_v4l2_device_unregister:
2422+
v4l2_device_unregister(&pcdev->v4l2_dev);
24222423
return err;
24232424
}
24242425

0 commit comments

Comments
 (0)