summaryrefslogtreecommitdiff
path: root/drivers/media/platform/ti/am437x/am437x-vpfe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/ti/am437x/am437x-vpfe.c')
-rw-r--r--drivers/media/platform/ti/am437x/am437x-vpfe.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index ffe1887cc429..63092013d476 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -2144,7 +2144,7 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = {
static int
vpfe_async_bound(struct v4l2_async_notifier *notifier,
struct v4l2_subdev *subdev,
- struct v4l2_async_subdev *asd)
+ struct v4l2_async_connection *asd)
{
struct vpfe_device *vpfe = container_of(notifier->v4l2_dev,
struct vpfe_device, v4l2_dev);
@@ -2300,7 +2300,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
dev_dbg(dev, "vpfe_get_pdata\n");
- v4l2_async_nf_init(&vpfe->notifier);
+ v4l2_async_nf_init(&vpfe->notifier, &vpfe->v4l2_dev);
if (!IS_ENABLED(CONFIG_OF) || !dev->of_node)
return dev->platform_data;
@@ -2370,8 +2370,7 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
pdata->asd[i] = v4l2_async_nf_add_fwnode(&vpfe->notifier,
of_fwnode_handle(rem),
- struct
- v4l2_async_subdev);
+ struct v4l2_async_connection);
of_node_put(rem);
if (IS_ERR(pdata->asd[i]))
goto cleanup;
@@ -2404,10 +2403,17 @@ static int vpfe_probe(struct platform_device *pdev)
vpfe->pdev = &pdev->dev;
+ ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
+ if (ret) {
+ vpfe_err(vpfe, "Unable to register v4l2 device.\n");
+ return ret;
+ }
+
vpfe_cfg = vpfe_get_pdata(vpfe);
if (!vpfe_cfg) {
dev_err(&pdev->dev, "No platform data\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto probe_out_cleanup;
}
vpfe->cfg = vpfe_cfg;
@@ -2420,10 +2426,8 @@ static int vpfe_probe(struct platform_device *pdev)
}
ret = platform_get_irq(pdev, 0);
- if (ret <= 0) {
- ret = -ENODEV;
+ if (ret < 0)
goto probe_out_cleanup;
- }
vpfe->irq = ret;
ret = devm_request_irq(vpfe->pdev, vpfe->irq, vpfe_isr, 0,
@@ -2434,13 +2438,6 @@ static int vpfe_probe(struct platform_device *pdev)
goto probe_out_cleanup;
}
- ret = v4l2_device_register(&pdev->dev, &vpfe->v4l2_dev);
- if (ret) {
- vpfe_err(vpfe,
- "Unable to register v4l2 device.\n");
- goto probe_out_cleanup;
- }
-
/* set the driver data in platform device */
platform_set_drvdata(pdev, vpfe);
/* Enabling module functional clock */
@@ -2450,7 +2447,7 @@ static int vpfe_probe(struct platform_device *pdev)
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0) {
vpfe_err(vpfe, "Unable to resume device.\n");
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
vpfe_ccdc_config_defaults(ccdc);
@@ -2463,23 +2460,22 @@ static int vpfe_probe(struct platform_device *pdev)
GFP_KERNEL);
if (!vpfe->sd) {
ret = -ENOMEM;
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
vpfe->notifier.ops = &vpfe_async_ops;
- ret = v4l2_async_nf_register(&vpfe->v4l2_dev, &vpfe->notifier);
+ ret = v4l2_async_nf_register(&vpfe->notifier);
if (ret) {
vpfe_err(vpfe, "Error registering async notifier\n");
ret = -EINVAL;
- goto probe_out_v4l2_unregister;
+ goto probe_out_cleanup;
}
return 0;
-probe_out_v4l2_unregister:
- v4l2_device_unregister(&vpfe->v4l2_dev);
probe_out_cleanup:
v4l2_async_nf_cleanup(&vpfe->notifier);
+ v4l2_device_unregister(&vpfe->v4l2_dev);
return ret;
}
@@ -2494,8 +2490,8 @@ static void vpfe_remove(struct platform_device *pdev)
v4l2_async_nf_unregister(&vpfe->notifier);
v4l2_async_nf_cleanup(&vpfe->notifier);
- v4l2_device_unregister(&vpfe->v4l2_dev);
video_unregister_device(&vpfe->video_dev);
+ v4l2_device_unregister(&vpfe->v4l2_dev);
}
#ifdef CONFIG_PM_SLEEP
@@ -2630,7 +2626,7 @@ static struct platform_driver vpfe_driver = {
.driver = {
.name = VPFE_MODULE_NAME,
.pm = &vpfe_pm_ops,
- .of_match_table = of_match_ptr(vpfe_of_match),
+ .of_match_table = vpfe_of_match,
},
};