2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00

gpio: max730x: Make __max730x_remove() return void

An spi or i2c remove callback is only called for devices that probed
successfully. In this case this implies that __max730x_probe() set a
non-NULL driver data. So the check ts == NULL is never true. With this
check dropped, __max730x_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

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:
Uwe Kleine-König 2021-10-12 17:39:27 +02:00 committed by Bartosz Golaszewski
parent aa4858eb82
commit 06de2cd788
4 changed files with 8 additions and 8 deletions

View File

@ -50,7 +50,9 @@ static int max7300_probe(struct i2c_client *client,
static int max7300_remove(struct i2c_client *client)
{
return __max730x_remove(&client->dev);
__max730x_remove(&client->dev);
return 0;
}
static const struct i2c_device_id max7300_id[] = {

View File

@ -66,7 +66,9 @@ static int max7301_probe(struct spi_device *spi)
static int max7301_remove(struct spi_device *spi)
{
return __max730x_remove(&spi->dev);
__max730x_remove(&spi->dev);
return 0;
}
static const struct spi_device_id max7301_id[] = {

View File

@ -220,18 +220,14 @@ exit_destroy:
}
EXPORT_SYMBOL_GPL(__max730x_probe);
int __max730x_remove(struct device *dev)
void __max730x_remove(struct device *dev)
{
struct max7301 *ts = dev_get_drvdata(dev);
if (ts == NULL)
return -ENODEV;
/* Power down the chip and disable IRQ output */
ts->write(dev, 0x04, 0x00);
gpiochip_remove(&ts->chip);
mutex_destroy(&ts->lock);
return 0;
}
EXPORT_SYMBOL_GPL(__max730x_remove);

View File

@ -31,6 +31,6 @@ struct max7301_platform_data {
u32 input_pullup_active;
};
extern int __max730x_remove(struct device *dev);
extern void __max730x_remove(struct device *dev);
extern int __max730x_probe(struct max7301 *ts);
#endif