All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: ucb1400: Remove platform setup and teardown support
@ 2022-06-14 19:48 Uwe Kleine-König
  2022-06-15  5:43   ` Uwe Kleine-König
  2022-06-23 21:14 ` Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-14 19:48 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Lee Jones; +Cc: linux-gpio, Marek Vasut

There is no user of these callbacks. The motivation for this change is
to stop returning an error code from the remove callback.

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-ucb1400.c | 20 --------------------
 drivers/mfd/ucb1400_core.c  |  6 ++----
 include/linux/ucb1400.h     |  2 --
 3 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
index d2a8644864c3..386e69300332 100644
--- a/drivers/gpio/gpio-ucb1400.c
+++ b/drivers/gpio/gpio-ucb1400.c
@@ -64,34 +64,14 @@ static int ucb1400_gpio_probe(struct platform_device *dev)
 	ucb->gc.can_sleep = true;
 
 	err = devm_gpiochip_add_data(&dev->dev, &ucb->gc, ucb);
-	if (err)
-		goto err;
-
-	if (ucb->gpio_setup)
-		err = ucb->gpio_setup(&dev->dev, ucb->gc.ngpio);
 
 err:
 	return err;
 
 }
 
-static int ucb1400_gpio_remove(struct platform_device *dev)
-{
-	int err = 0;
-	struct ucb1400_gpio *ucb = platform_get_drvdata(dev);
-
-	if (ucb && ucb->gpio_teardown) {
-		err = ucb->gpio_teardown(&dev->dev, ucb->gc.ngpio);
-		if (err)
-			return err;
-	}
-
-	return err;
-}
-
 static struct platform_driver ucb1400_gpio_driver = {
 	.probe	= ucb1400_gpio_probe,
-	.remove	= ucb1400_gpio_remove,
 	.driver	= {
 		.name	= "ucb1400_gpio"
 	},
diff --git a/drivers/mfd/ucb1400_core.c b/drivers/mfd/ucb1400_core.c
index 8c3832a58ef6..ac1d18039568 100644
--- a/drivers/mfd/ucb1400_core.c
+++ b/drivers/mfd/ucb1400_core.c
@@ -72,11 +72,9 @@ static int ucb1400_core_probe(struct device *dev)
 
 	/* GPIO */
 	ucb_gpio.ac97 = ac97;
-	if (pdata) {
-		ucb_gpio.gpio_setup = pdata->gpio_setup;
-		ucb_gpio.gpio_teardown = pdata->gpio_teardown;
+	if (pdata)
 		ucb_gpio.gpio_offset = pdata->gpio_offset;
-	}
+
 	ucb->ucb1400_gpio = platform_device_alloc("ucb1400_gpio", -1);
 	if (!ucb->ucb1400_gpio) {
 		err = -ENOMEM;
diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h
index 0968ef458447..22345391350b 100644
--- a/include/linux/ucb1400.h
+++ b/include/linux/ucb1400.h
@@ -84,8 +84,6 @@ struct ucb1400_gpio {
 	struct gpio_chip	gc;
 	struct snd_ac97		*ac97;
 	int			gpio_offset;
-	int			(*gpio_setup)(struct device *dev, int ngpio);
-	int			(*gpio_teardown)(struct device *dev, int ngpio);
 };
 
 struct ucb1400_ts {

base-commit: f2906aa863381afb0015a9eb7fefad885d4e5a56
-- 
2.36.1


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

* Re: [PATCH] gpio: ucb1400: Remove platform setup and teardown support
  2022-06-14 19:48 [PATCH] gpio: ucb1400: Remove platform setup and teardown support Uwe Kleine-König
@ 2022-06-15  5:43   ` Uwe Kleine-König
  2022-06-23 21:14 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-15  5:43 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Lee Jones
  Cc: linux-gpio, Marek Vasut, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, linux-arm-kernel, Arnd Bergmann, Mark Brown,
	Robin Murphy

[-- Attachment #1: Type: text/plain, Size: 1721 bytes --]

Hello,

[Cc += pxa maintainers and a few people I talked to about this driver in
irc yesterday]

On Tue, Jun 14, 2022 at 09:48:02PM +0200, Uwe Kleine-König wrote:
> There is no user of these callbacks. The motivation for this change is
> to stop returning an error code from the remove callback.
> 
> This is a preparation for making platform remove callbacks return void.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

A side note to this driver:

In the probe routine there is a check at the start:

	struct ucb1400_gpio *ucb = dev_get_platdata(&dev->dev);

        if (!(ucb && ucb->gpio_offset)) {
                err = -EINVAL;
                goto err;
        }

So the driver doesn't bind unless there is platdata and it has
gpio_offset != 0. (The decade before last called and wants its fixed
gpio numbers back :-)

platdata is assembled in drivers/mfd/ucb1400_core.c:ucb1400_core_probe()
using:

	struct ucb1400_pdata *pdata = dev_get_platdata(dev);
	...
	if (pdata)
		ucb_gpio.gpio_offset = pdata->gpio_offset;

All machines using this ucb1400 mfd (i.e. arch/arm/mach-pxa/balloon3.c,
arch/arm/mach-pxa/colibri-pxa270.c, arch/arm/mach-pxa/vpac270.c) all
don't set the .gpio_offset member in their ucb1400_pdata.

So the gpio driver is effectively unused and alternatively could just be
removed entirely. Also there seems to be some pending spring cleanup, so
the pxa boards might just be removed soon, which looks like a good
opportunity to drop the driver, too.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] gpio: ucb1400: Remove platform setup and teardown support
@ 2022-06-15  5:43   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-06-15  5:43 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Lee Jones
  Cc: linux-gpio, Marek Vasut, Daniel Mack, Haojian Zhuang,
	Robert Jarzmik, linux-arm-kernel, Arnd Bergmann, Mark Brown,
	Robin Murphy


[-- Attachment #1.1: Type: text/plain, Size: 1721 bytes --]

Hello,

[Cc += pxa maintainers and a few people I talked to about this driver in
irc yesterday]

On Tue, Jun 14, 2022 at 09:48:02PM +0200, Uwe Kleine-König wrote:
> There is no user of these callbacks. The motivation for this change is
> to stop returning an error code from the remove callback.
> 
> This is a preparation for making platform remove callbacks return void.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

A side note to this driver:

In the probe routine there is a check at the start:

	struct ucb1400_gpio *ucb = dev_get_platdata(&dev->dev);

        if (!(ucb && ucb->gpio_offset)) {
                err = -EINVAL;
                goto err;
        }

So the driver doesn't bind unless there is platdata and it has
gpio_offset != 0. (The decade before last called and wants its fixed
gpio numbers back :-)

platdata is assembled in drivers/mfd/ucb1400_core.c:ucb1400_core_probe()
using:

	struct ucb1400_pdata *pdata = dev_get_platdata(dev);
	...
	if (pdata)
		ucb_gpio.gpio_offset = pdata->gpio_offset;

All machines using this ucb1400 mfd (i.e. arch/arm/mach-pxa/balloon3.c,
arch/arm/mach-pxa/colibri-pxa270.c, arch/arm/mach-pxa/vpac270.c) all
don't set the .gpio_offset member in their ucb1400_pdata.

So the gpio driver is effectively unused and alternatively could just be
removed entirely. Also there seems to be some pending spring cleanup, so
the pxa boards might just be removed soon, which looks like a good
opportunity to drop the driver, too.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] gpio: ucb1400: Remove platform setup and teardown support
  2022-06-14 19:48 [PATCH] gpio: ucb1400: Remove platform setup and teardown support Uwe Kleine-König
  2022-06-15  5:43   ` Uwe Kleine-König
@ 2022-06-23 21:14 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2022-06-23 21:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Lee Jones, open list:GPIO SUBSYSTEM, Marek Vasut

On Tue, Jun 14, 2022 at 9:48 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> There is no user of these callbacks. The motivation for this change is
> to stop returning an error code from the remove callback.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Applied this for now until we figure out if we want to remove the
entire driver or not.

Bart

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 19:48 [PATCH] gpio: ucb1400: Remove platform setup and teardown support Uwe Kleine-König
2022-06-15  5:43 ` Uwe Kleine-König
2022-06-15  5:43   ` Uwe Kleine-König
2022-06-23 21:14 ` 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.