Commit 592569de authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij

gpio: octeon: Convert to use devm_ioremap_resource

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 574b782e
...@@ -83,6 +83,7 @@ static int octeon_gpio_probe(struct platform_device *pdev) ...@@ -83,6 +83,7 @@ static int octeon_gpio_probe(struct platform_device *pdev)
struct octeon_gpio *gpio; struct octeon_gpio *gpio;
struct gpio_chip *chip; struct gpio_chip *chip;
struct resource *res_mem; struct resource *res_mem;
void __iomem *reg_base;
int err = 0; int err = 0;
gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL); gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
...@@ -91,21 +92,11 @@ static int octeon_gpio_probe(struct platform_device *pdev) ...@@ -91,21 +92,11 @@ static int octeon_gpio_probe(struct platform_device *pdev)
chip = &gpio->chip; chip = &gpio->chip;
res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res_mem == NULL) { reg_base = devm_ioremap_resource(&pdev->dev, res_mem);
dev_err(&pdev->dev, "found no memory resource\n"); if (IS_ERR(reg_base))
err = -ENXIO; return PTR_ERR(reg_base);
goto out;
}
if (!devm_request_mem_region(&pdev->dev, res_mem->start,
resource_size(res_mem),
res_mem->name)) {
dev_err(&pdev->dev, "request_mem_region failed\n");
err = -ENXIO;
goto out;
}
gpio->register_base = (u64)devm_ioremap(&pdev->dev, res_mem->start,
resource_size(res_mem));
gpio->register_base = (u64)reg_base;
pdev->dev.platform_data = chip; pdev->dev.platform_data = chip;
chip->label = "octeon-gpio"; chip->label = "octeon-gpio";
chip->parent = &pdev->dev; chip->parent = &pdev->dev;
...@@ -119,11 +110,10 @@ static int octeon_gpio_probe(struct platform_device *pdev) ...@@ -119,11 +110,10 @@ static int octeon_gpio_probe(struct platform_device *pdev)
chip->set = octeon_gpio_set; chip->set = octeon_gpio_set;
err = devm_gpiochip_add_data(&pdev->dev, chip, gpio); err = devm_gpiochip_add_data(&pdev->dev, chip, gpio);
if (err) if (err)
goto out; return err;
dev_info(&pdev->dev, "OCTEON GPIO driver probed.\n"); dev_info(&pdev->dev, "OCTEON GPIO driver probed.\n");
out: return 0;
return err;
} }
static struct of_device_id octeon_gpio_match[] = { static struct of_device_id octeon_gpio_match[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment