diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-28 20:47:29 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-06-05 04:43:06 -0400 |
commit | 1f539bcb13120213f266d5506fe7339bc78bd953 (patch) | |
tree | dc231643085cd8cb224b68ae0b0f568ba98af5df /drivers/char/hw_random | |
parent | a3485e685faa37ba92462bec2f18b98c3c825c76 (diff) |
hwrng: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char/hw_random')
-rw-r--r-- | drivers/char/hw_random/n2-drv.c | 6 | ||||
-rw-r--r-- | drivers/char/hw_random/octeon-rng.c | 4 | ||||
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 6 |
3 files changed, 7 insertions, 9 deletions
diff --git a/drivers/char/hw_random/n2-drv.c b/drivers/char/hw_random/n2-drv.c index 20b962e1d832..f9beed54d0c8 100644 --- a/drivers/char/hw_random/n2-drv.c +++ b/drivers/char/hw_random/n2-drv.c | |||
@@ -700,7 +700,7 @@ static int n2rng_probe(struct platform_device *op) | |||
700 | if (err) | 700 | if (err) |
701 | goto out_free_units; | 701 | goto out_free_units; |
702 | 702 | ||
703 | dev_set_drvdata(&op->dev, np); | 703 | platform_set_drvdata(op, np); |
704 | 704 | ||
705 | schedule_delayed_work(&np->work, 0); | 705 | schedule_delayed_work(&np->work, 0); |
706 | 706 | ||
@@ -721,7 +721,7 @@ out: | |||
721 | 721 | ||
722 | static int n2rng_remove(struct platform_device *op) | 722 | static int n2rng_remove(struct platform_device *op) |
723 | { | 723 | { |
724 | struct n2rng *np = dev_get_drvdata(&op->dev); | 724 | struct n2rng *np = platform_get_drvdata(op); |
725 | 725 | ||
726 | np->flags |= N2RNG_FLAG_SHUTDOWN; | 726 | np->flags |= N2RNG_FLAG_SHUTDOWN; |
727 | 727 | ||
@@ -736,8 +736,6 @@ static int n2rng_remove(struct platform_device *op) | |||
736 | 736 | ||
737 | kfree(np); | 737 | kfree(np); |
738 | 738 | ||
739 | dev_set_drvdata(&op->dev, NULL); | ||
740 | |||
741 | return 0; | 739 | return 0; |
742 | } | 740 | } |
743 | 741 | ||
diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c index 1eada566ca70..f2885dbe1849 100644 --- a/drivers/char/hw_random/octeon-rng.c +++ b/drivers/char/hw_random/octeon-rng.c | |||
@@ -96,7 +96,7 @@ static int octeon_rng_probe(struct platform_device *pdev) | |||
96 | 96 | ||
97 | rng->ops = ops; | 97 | rng->ops = ops; |
98 | 98 | ||
99 | dev_set_drvdata(&pdev->dev, &rng->ops); | 99 | platform_set_drvdata(pdev, &rng->ops); |
100 | ret = hwrng_register(&rng->ops); | 100 | ret = hwrng_register(&rng->ops); |
101 | if (ret) | 101 | if (ret) |
102 | return -ENOENT; | 102 | return -ENOENT; |
@@ -108,7 +108,7 @@ static int octeon_rng_probe(struct platform_device *pdev) | |||
108 | 108 | ||
109 | static int __exit octeon_rng_remove(struct platform_device *pdev) | 109 | static int __exit octeon_rng_remove(struct platform_device *pdev) |
110 | { | 110 | { |
111 | struct hwrng *rng = dev_get_drvdata(&pdev->dev); | 111 | struct hwrng *rng = platform_get_drvdata(pdev); |
112 | 112 | ||
113 | hwrng_unregister(rng); | 113 | hwrng_unregister(rng); |
114 | 114 | ||
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 749dc16ca2cc..e5deb99feb28 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -116,7 +116,7 @@ static int omap_rng_probe(struct platform_device *pdev) | |||
116 | }; | 116 | }; |
117 | 117 | ||
118 | omap_rng_ops.priv = (unsigned long)priv; | 118 | omap_rng_ops.priv = (unsigned long)priv; |
119 | dev_set_drvdata(&pdev->dev, priv); | 119 | platform_set_drvdata(pdev, priv); |
120 | 120 | ||
121 | priv->mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 121 | priv->mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
122 | if (!priv->mem_res) { | 122 | if (!priv->mem_res) { |
@@ -129,7 +129,7 @@ static int omap_rng_probe(struct platform_device *pdev) | |||
129 | ret = PTR_ERR(priv->base); | 129 | ret = PTR_ERR(priv->base); |
130 | goto err_ioremap; | 130 | goto err_ioremap; |
131 | } | 131 | } |
132 | dev_set_drvdata(&pdev->dev, priv); | 132 | platform_set_drvdata(pdev, priv); |
133 | 133 | ||
134 | pm_runtime_enable(&pdev->dev); | 134 | pm_runtime_enable(&pdev->dev); |
135 | pm_runtime_get_sync(&pdev->dev); | 135 | pm_runtime_get_sync(&pdev->dev); |
@@ -156,7 +156,7 @@ err_ioremap: | |||
156 | 156 | ||
157 | static int __exit omap_rng_remove(struct platform_device *pdev) | 157 | static int __exit omap_rng_remove(struct platform_device *pdev) |
158 | { | 158 | { |
159 | struct omap_rng_private_data *priv = dev_get_drvdata(&pdev->dev); | 159 | struct omap_rng_private_data *priv = platform_get_drvdata(pdev); |
160 | 160 | ||
161 | hwrng_unregister(&omap_rng_ops); | 161 | hwrng_unregister(&omap_rng_ops); |
162 | 162 | ||