gpio: pcf857x: Make teardown callback return void
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> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
Родитель
c83227a5d0
Коммит
fae74fb5d5
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
@ -488,7 +486,7 @@ evm_u35_setup(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
static void
|
||||
evm_u35_teardown(struct i2c_client *client, int gpio, unsigned ngpio, void *c)
|
||||
{
|
||||
gpio_free(gpio + 7);
|
||||
|
@ -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 = {
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче