diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-19 13:19:08 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-04-26 21:28:29 -0400 |
commit | 945478a7276407b1d435be39cde6bdaff72a7afa (patch) | |
tree | 6c9e83c8affcd649ec6d75bc06d31b9f79c2ca24 /drivers/char | |
parent | bdd3f7fa77257a818746caf9fbe0ea0e7bb7dde4 (diff) |
hwrng: omap - use devm_request_and_ioremap
Using devm_request_and_ioremap is more concise.
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 22 |
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 | ||
145 | err_register: | 135 | err_register: |
146 | iounmap(rng_base); | ||
147 | rng_base = NULL; | 136 | rng_base = NULL; |
148 | err_ioremap: | 137 | err_ioremap: |
149 | release_mem_region(res->start, resource_size(res)); | ||
150 | err_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 | ||
158 | static int __exit omap_rng_remove(struct platform_device *pdev) | 145 | static 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; |