mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-12 16:58:53 +00:00
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>
This commit is contained in:
parent
09bafc30b6
commit
717f70e39a
@ -1214,24 +1214,10 @@ static int omap_gpio_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* Static mapping, never released */
|
/* Static mapping, never released */
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (unlikely(!res)) {
|
bank->base = devm_ioremap_resource(dev, res);
|
||||||
dev_err(dev, "Invalid mem resource\n");
|
if (IS_ERR(bank->base)) {
|
||||||
irq_domain_remove(bank->domain);
|
irq_domain_remove(bank->domain);
|
||||||
return -ENODEV;
|
return PTR_ERR(bank->base);
|
||||||
}
|
|
||||||
|
|
||||||
if (!devm_request_mem_region(dev, res->start, resource_size(res),
|
|
||||||
pdev->name)) {
|
|
||||||
dev_err(dev, "Region already claimed\n");
|
|
||||||
irq_domain_remove(bank->domain);
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
bank->base = devm_ioremap(dev, res->start, resource_size(res));
|
|
||||||
if (!bank->base) {
|
|
||||||
dev_err(dev, "Could not ioremap\n");
|
|
||||||
irq_domain_remove(bank->domain);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, bank);
|
platform_set_drvdata(pdev, bank);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user