diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-09-04 09:07:22 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-05 12:02:30 -0400 |
commit | 55c381e4896be2611da87088acfad74b361239ab (patch) | |
tree | 1515420c29dbbfd987f0157f16d8bb8cac938c15 /drivers/char/hw_random/omap-rng.c | |
parent | 690b5a13b27ba3bb2c9d61c1f4018c5074b591e6 (diff) |
[ARM] omap: convert OMAP drivers to use ioremap()
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/char/hw_random/omap-rng.c')
-rw-r--r-- | drivers/char/hw_random/omap-rng.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c index 51738bdd834e..d4e7dca06e4f 100644 --- a/drivers/char/hw_random/omap-rng.c +++ b/drivers/char/hw_random/omap-rng.c | |||
@@ -118,18 +118,21 @@ static int __init omap_rng_probe(struct platform_device *pdev) | |||
118 | 118 | ||
119 | mem = request_mem_region(res->start, res->end - res->start + 1, | 119 | mem = request_mem_region(res->start, res->end - res->start + 1, |
120 | pdev->name); | 120 | pdev->name); |
121 | if (mem == NULL) | 121 | if (mem == NULL) { |
122 | return -EBUSY; | 122 | ret = -EBUSY; |
123 | goto err_region; | ||
124 | } | ||
123 | 125 | ||
124 | dev_set_drvdata(&pdev->dev, mem); | 126 | dev_set_drvdata(&pdev->dev, mem); |
125 | rng_base = (u32 __force __iomem *)io_p2v(res->start); | 127 | rng_base = ioremap(res->start, res->end - res->start + 1); |
128 | if (!rng_base) { | ||
129 | ret = -ENOMEM; | ||
130 | goto err_ioremap; | ||
131 | } | ||
126 | 132 | ||
127 | ret = hwrng_register(&omap_rng_ops); | 133 | ret = hwrng_register(&omap_rng_ops); |
128 | if (ret) { | 134 | if (ret) |
129 | release_resource(mem); | 135 | goto err_register; |
130 | rng_base = NULL; | ||
131 | return ret; | ||
132 | } | ||
133 | 136 | ||
134 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", | 137 | dev_info(&pdev->dev, "OMAP Random Number Generator ver. %02x\n", |
135 | omap_rng_read_reg(RNG_REV_REG)); | 138 | omap_rng_read_reg(RNG_REV_REG)); |
@@ -138,6 +141,18 @@ static int __init omap_rng_probe(struct platform_device *pdev) | |||
138 | rng_dev = pdev; | 141 | rng_dev = pdev; |
139 | 142 | ||
140 | return 0; | 143 | return 0; |
144 | |||
145 | err_register: | ||
146 | iounmap(rng_base); | ||
147 | rng_base = NULL; | ||
148 | err_ioremap: | ||
149 | release_resource(mem); | ||
150 | err_region: | ||
151 | if (cpu_is_omap24xx()) { | ||
152 | clk_disable(rng_ick); | ||
153 | clk_put(rng_ick); | ||
154 | } | ||
155 | return ret; | ||
141 | } | 156 | } |
142 | 157 | ||
143 | static int __exit omap_rng_remove(struct platform_device *pdev) | 158 | static int __exit omap_rng_remove(struct platform_device *pdev) |
@@ -148,6 +163,8 @@ static int __exit omap_rng_remove(struct platform_device *pdev) | |||
148 | 163 | ||
149 | omap_rng_write_reg(RNG_MASK_REG, 0x0); | 164 | omap_rng_write_reg(RNG_MASK_REG, 0x0); |
150 | 165 | ||
166 | iounmap(rng_base); | ||
167 | |||
151 | if (cpu_is_omap24xx()) { | 168 | if (cpu_is_omap24xx()) { |
152 | clk_disable(rng_ick); | 169 | clk_disable(rng_ick); |
153 | clk_put(rng_ick); | 170 | clk_put(rng_ick); |