Commit 4c50b0a8 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

media: am437x-vpfe: Register V4L2 device early



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 4af65141
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -2403,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;
@@ -2433,13 +2440,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 */
@@ -2449,7 +2449,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);
@@ -2462,7 +2462,7 @@ 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;
@@ -2470,15 +2470,14 @@ static int vpfe_probe(struct platform_device *pdev)
	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;
}

@@ -2493,8 +2492,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