aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/hw_random/omap-rng.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index b757fac3cd1f..448ddb59438a 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -113,22 +113,12 @@ static int __devinit omap_rng_probe(struct platform_device *pdev)
113 113
114 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 114 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
115 115
116 if (!res) { 116 rng_base = devm_request_and_ioremap(&pdev->dev, res);
117 ret = -ENOENT;
118 goto err_region;
119 }
120
121 if (!request_mem_region(res->start, resource_size(res), pdev->name)) {
122 ret = -EBUSY;
123 goto err_region;
124 }
125
126 dev_set_drvdata(&pdev->dev, res);
127 rng_base = ioremap(res->start, resource_size(res));
128 if (!rng_base) { 117 if (!rng_base) {
129 ret = -ENOMEM; 118 ret = -ENOMEM;
130 goto err_ioremap; 119 goto err_ioremap;
131 } 120 }
121 dev_set_drvdata(&pdev->dev, res);
132 122
133 ret = hwrng_register(&omap_rng_ops); 123 ret = hwrng_register(&omap_rng_ops);
134 if (ret) 124 if (ret)
@@ -143,11 +133,8 @@ static int __devinit omap_rng_probe(struct platform_device *pdev)
143 return 0; 133 return 0;
144 134
145err_register: 135err_register:
146 iounmap(rng_base);
147 rng_base = NULL; 136 rng_base = NULL;
148err_ioremap: 137err_ioremap:
149 release_mem_region(res->start, resource_size(res));
150err_region:
151 if (cpu_is_omap24xx()) { 138 if (cpu_is_omap24xx()) {
152 clk_disable(rng_ick); 139 clk_disable(rng_ick);
153 clk_put(rng_ick); 140 clk_put(rng_ick);
@@ -157,20 +144,15 @@ err_region:
157 144
158static int __exit omap_rng_remove(struct platform_device *pdev) 145static int __exit omap_rng_remove(struct platform_device *pdev)
159{ 146{
160 struct resource *res = dev_get_drvdata(&pdev->dev);
161
162 hwrng_unregister(&omap_rng_ops); 147 hwrng_unregister(&omap_rng_ops);
163 148
164 omap_rng_write_reg(RNG_MASK_REG, 0x0); 149 omap_rng_write_reg(RNG_MASK_REG, 0x0);
165 150
166 iounmap(rng_base);
167
168 if (cpu_is_omap24xx()) { 151 if (cpu_is_omap24xx()) {
169 clk_disable(rng_ick); 152 clk_disable(rng_ick);
170 clk_put(rng_ick); 153 clk_put(rng_ick);
171 } 154 }
172 155
173 release_mem_region(res->start, resource_size(res));
174 rng_base = NULL; 156 rng_base = NULL;
175 157
176 return 0; 158 return 0;