pinctrl: cherryview: Convert to use devm_gpiochip_add_data()
This simplifies the error handling and allows us to drop the whole chv_pinctrl_remove() function. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>hifive-unleashed-5.1
parent
47c950d102
commit
d1073418d9
|
@ -1538,7 +1538,7 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
|
||||||
chip->base = -1;
|
chip->base = -1;
|
||||||
chip->irq_need_valid_mask = true;
|
chip->irq_need_valid_mask = true;
|
||||||
|
|
||||||
ret = gpiochip_add_data(chip, pctrl);
|
ret = devm_gpiochip_add_data(pctrl->dev, 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;
|
||||||
|
@ -1550,7 +1550,7 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
|
||||||
range->base, range->npins);
|
range->base, range->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;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset += range->npins;
|
offset += range->npins;
|
||||||
|
@ -1578,17 +1578,12 @@ static int chv_gpio_probe(struct chv_pinctrl *pctrl, int irq)
|
||||||
handle_bad_irq, IRQ_TYPE_NONE);
|
handle_bad_irq, IRQ_TYPE_NONE);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(pctrl->dev, "failed to add IRQ chip\n");
|
dev_err(pctrl->dev, "failed to add IRQ chip\n");
|
||||||
goto fail;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,
|
gpiochip_set_chained_irqchip(chip, &chv_gpio_irqchip, irq,
|
||||||
chv_gpio_irq_handler);
|
chv_gpio_irq_handler);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
|
||||||
gpiochip_remove(chip);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int chv_pinctrl_probe(struct platform_device *pdev)
|
static int chv_pinctrl_probe(struct platform_device *pdev)
|
||||||
|
@ -1656,15 +1651,6 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int chv_pinctrl_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
struct chv_pinctrl *pctrl = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
gpiochip_remove(&pctrl->chip);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int chv_pinctrl_suspend(struct device *dev)
|
static int chv_pinctrl_suspend(struct device *dev)
|
||||||
{
|
{
|
||||||
|
@ -1761,7 +1747,6 @@ MODULE_DEVICE_TABLE(acpi, chv_pinctrl_acpi_match);
|
||||||
|
|
||||||
static struct platform_driver chv_pinctrl_driver = {
|
static struct platform_driver chv_pinctrl_driver = {
|
||||||
.probe = chv_pinctrl_probe,
|
.probe = chv_pinctrl_probe,
|
||||||
.remove = chv_pinctrl_remove,
|
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "cherryview-pinctrl",
|
.name = "cherryview-pinctrl",
|
||||||
.pm = &chv_pinctrl_pm_ops,
|
.pm = &chv_pinctrl_pm_ops,
|
||||||
|
|
Loading…
Reference in New Issue