mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 17:54:13 +08:00
pinctrl: at91-pio4: Use devm_pinctrl_register() for pinctrl registration
Use devm_pinctrl_register() for pin control registration and clean error path. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
4d106c2282
commit
5d3fc884b2
@ -1034,18 +1034,19 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
|
|||||||
goto clk_prepare_enable_error;
|
goto clk_prepare_enable_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
atmel_pioctrl->pinctrl_dev = pinctrl_register(&atmel_pinctrl_desc,
|
atmel_pioctrl->pinctrl_dev = devm_pinctrl_register(&pdev->dev,
|
||||||
&pdev->dev,
|
&atmel_pinctrl_desc,
|
||||||
atmel_pioctrl);
|
atmel_pioctrl);
|
||||||
if (!atmel_pioctrl->pinctrl_dev) {
|
if (IS_ERR(atmel_pioctrl->pinctrl_dev)) {
|
||||||
|
ret = PTR_ERR(atmel_pioctrl->pinctrl_dev);
|
||||||
dev_err(dev, "pinctrl registration failed\n");
|
dev_err(dev, "pinctrl registration failed\n");
|
||||||
goto pinctrl_register_error;
|
goto clk_unprep;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl);
|
ret = gpiochip_add_data(atmel_pioctrl->gpio_chip, atmel_pioctrl);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "failed to add gpiochip\n");
|
dev_err(dev, "failed to add gpiochip\n");
|
||||||
goto gpiochip_add_error;
|
goto clk_unprep;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpiochip_add_pin_range(atmel_pioctrl->gpio_chip, dev_name(dev),
|
ret = gpiochip_add_pin_range(atmel_pioctrl->gpio_chip, dev_name(dev),
|
||||||
@ -1059,15 +1060,15 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
clk_prepare_enable_error:
|
|
||||||
irq_domain_remove(atmel_pioctrl->irq_domain);
|
|
||||||
pinctrl_register_error:
|
|
||||||
clk_disable_unprepare(atmel_pioctrl->clk);
|
|
||||||
gpiochip_add_error:
|
|
||||||
pinctrl_unregister(atmel_pioctrl->pinctrl_dev);
|
|
||||||
gpiochip_add_pin_range_error:
|
gpiochip_add_pin_range_error:
|
||||||
gpiochip_remove(atmel_pioctrl->gpio_chip);
|
gpiochip_remove(atmel_pioctrl->gpio_chip);
|
||||||
|
|
||||||
|
clk_unprep:
|
||||||
|
clk_disable_unprepare(atmel_pioctrl->clk);
|
||||||
|
|
||||||
|
clk_prepare_enable_error:
|
||||||
|
irq_domain_remove(atmel_pioctrl->irq_domain);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1077,7 +1078,6 @@ int atmel_pinctrl_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
irq_domain_remove(atmel_pioctrl->irq_domain);
|
irq_domain_remove(atmel_pioctrl->irq_domain);
|
||||||
clk_disable_unprepare(atmel_pioctrl->clk);
|
clk_disable_unprepare(atmel_pioctrl->clk);
|
||||||
pinctrl_unregister(atmel_pioctrl->pinctrl_dev);
|
|
||||||
gpiochip_remove(atmel_pioctrl->gpio_chip);
|
gpiochip_remove(atmel_pioctrl->gpio_chip);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user