All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] gpio: twl4030: Drop platform teardown callback
@ 2022-06-14 15:23 Uwe Kleine-König
  2022-06-14 15:23 ` [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove Uwe Kleine-König
  2022-06-23 21:11 ` [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-14 15:23 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Lee Jones; +Cc: linux-gpio, kernel

There is no machine providing a teardown callback, so drop the unused
code.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpio-twl4030.c | 11 -----------
 include/linux/mfd/twl.h     |  2 --
 2 files changed, 13 deletions(-)

diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index de249726230e..e2cb7cb90c8c 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -593,18 +593,7 @@ static int gpio_twl4030_probe(struct platform_device *pdev)
 /* Cannot use as gpio_twl4030_probe() calls us */
 static int gpio_twl4030_remove(struct platform_device *pdev)
 {
-	struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct gpio_twl4030_priv *priv = platform_get_drvdata(pdev);
-	int status;
-
-	if (pdata && pdata->teardown) {
-		status = pdata->teardown(&pdev->dev, priv->gpio_chip.base,
-					 TWL4030_GPIO_MAX);
-		if (status) {
-			dev_dbg(&pdev->dev, "teardown --> %d\n", status);
-			return status;
-		}
-	}
 
 	gpiochip_remove(&priv->gpio_chip);
 
diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h
index 8871cc5188a0..c8cd31756037 100644
--- a/include/linux/mfd/twl.h
+++ b/include/linux/mfd/twl.h
@@ -594,8 +594,6 @@ struct twl4030_gpio_platform_data {
 
 	int		(*setup)(struct device *dev,
 				unsigned gpio, unsigned ngpio);
-	int		(*teardown)(struct device *dev,
-				unsigned gpio, unsigned ngpio);
 };
 
 struct twl4030_madc_platform_data {

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove
  2022-06-14 15:23 [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Uwe Kleine-König
@ 2022-06-14 15:23 ` Uwe Kleine-König
  2022-06-23 21:11   ` Bartosz Golaszewski
  2022-06-23 21:11 ` [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-14 15:23 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Lee Jones; +Cc: linux-gpio, kernel

Returning a non-zero value in a platform driver's remove callback only
results in an error message ("remove callback returned a non-zero value.
This will be ignored.", see platform_remove()), and then the device is
removed anyhow.

As there was just a WARN_ON triggered, return 0 to drop the follow up
warning. The latter output is hardly relevant after the big WARN splat.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpio-twl4030.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index e2cb7cb90c8c..5046e51af8df 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -597,12 +597,9 @@ static int gpio_twl4030_remove(struct platform_device *pdev)
 
 	gpiochip_remove(&priv->gpio_chip);
 
-	if (is_module())
-		return 0;
-
 	/* REVISIT no support yet for deregistering all the IRQs */
-	WARN_ON(1);
-	return -EIO;
+	WARN_ON(!is_module());
+	return 0;
 }
 
 static const struct of_device_id twl_gpio_match[] = {
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] gpio: twl4030: Drop platform teardown callback
  2022-06-14 15:23 [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Uwe Kleine-König
  2022-06-14 15:23 ` [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove Uwe Kleine-König
@ 2022-06-23 21:11 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2022-06-23 21:11 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Lee Jones, open list:GPIO SUBSYSTEM, Sascha Hauer

On Tue, Jun 14, 2022 at 5:23 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> There is no machine providing a teardown callback, so drop the unused
> code.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove
  2022-06-14 15:23 ` [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove Uwe Kleine-König
@ 2022-06-23 21:11   ` Bartosz Golaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2022-06-23 21:11 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Lee Jones, open list:GPIO SUBSYSTEM, Sascha Hauer

On Tue, Jun 14, 2022 at 5:23 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> Returning a non-zero value in a platform driver's remove callback only
> results in an error message ("remove callback returned a non-zero value.
> This will be ignored.", see platform_remove()), and then the device is
> removed anyhow.
>
> As there was just a WARN_ON triggered, return 0 to drop the follow up
> warning. The latter output is hardly relevant after the big WARN splat.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-23 21:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 15:23 [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Uwe Kleine-König
2022-06-14 15:23 ` [PATCH 2/2] gpio: twl4030: Don't return an error after WARN in .remove Uwe Kleine-König
2022-06-23 21:11   ` Bartosz Golaszewski
2022-06-23 21:11 ` [PATCH 1/2] gpio: twl4030: Drop platform teardown callback Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.