diff mbox series

[5/5] gpio: siox: Use devm_ managed gpiochip

Message ID 20190626084407.27976-5-linus.walleij@linaro.org
State New
Headers show
Series [1/5] gpio: siox: Do not call gpiochip_remove() on errorpath | expand

Commit Message

Linus Walleij June 26, 2019, 8:44 a.m. UTC
By using devm_gpiochip_add_data() we can get rid of the
remove() callback. As this driver doesn't use the
gpiochip data pointer we simply pass in NULL.

Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

---
 drivers/gpio/gpio-siox.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

-- 
2.20.1

Comments

Uwe Kleine-König June 26, 2019, 9:14 a.m. UTC | #1
Hello,

On Wed, Jun 26, 2019 at 10:44:07AM +0200, Linus Walleij wrote:
> By using devm_gpiochip_add_data() we can get rid of the

> remove() callback. As this driver doesn't use the

> gpiochip data pointer we simply pass in NULL.

> 

> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>


Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>


Thanks,
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-siox.c b/drivers/gpio/gpio-siox.c
index f85f1fab781f..5e3861c1ad99 100644
--- a/drivers/gpio/gpio-siox.c
+++ b/drivers/gpio/gpio-siox.c
@@ -246,7 +246,7 @@  static int gpio_siox_probe(struct siox_device *sdevice)
 	girq->default_type = IRQ_TYPE_NONE;
 	girq->handler = handle_level_irq;
 
-	ret = gpiochip_add(&ddata->gchip);
+	ret = devm_gpiochip_add_data(dev, &ddata->gchip, NULL);
 	if (ret) {
 		dev_err(dev, "Failed to register gpio chip (%d)\n", ret);
 		return ret;
@@ -255,17 +255,8 @@  static int gpio_siox_probe(struct siox_device *sdevice)
 	return 0;
 }
 
-static int gpio_siox_remove(struct siox_device *sdevice)
-{
-	struct gpio_siox_ddata *ddata = dev_get_drvdata(&sdevice->dev);
-
-	gpiochip_remove(&ddata->gchip);
-	return 0;
-}
-
 static struct siox_driver gpio_siox_driver = {
 	.probe = gpio_siox_probe,
-	.remove = gpio_siox_remove,
 	.set_data = gpio_siox_set_data,
 	.get_data = gpio_siox_get_data,
 	.driver = {