diff options
author | Jingoo Han <jg1.han@samsung.com> | 2014-02-11 21:51:38 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2014-02-24 08:44:43 -0500 |
commit | 717f70e39a98867751f6a3eb94cc281f3da32685 (patch) | |
tree | 557125cfe41724773950341d32b5e182b0b8f6ff /drivers/gpio/gpio-omap.c | |
parent | 09bafc30b6fea0b374ac4ff0b8e923c07f5cda78 (diff) |
gpio: omap: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-omap.c')
-rw-r--r-- | drivers/gpio/gpio-omap.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 424319061e09..19b886c21b1d 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -1214,24 +1214,10 @@ static int omap_gpio_probe(struct platform_device *pdev) | |||
1214 | 1214 | ||
1215 | /* Static mapping, never released */ | 1215 | /* Static mapping, never released */ |
1216 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1216 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1217 | if (unlikely(!res)) { | 1217 | bank->base = devm_ioremap_resource(dev, res); |
1218 | dev_err(dev, "Invalid mem resource\n"); | 1218 | if (IS_ERR(bank->base)) { |
1219 | irq_domain_remove(bank->domain); | ||
1220 | return -ENODEV; | ||
1221 | } | ||
1222 | |||
1223 | if (!devm_request_mem_region(dev, res->start, resource_size(res), | ||
1224 | pdev->name)) { | ||
1225 | dev_err(dev, "Region already claimed\n"); | ||
1226 | irq_domain_remove(bank->domain); | 1219 | irq_domain_remove(bank->domain); |
1227 | return -EBUSY; | 1220 | return PTR_ERR(bank->base); |
1228 | } | ||
1229 | |||
1230 | bank->base = devm_ioremap(dev, res->start, resource_size(res)); | ||
1231 | if (!bank->base) { | ||
1232 | dev_err(dev, "Could not ioremap\n"); | ||
1233 | irq_domain_remove(bank->domain); | ||
1234 | return -ENOMEM; | ||
1235 | } | 1221 | } |
1236 | 1222 | ||
1237 | platform_set_drvdata(pdev, bank); | 1223 | platform_set_drvdata(pdev, bank); |