diff mbox series

gpio: pcf857x: Make teardown callback return void

Message ID 20220401170549.340923-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series gpio: pcf857x: Make teardown callback return void | expand

Commit Message

Uwe Kleine-König April 1, 2022, 5:05 p.m. UTC
All teardown functions return 0. Also there is little sense in returning
a negative error code from an i2c remove function as this only results in
emitting an error message but the device is removed nevertheless.

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-da830-evm.c  |  3 +--
 arch/arm/mach-davinci/board-dm644x-evm.c |  7 ++-----
 arch/arm/mach-davinci/board-dm646x-evm.c |  4 +---
 drivers/gpio/gpio-pcf857x.c              | 14 +++-----------
 include/linux/platform_data/pcf857x.h    |  2 +-
 5 files changed, 8 insertions(+), 22 deletions(-)


base-commit: e8b767f5e04097aaedcd6e06e2270f9fe5282696

Comments

kernel test robot April 3, 2022, 2:06 p.m. UTC | #1
Hi "Uwe,

I love your patch! Yet something to improve:

[auto build test ERROR on e8b767f5e04097aaedcd6e06e2270f9fe5282696]

url:    https://github.com/intel-lab-lkp/linux/commits/Uwe-Kleine-K-nig/gpio-pcf857x-Make-teardown-callback-return-void/20220402-010754
base:   e8b767f5e04097aaedcd6e06e2270f9fe5282696
config: arm-davinci_all_defconfig (https://download.01.org/0day-ci/archive/20220403/202204032242.oF5ZiIfP-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://github.com/intel-lab-lkp/linux/commit/a3a8679599814e10a75617073b06db14ef794a54
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Uwe-Kleine-K-nig/gpio-pcf857x-Make-teardown-callback-return-void/20220402-010754
        git checkout a3a8679599814e10a75617073b06db14ef794a54
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> arch/arm/mach-davinci/board-dm644x-evm.c:499:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
   }
   ^
>> arch/arm/mach-davinci/board-dm644x-evm.c:504:14: error: incompatible function pointer types initializing 'void (*)(struct i2c_client *, int, unsigned int, void *)' with an expression of type 'int (struct i2c_client *, int, unsigned int, void *)' [-Werror,-Wincompatible-function-pointer-types]
           .teardown       = evm_u35_teardown,
                             ^~~~~~~~~~~~~~~~
   2 errors generated.


vim +499 arch/arm/mach-davinci/board-dm644x-evm.c

7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  488  
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  489  static int
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  490  evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  491  {
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  492  	gpio_free(gpio + 7);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  493  	gpio_free(gpio + 6);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  494  	gpio_free(gpio + 5);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  495  	gpio_free(gpio + 3);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  496  	gpio_free(gpio + 2);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  497  	gpio_free(gpio + 1);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  498  	gpio_free(gpio + 0);
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07 @499  }
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  500  
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  501  static struct pcf857x_platform_data pcf_data_u35 = {
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  502  	.gpio_base	= PCF_Uxx_BASE(2),
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  503  	.setup		= evm_u35_setup,
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07 @504  	.teardown	= evm_u35_teardown,
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  505  };
7bff3c4ce44ea48 arch/arm/mach-davinci/board-evm.c David Brownell 2008-09-07  506
diff mbox series

Patch

diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c
index 823c9cc98f18..52a452eff01c 100644
--- a/arch/arm/mach-davinci/board-da830-evm.c
+++ b/arch/arm/mach-davinci/board-da830-evm.c
@@ -473,11 +473,10 @@  static int __init da830_evm_ui_expander_setup(struct i2c_client *client,
 	return 0;
 }
 
-static int da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
+static void da830_evm_ui_expander_teardown(struct i2c_client *client, int gpio,
 		unsigned ngpio, void *context)
 {
 	gpio_free(gpio + 6);
-	return 0;
 }
 
 static struct pcf857x_platform_data __initdata da830_evm_ui_expander_info = {
diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c
index cce3a621eb20..c58bb3afda46 100644
--- a/arch/arm/mach-davinci/board-dm644x-evm.c
+++ b/arch/arm/mach-davinci/board-dm644x-evm.c
@@ -366,14 +366,13 @@  evm_led_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 	return status;
 }
 
-static int
+static void
 evm_led_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 {
 	if (evm_led_dev) {
 		platform_device_unregister(evm_led_dev);
 		evm_led_dev = NULL;
 	}
-	return 0;
 }
 
 static struct pcf857x_platform_data pcf_data_u2 = {
@@ -428,7 +427,7 @@  evm_u18_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 	return 0;
 }
 
-static int
+static void
 evm_u18_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 {
 	gpio_free(gpio + 1);
@@ -439,7 +438,6 @@  evm_u18_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 		device_remove_file(&client->dev, &dev_attr_user_sw);
 		gpio_free(sw_gpio);
 	}
-	return 0;
 }
 
 static struct pcf857x_platform_data pcf_data_u18 = {
@@ -498,7 +496,6 @@  evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
 	gpio_free(gpio + 2);
 	gpio_free(gpio + 1);
 	gpio_free(gpio + 0);
-	return 0;
 }
 
 static struct pcf857x_platform_data pcf_data_u35 = {
diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c
index ee91d81ebbfd..625d2d626147 100644
--- a/arch/arm/mach-davinci/board-dm646x-evm.c
+++ b/arch/arm/mach-davinci/board-dm646x-evm.c
@@ -315,15 +315,13 @@  static int evm_pcf_setup(struct i2c_client *client, int gpio,
 	return evm_led_setup(client, gpio+4, 4, c);
 }
 
-static int evm_pcf_teardown(struct i2c_client *client, int gpio,
+static void evm_pcf_teardown(struct i2c_client *client, int gpio,
 			unsigned int ngpio, void *c)
 {
 	BUG_ON(ngpio < 8);
 
 	evm_sw_teardown(client, gpio, 4, c);
 	evm_led_teardown(client, gpio+4, 4, c);
-
-	return 0;
 }
 
 static struct pcf857x_platform_data pcf_data = {
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c
index b7568ee33696..e3a53dd5df1e 100644
--- a/drivers/gpio/gpio-pcf857x.c
+++ b/drivers/gpio/gpio-pcf857x.c
@@ -396,20 +396,12 @@  static int pcf857x_remove(struct i2c_client *client)
 {
 	struct pcf857x_platform_data	*pdata = dev_get_platdata(&client->dev);
 	struct pcf857x			*gpio = i2c_get_clientdata(client);
-	int				status = 0;
 
-	if (pdata && pdata->teardown) {
-		status = pdata->teardown(client,
-				gpio->chip.base, gpio->chip.ngpio,
+	if (pdata && pdata->teardown)
+		pdata->teardown(client, gpio->chip.base, gpio->chip.ngpio,
 				pdata->context);
-		if (status < 0) {
-			dev_err(&client->dev, "%s --> %d\n",
-					"teardown", status);
-			return status;
-		}
-	}
 
-	return status;
+	return 0;
 }
 
 static void pcf857x_shutdown(struct i2c_client *client)
diff --git a/include/linux/platform_data/pcf857x.h b/include/linux/platform_data/pcf857x.h
index 11d4ed78c7f4..01d0a3ea3aef 100644
--- a/include/linux/platform_data/pcf857x.h
+++ b/include/linux/platform_data/pcf857x.h
@@ -36,7 +36,7 @@  struct pcf857x_platform_data {
 	int		(*setup)(struct i2c_client *client,
 					int gpio, unsigned ngpio,
 					void *context);
-	int		(*teardown)(struct i2c_client *client,
+	void		(*teardown)(struct i2c_client *client,
 					int gpio, unsigned ngpio,
 					void *context);
 	void		*context;