Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e75241b authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Herbert Xu
Browse files

hwrng: drivers - Use device-managed registration API



Use devm_hwrng_register to simplify the implementation.
Manual unregistration and some remove functions can be
removed now.

Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Acked-by: default avatarŁukasz Stelmach <l.stelmach@samsung.com>
Acked-by: default avatarLudovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent dec0fb39
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ static int atmel_trng_probe(struct platform_device *pdev)
	trng->rng.name = pdev->name;
	trng->rng.read = atmel_trng_read;

	ret = hwrng_register(&trng->rng);
	ret = devm_hwrng_register(&pdev->dev, &trng->rng);
	if (ret)
		goto err_register;

@@ -103,7 +103,6 @@ static int atmel_trng_remove(struct platform_device *pdev)
{
	struct atmel_trng *trng = platform_get_drvdata(pdev);

	hwrng_unregister(&trng->rng);

	atmel_trng_disable(trng);
	clk_disable_unprepare(trng->clk);
+1 −10
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,

	pci_set_drvdata(pdev, rng);

	ret = hwrng_register(&rng->ops);
	ret = devm_hwrng_register(&pdev->dev, &rng->ops);
	if (ret) {
		dev_err(&pdev->dev, "Error registering device as HWRNG.\n");
		return ret;
@@ -76,14 +76,6 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,
	return 0;
}

/* Remove the VF */
static void  cavium_rng_remove_vf(struct pci_dev *pdev)
{
	struct cavium_rng *rng;

	rng = pci_get_drvdata(pdev);
	hwrng_unregister(&rng->ops);
}

static const struct pci_device_id cavium_rng_vf_id_table[] = {
	{ PCI_DEVICE(PCI_VENDOR_ID_CAVIUM, 0xa033), 0, 0, 0},
@@ -95,7 +87,6 @@ static struct pci_driver cavium_rng_vf_driver = {
	.name		= "cavium_rng_vf",
	.id_table	= cavium_rng_vf_id_table,
	.probe		= cavium_rng_probe_vf,
	.remove		= cavium_rng_remove_vf,
};
module_pci_driver(cavium_rng_vf_driver);

+1 −2
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ static int exynos_trng_probe(struct platform_device *pdev)
		goto err_clock;
	}

	ret = hwrng_register(&trng->rng);
	ret = devm_hwrng_register(&pdev->dev, &trng->rng);
	if (ret) {
		dev_err(&pdev->dev, "Could not register hwrng device.\n");
		goto err_register;
@@ -179,7 +179,6 @@ static int exynos_trng_remove(struct platform_device *pdev)
{
	struct exynos_trng_dev *trng =  platform_get_drvdata(pdev);

	hwrng_unregister(&trng->rng);
	clk_disable_unprepare(trng->clk);

	pm_runtime_put_sync(&pdev->dev);
+1 −3
Original line number Diff line number Diff line
@@ -768,7 +768,7 @@ static int n2rng_probe(struct platform_device *op)
	np->hwrng.data_read = n2rng_data_read;
	np->hwrng.priv = (unsigned long) np;

	err = hwrng_register(&np->hwrng);
	err = devm_hwrng_register(&pdev->dev, &np->hwrng);
	if (err)
		goto out_hvapi_unregister;

@@ -793,8 +793,6 @@ static int n2rng_remove(struct platform_device *op)

	cancel_delayed_work_sync(&np->work);

	hwrng_unregister(&np->hwrng);

	sun4v_hvapi_unregister(HV_GRP_RNG);

	return 0;
+1 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ static int nmk_rng_probe(struct amba_device *dev, const struct amba_id *id)
	if (!base)
		goto out_release;
	nmk_rng.priv = (unsigned long)base;
	ret = hwrng_register(&nmk_rng);
	ret = devm_hwrng_register(&dev->dev, &nmk_rng);
	if (ret)
		goto out_release;
	return 0;
@@ -71,7 +71,6 @@ static int nmk_rng_probe(struct amba_device *dev, const struct amba_id *id)

static int nmk_rng_remove(struct amba_device *dev)
{
	hwrng_unregister(&nmk_rng);
	amba_release_regions(dev);
	clk_disable(rng_clk);
	return 0;
Loading