diff mbox series

gpio: pca953x: Make platform teardown callback return void

Message ID 20220502170555.51183-1-u.kleine-koenig@pengutronix.de
State Accepted
Commit 6a8f359c3132e4f51bdb263ad74ec632c65e55fd
Headers show
Series gpio: pca953x: Make platform teardown callback return void | expand

Commit Message

Uwe Kleine-König May 2, 2022, 5:05 p.m. UTC
All platforms that provide a teardown callback return 0. New users are
supposed to not make use of platform support, so there is no
functionality lost.

This patch is a preparation for making i2c remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 arch/arm/mach-davinci/board-da850-evm.c | 12 ++++--------
 drivers/gpio/gpio-pca953x.c             | 11 +++--------
 include/linux/platform_data/pca953x.h   |  2 +-
 3 files changed, 8 insertions(+), 17 deletions(-)


base-commit: 3123109284176b1532874591f7c81f3837bbdc17

Comments

Bartosz Golaszewski May 5, 2022, 12:44 p.m. UTC | #1
On Mon, May 2, 2022 at 7:06 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> All platforms that provide a teardown callback return 0. New users are
> supposed to not make use of platform support, so there is no
> functionality lost.
>
> This patch is a preparation for making i2c remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Looks good to me.

Sekhar: please leave your Ack if you're fine with me taking this
through the GPIO tree.

Bart
Uwe Kleine-König May 27, 2022, 7:11 a.m. UTC | #2
Hello,

On Thu, May 05, 2022 at 02:44:40PM +0200, Bartosz Golaszewski wrote:
> On Mon, May 2, 2022 at 7:06 PM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > All platforms that provide a teardown callback return 0. New users are
> > supposed to not make use of platform support, so there is no
> > functionality lost.
> >
> > This patch is a preparation for making i2c remove callbacks return void.
> >
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> 
> Looks good to me.
> 
> Sekhar: please leave your Ack if you're fine with me taking this
> through the GPIO tree.

Sekhar: Did this patch fell through the cracks? Would be great to get
this in during the next merge window (i.e. depending on Linus Torvald's
counting abilities maybe the one for 5.20)

Best regards
Uwe
Uwe Kleine-König June 7, 2022, 6:42 a.m. UTC | #3
Hello,

On Fri, May 27, 2022 at 09:11:36AM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> On Thu, May 05, 2022 at 02:44:40PM +0200, Bartosz Golaszewski wrote:
> > On Mon, May 2, 2022 at 7:06 PM Uwe Kleine-König
> > <u.kleine-koenig@pengutronix.de> wrote:
> > >
> > > All platforms that provide a teardown callback return 0. New users are
> > > supposed to not make use of platform support, so there is no
> > > functionality lost.
> > >
> > > This patch is a preparation for making i2c remove callbacks return void.
> > >
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > ---
> > 
> > Looks good to me.
> > 
> > Sekhar: please leave your Ack if you're fine with me taking this
> > through the GPIO tree.
> 
> Sekhar: Did this patch fell through the cracks? Would be great to get
> this in during the next merge window (i.e. depending on Linus Torvald's
> counting abilities maybe the one for 5.20)

I want to use the release of 5.19-rc1 as an opportunity to ping this
patch. I intend to change the i2c remove callback to return void (i.e.

diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index fbda5ada2afc..066b541a0d5d 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -273,7 +273,7 @@ struct i2c_driver {
 
 	/* Standard driver model interfaces */
 	int (*probe)(struct i2c_client *client, const struct i2c_device_id *id);
-	int (*remove)(struct i2c_client *client);
+	void (*remove)(struct i2c_client *client);
 
 	/* New driver model interface to aid the seamless removal of the
 	 * current probe()'s, more commonly unused than used second parameter.

) directly after the next merge window.

So I ask you to either take this patch before (my preferred option), or
accept that I send it as part of a bigger series that eventually
contains the above hunk and will probably be merged via the i2c tree.

Best regards
Uwe
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 428012687a80..e86622416d0e 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -519,8 +519,8 @@  static int da850_evm_ui_expander_setup(struct i2c_client *client, unsigned gpio,
 	return ret;
 }
 
-static int da850_evm_ui_expander_teardown(struct i2c_client *client,
-					unsigned gpio, unsigned ngpio, void *c)
+static void da850_evm_ui_expander_teardown(struct i2c_client *client,
+					   unsigned gpio, unsigned ngpio, void *c)
 {
 	platform_device_unregister(&da850_evm_ui_keys_device);
 
@@ -532,8 +532,6 @@  static int da850_evm_ui_expander_teardown(struct i2c_client *client,
 	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_C);
 	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_B);
 	gpio_free(gpio + DA850_EVM_UI_EXP_SEL_A);
-
-	return 0;
 }
 
 /* assign the baseboard expander's GPIOs after the UI board's */
@@ -700,13 +698,11 @@  static int da850_evm_bb_expander_setup(struct i2c_client *client,
 	return ret;
 }
 
-static int da850_evm_bb_expander_teardown(struct i2c_client *client,
-					unsigned gpio, unsigned ngpio, void *c)
+static void da850_evm_bb_expander_teardown(struct i2c_client *client,
+					   unsigned gpio, unsigned ngpio, void *c)
 {
 	platform_device_unregister(&da850_evm_bb_leds_device);
 	platform_device_unregister(&da850_evm_bb_keys_device);
-
-	return 0;
 }
 
 static struct pca953x_platform_data da850_evm_ui_expander_info = {
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d2fe76f3f34f..f985a1d67762 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -1087,20 +1087,15 @@  static int pca953x_remove(struct i2c_client *client)
 {
 	struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct pca953x_chip *chip = i2c_get_clientdata(client);
-	int ret;
 
 	if (pdata && pdata->teardown) {
-		ret = pdata->teardown(client, chip->gpio_chip.base,
-				      chip->gpio_chip.ngpio, pdata->context);
-		if (ret < 0)
-			dev_err(&client->dev, "teardown failed, %d\n", ret);
-	} else {
-		ret = 0;
+		pdata->teardown(client, chip->gpio_chip.base,
+				chip->gpio_chip.ngpio, pdata->context);
 	}
 
 	regulator_disable(chip->regulator);
 
-	return ret;
+	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h
index 4eb53e023997..96c1a14ab365 100644
--- a/include/linux/platform_data/pca953x.h
+++ b/include/linux/platform_data/pca953x.h
@@ -22,7 +22,7 @@  struct pca953x_platform_data {
 	int		(*setup)(struct i2c_client *client,
 				unsigned gpio, unsigned ngpio,
 				void *context);
-	int		(*teardown)(struct i2c_client *client,
+	void		(*teardown)(struct i2c_client *client,
 				unsigned gpio, unsigned ngpio,
 				void *context);
 	const char	*const *names;