gpio: ts5500: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and clean the error path. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
This commit is contained in:
parent
33ba54ee47
commit
973eff01c5
1 changed files with 3 additions and 6 deletions
|
@ -409,7 +409,7 @@ static int ts5500_dio_probe(struct platform_device *pdev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = gpiochip_add_data(&priv->gpio_chip, priv);
|
ret = devm_gpiochip_add_data(dev, &priv->gpio_chip, priv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "failed to register the gpio chip\n");
|
dev_err(dev, "failed to register the gpio chip\n");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -418,13 +418,10 @@ static int ts5500_dio_probe(struct platform_device *pdev)
|
||||||
ret = ts5500_enable_irq(priv);
|
ret = ts5500_enable_irq(priv);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(dev, "invalid interrupt %d\n", priv->hwirq);
|
dev_err(dev, "invalid interrupt %d\n", priv->hwirq);
|
||||||
goto cleanup;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
cleanup:
|
|
||||||
gpiochip_remove(&priv->gpio_chip);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ts5500_dio_remove(struct platform_device *pdev)
|
static int ts5500_dio_remove(struct platform_device *pdev)
|
||||||
|
@ -432,7 +429,7 @@ static int ts5500_dio_remove(struct platform_device *pdev)
|
||||||
struct ts5500_priv *priv = platform_get_drvdata(pdev);
|
struct ts5500_priv *priv = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
ts5500_disable_irq(priv);
|
ts5500_disable_irq(priv);
|
||||||
gpiochip_remove(&priv->gpio_chip);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue