Commit 4af65141 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

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: default avatarSakari 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: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 5073d10c
...@@ -536,6 +536,10 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -536,6 +536,10 @@ static int cafe_pci_probe(struct pci_dev *pdev,
if (ret) if (ret)
goto out_pdown; goto out_pdown;
ret = v4l2_device_register(mcam->dev, &mcam->v4l2_dev);
if (ret)
goto out_smbus_shutdown;
v4l2_async_nf_init(&mcam->notifier); v4l2_async_nf_init(&mcam->notifier);
asd = v4l2_async_nf_add_i2c(&mcam->notifier, asd = v4l2_async_nf_add_i2c(&mcam->notifier,
...@@ -544,12 +548,12 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -544,12 +548,12 @@ static int cafe_pci_probe(struct pci_dev *pdev,
struct v4l2_async_connection); struct v4l2_async_connection);
if (IS_ERR(asd)) { if (IS_ERR(asd)) {
ret = PTR_ERR(asd); ret = PTR_ERR(asd);
goto out_smbus_shutdown; goto out_v4l2_device_unregister;
} }
ret = mccic_register(mcam); ret = mccic_register(mcam);
if (ret) if (ret)
goto out_smbus_shutdown; goto out_v4l2_device_unregister;
clkdev_create(mcam->mclk, "xclk", "%d-%04x", clkdev_create(mcam->mclk, "xclk", "%d-%04x",
i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr); i2c_adapter_id(cam->i2c_adapter), ov7670_info.addr);
...@@ -565,6 +569,8 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -565,6 +569,8 @@ static int cafe_pci_probe(struct pci_dev *pdev,
out_mccic_shutdown: out_mccic_shutdown:
mccic_shutdown(mcam); mccic_shutdown(mcam);
out_v4l2_device_unregister:
v4l2_device_unregister(&mcam->v4l2_dev);
out_smbus_shutdown: out_smbus_shutdown:
cafe_smbus_shutdown(cam); cafe_smbus_shutdown(cam);
out_pdown: out_pdown:
...@@ -587,6 +593,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, ...@@ -587,6 +593,7 @@ static int cafe_pci_probe(struct pci_dev *pdev,
static void cafe_shutdown(struct cafe_camera *cam) static void cafe_shutdown(struct cafe_camera *cam)
{ {
mccic_shutdown(&cam->mcam); mccic_shutdown(&cam->mcam);
v4l2_device_unregister(&cam->mcam.v4l2_dev);
cafe_smbus_shutdown(cam); cafe_smbus_shutdown(cam);
free_irq(cam->pdev->irq, cam); free_irq(cam->pdev->irq, cam);
pci_iounmap(cam->pdev, cam->mcam.regs); pci_iounmap(cam->pdev, cam->mcam.regs);
......
...@@ -1863,13 +1863,6 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1863,13 +1863,6 @@ int mccic_register(struct mcam_camera *cam)
goto out; goto out;
} }
/*
* Register with V4L
*/
ret = v4l2_device_register(cam->dev, &cam->v4l2_dev);
if (ret)
goto out;
mutex_init(&cam->s_mutex); mutex_init(&cam->s_mutex);
cam->state = S_NOTREADY; cam->state = S_NOTREADY;
mcam_set_config_needed(cam, 1); mcam_set_config_needed(cam, 1);
...@@ -1915,7 +1908,6 @@ int mccic_register(struct mcam_camera *cam) ...@@ -1915,7 +1908,6 @@ int mccic_register(struct mcam_camera *cam)
out: out:
v4l2_async_nf_unregister(&cam->notifier); v4l2_async_nf_unregister(&cam->notifier);
v4l2_device_unregister(&cam->v4l2_dev);
v4l2_async_nf_cleanup(&cam->notifier); v4l2_async_nf_cleanup(&cam->notifier);
return ret; return ret;
} }
...@@ -1937,7 +1929,6 @@ void mccic_shutdown(struct mcam_camera *cam) ...@@ -1937,7 +1929,6 @@ void mccic_shutdown(struct mcam_camera *cam)
mcam_free_dma_bufs(cam); mcam_free_dma_bufs(cam);
v4l2_ctrl_handler_free(&cam->ctrl_handler); v4l2_ctrl_handler_free(&cam->ctrl_handler);
v4l2_async_nf_unregister(&cam->notifier); v4l2_async_nf_unregister(&cam->notifier);
v4l2_device_unregister(&cam->v4l2_dev);
v4l2_async_nf_cleanup(&cam->notifier); v4l2_async_nf_cleanup(&cam->notifier);
} }
EXPORT_SYMBOL_GPL(mccic_shutdown); EXPORT_SYMBOL_GPL(mccic_shutdown);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment