mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-28 21:45:01 +08:00
fa0b148eb3
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>
64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* I2C IIO driver for Bosch BMA400 triaxial acceleration sensor.
|
|
*
|
|
* Copyright 2019 Dan Robertson <dan@dlrobertson.com>
|
|
*
|
|
* I2C address is either 0x14 or 0x15 depending on SDO
|
|
*/
|
|
#include <linux/i2c.h>
|
|
#include <linux/mod_devicetable.h>
|
|
#include <linux/module.h>
|
|
#include <linux/regmap.h>
|
|
|
|
#include "bma400.h"
|
|
|
|
static int bma400_i2c_probe(struct i2c_client *client,
|
|
const struct i2c_device_id *id)
|
|
{
|
|
struct regmap *regmap;
|
|
|
|
regmap = devm_regmap_init_i2c(client, &bma400_regmap_config);
|
|
if (IS_ERR(regmap)) {
|
|
dev_err(&client->dev, "failed to create regmap\n");
|
|
return PTR_ERR(regmap);
|
|
}
|
|
|
|
return bma400_probe(&client->dev, regmap, id->name);
|
|
}
|
|
|
|
static int bma400_i2c_remove(struct i2c_client *client)
|
|
{
|
|
bma400_remove(&client->dev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct i2c_device_id bma400_i2c_ids[] = {
|
|
{ "bma400", 0 },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, bma400_i2c_ids);
|
|
|
|
static const struct of_device_id bma400_of_i2c_match[] = {
|
|
{ .compatible = "bosch,bma400" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, bma400_of_i2c_match);
|
|
|
|
static struct i2c_driver bma400_i2c_driver = {
|
|
.driver = {
|
|
.name = "bma400",
|
|
.of_match_table = bma400_of_i2c_match,
|
|
},
|
|
.probe = bma400_i2c_probe,
|
|
.remove = bma400_i2c_remove,
|
|
.id_table = bma400_i2c_ids,
|
|
};
|
|
|
|
module_i2c_driver(bma400_i2c_driver);
|
|
|
|
MODULE_AUTHOR("Dan Robertson <dan@dlrobertson.com>");
|
|
MODULE_DESCRIPTION("Bosch BMA400 triaxial acceleration sensor (I2C)");
|
|
MODULE_LICENSE("GPL");
|