Skip to content

Commit 4af6514

Browse files
Sakari Ailusmchehab
authored andcommitted
media: marvell: cafe: Register V4L2 device earlier
Register V4L2 device before the async 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 5073d10 commit 4af6514

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

drivers/media/platform/marvell/cafe-driver.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,10 @@ static int cafe_pci_probe(struct pci_dev *pdev,
536536
if (ret)
537537
goto out_pdown;
538538

539+
ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev);
540+
if (ret)
541+
goto out_smbus_shutdown;
542+
539543
v4l2_async_nf_init(&mcam->notifier);
540544

541545
asd = v4l2_async_nf_add_i2c(&mcam->notifier,
@@ -544,12 +548,12 @@ static int cafe_pci_probe(struct pci_dev *pdev,
544548
struct v4l2_async_connection);
545549
if (IS_ERR(asd)) {
546550
ret = PTR_ERR(asd);
547-
goto out_smbus_shutdown;
551+
goto out_v4l2_device_unregister;
548552
}
549553

550554
ret = mccic_register(mcam);
551555
if (ret)
552-
goto out_smbus_shutdown;
556+
goto out_v4l2_device_unregister;
553557

554558
clkdev_create(mcam->mclk, "xclk", "%d-%04x",
555559
i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr);
@@ -565,6 +569,8 @@ static int cafe_pci_probe(struct pci_dev *pdev,
565569

566570
out_mccic_shutdown:
567571
mccic_shutdown(mcam);
572+
out_v4l2_device_unregister:
573+
v4l2_device_unregister(&mcam->v4l2_dev);
568574
out_smbus_shutdown:
569575
cafe_smbus_shutdown(cam);
570576
out_pdown:
@@ -587,6 +593,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
587593
static void cafe_shutdown(struct cafe_camera *cam)
588594
{
589595
mccic_shutdown(&cam->mcam);
596+
v4l2_device_unregister(&cam->mcam.v4l2_dev);
590597
cafe_smbus_shutdown(cam);
591598
free_irq(cam->pdev->irq, cam);
592599
pci_iounmap(cam->pdev, cam->mcam.regs);

drivers/media/platform/marvell/mcam-core.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1863,13 +1863,6 @@ int mccic_register(struct mcam_camera *cam)
18631863
goto out;
18641864
}
18651865

1866-
/*
1867-
* Register with V4L
1868-
*/
1869-
ret = v4l2_device_register(cam->dev, &cam->v4l2_dev);
1870-
if (ret)
1871-
goto out;
1872-
18731866
mutex_init(&cam->s_mutex);
18741867
cam->state = S_NOTREADY;
18751868
mcam_set_config_needed(cam, 1);
@@ -1915,7 +1908,6 @@ int mccic_register(struct mcam_camera *cam)
19151908

19161909
out:
19171910
v4l2_async_nf_unregister(&cam->notifier);
1918-
v4l2_device_unregister(&cam->v4l2_dev);
19191911
v4l2_async_nf_cleanup(&cam->notifier);
19201912
return ret;
19211913
}
@@ -1937,7 +1929,6 @@ void mccic_shutdown(struct mcam_camera *cam)
19371929
mcam_free_dma_bufs(cam);
19381930
v4l2_ctrl_handler_free(&cam->ctrl_handler);
19391931
v4l2_async_nf_unregister(&cam->notifier);
1940-
v4l2_device_unregister(&cam->v4l2_dev);
19411932
v4l2_async_nf_cleanup(&cam->notifier);
19421933
}
19431934
EXPORT_SYMBOL_GPL(mccic_shutdown);

0 commit comments

Comments
 (0)