Commit f25c3aa9 authored by Mika Westerberg's avatar Mika Westerberg Committed by Linus Walleij

pinctrl: intel: Convert to use devm_gpiochip_add_data()

This simplifies error handling and allows us to drop intel_pinctrl_remove()
completely.
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 003910eb
...@@ -1058,7 +1058,6 @@ static const struct dev_pm_ops bxt_pinctrl_pm_ops = { ...@@ -1058,7 +1058,6 @@ static const struct dev_pm_ops bxt_pinctrl_pm_ops = {
static struct platform_driver bxt_pinctrl_driver = { static struct platform_driver bxt_pinctrl_driver = {
.probe = bxt_pinctrl_probe, .probe = bxt_pinctrl_probe,
.remove = intel_pinctrl_remove,
.driver = { .driver = {
.name = "broxton-pinctrl", .name = "broxton-pinctrl",
.acpi_match_table = bxt_pinctrl_acpi_match, .acpi_match_table = bxt_pinctrl_acpi_match,
......
...@@ -884,7 +884,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) ...@@ -884,7 +884,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
pctrl->chip.base = -1; pctrl->chip.base = -1;
pctrl->irq = irq; pctrl->irq = irq;
ret = gpiochip_add_data(&pctrl->chip, pctrl); ret = devm_gpiochip_add_data(pctrl->dev, &pctrl->chip, pctrl);
if (ret) { if (ret) {
dev_err(pctrl->dev, "failed to register gpiochip\n"); dev_err(pctrl->dev, "failed to register gpiochip\n");
return ret; return ret;
...@@ -894,7 +894,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) ...@@ -894,7 +894,7 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
0, 0, pctrl->soc->npins); 0, 0, pctrl->soc->npins);
if (ret) { if (ret) {
dev_err(pctrl->dev, "failed to add GPIO pin range\n"); dev_err(pctrl->dev, "failed to add GPIO pin range\n");
goto fail; return ret;
} }
/* /*
...@@ -907,24 +907,19 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq) ...@@ -907,24 +907,19 @@ static int intel_gpio_probe(struct intel_pinctrl *pctrl, int irq)
dev_name(pctrl->dev), pctrl); dev_name(pctrl->dev), pctrl);
if (ret) { if (ret) {
dev_err(pctrl->dev, "failed to request interrupt\n"); dev_err(pctrl->dev, "failed to request interrupt\n");
goto fail; return ret;
} }
ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0, ret = gpiochip_irqchip_add(&pctrl->chip, &intel_gpio_irqchip, 0,
handle_bad_irq, IRQ_TYPE_NONE); handle_bad_irq, IRQ_TYPE_NONE);
if (ret) { if (ret) {
dev_err(pctrl->dev, "failed to add irqchip\n"); dev_err(pctrl->dev, "failed to add irqchip\n");
goto fail; return ret;
} }
gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq, gpiochip_set_chained_irqchip(&pctrl->chip, &intel_gpio_irqchip, irq,
NULL); NULL);
return 0; return 0;
fail:
gpiochip_remove(&pctrl->chip);
return ret;
} }
static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl) static int intel_pinctrl_pm_init(struct intel_pinctrl *pctrl)
...@@ -1046,16 +1041,6 @@ int intel_pinctrl_probe(struct platform_device *pdev, ...@@ -1046,16 +1041,6 @@ int intel_pinctrl_probe(struct platform_device *pdev,
} }
EXPORT_SYMBOL_GPL(intel_pinctrl_probe); EXPORT_SYMBOL_GPL(intel_pinctrl_probe);
int intel_pinctrl_remove(struct platform_device *pdev)
{
struct intel_pinctrl *pctrl = platform_get_drvdata(pdev);
gpiochip_remove(&pctrl->chip);
return 0;
}
EXPORT_SYMBOL_GPL(intel_pinctrl_remove);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned pin) static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned pin)
{ {
......
...@@ -121,8 +121,6 @@ struct intel_pinctrl_soc_data { ...@@ -121,8 +121,6 @@ struct intel_pinctrl_soc_data {
int intel_pinctrl_probe(struct platform_device *pdev, int intel_pinctrl_probe(struct platform_device *pdev,
const struct intel_pinctrl_soc_data *soc_data); const struct intel_pinctrl_soc_data *soc_data);
int intel_pinctrl_remove(struct platform_device *pdev);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
int intel_pinctrl_suspend(struct device *dev); int intel_pinctrl_suspend(struct device *dev);
int intel_pinctrl_resume(struct device *dev); int intel_pinctrl_resume(struct device *dev);
......
...@@ -574,7 +574,6 @@ static const struct dev_pm_ops spt_pinctrl_pm_ops = { ...@@ -574,7 +574,6 @@ static const struct dev_pm_ops spt_pinctrl_pm_ops = {
static struct platform_driver spt_pinctrl_driver = { static struct platform_driver spt_pinctrl_driver = {
.probe = spt_pinctrl_probe, .probe = spt_pinctrl_probe,
.remove = intel_pinctrl_remove,
.driver = { .driver = {
.name = "sunrisepoint-pinctrl", .name = "sunrisepoint-pinctrl",
.acpi_match_table = spt_pinctrl_acpi_match, .acpi_match_table = spt_pinctrl_acpi_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