Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: accel: bma400: Make bma400_remove() return void

When an i2c or spi driver's remove function returns a non-zero error
code nothing happens apart from emitting a generic error message. Make
this error message more device specific and return zero instead in the
remove callbacks. As the return value of bma400_remove() is unused then,
change the function to not yield a return value.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Link: https://lore.kernel.org/r/20211013203223.2694577-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Uwe Kleine-König and committed by
Jonathan Cameron
fa0b148e 885b9790

+11 -6
+1 -1
drivers/iio/accel/bma400.h
··· 94 94 95 95 int bma400_probe(struct device *dev, struct regmap *regmap, const char *name); 96 96 97 - int bma400_remove(struct device *dev); 97 + void bma400_remove(struct device *dev); 98 98 99 99 #endif
+4 -3
drivers/iio/accel/bma400_core.c
··· 828 828 } 829 829 EXPORT_SYMBOL(bma400_probe); 830 830 831 - int bma400_remove(struct device *dev) 831 + void bma400_remove(struct device *dev) 832 832 { 833 833 struct iio_dev *indio_dev = dev_get_drvdata(dev); 834 834 struct bma400_data *data = iio_priv(indio_dev); ··· 838 838 ret = bma400_set_power_mode(data, POWER_MODE_SLEEP); 839 839 mutex_unlock(&data->mutex); 840 840 841 + if (ret) 842 + dev_warn(dev, "Failed to put device into sleep mode (%pe)\n", ERR_PTR(ret)); 843 + 841 844 regulator_bulk_disable(ARRAY_SIZE(data->regulators), 842 845 data->regulators); 843 846 844 847 iio_device_unregister(indio_dev); 845 - 846 - return ret; 847 848 } 848 849 EXPORT_SYMBOL(bma400_remove); 849 850
+3 -1
drivers/iio/accel/bma400_i2c.c
··· 29 29 30 30 static int bma400_i2c_remove(struct i2c_client *client) 31 31 { 32 - return bma400_remove(&client->dev); 32 + bma400_remove(&client->dev); 33 + 34 + return 0; 33 35 } 34 36 35 37 static const struct i2c_device_id bma400_i2c_ids[] = {
+3 -1
drivers/iio/accel/bma400_spi.c
··· 89 89 90 90 static int bma400_spi_remove(struct spi_device *spi) 91 91 { 92 - return bma400_remove(&spi->dev); 92 + bma400_remove(&spi->dev); 93 + 94 + return 0; 93 95 } 94 96 95 97 static const struct spi_device_id bma400_spi_ids[] = {