Commit 486294f1 authored by Irina Tirdea's avatar Irina Tirdea Committed by Jonathan Cameron

iio: accel: bmc150: use common definition for regmap conf

bmc150_i2c_regmap_conf is defined three times (in bmc150-accel-core.c,
bmc150-accel-i2c.c and and bmc150-accel-spi.c), although the
definition is the same.

Use one common definition for bmc150_i2c_regmap_conf in all
included files.
Signed-off-by: default avatarIrina Tirdea <irina.tirdea@intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent fa4c9c93
...@@ -246,11 +246,12 @@ static const struct { ...@@ -246,11 +246,12 @@ static const struct {
{500000, BMC150_ACCEL_SLEEP_500_MS}, {500000, BMC150_ACCEL_SLEEP_500_MS},
{1000000, BMC150_ACCEL_SLEEP_1_SEC} }; {1000000, BMC150_ACCEL_SLEEP_1_SEC} };
static const struct regmap_config bmc150_i2c_regmap_conf = { const struct regmap_config bmc150_regmap_conf = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
.max_register = 0x3f, .max_register = 0x3f,
}; };
EXPORT_SYMBOL_GPL(bmc150_regmap_conf);
static int bmc150_accel_set_mode(struct bmc150_accel_data *data, static int bmc150_accel_set_mode(struct bmc150_accel_data *data,
enum bmc150_power_modes mode, enum bmc150_power_modes mode,
......
...@@ -28,11 +28,6 @@ ...@@ -28,11 +28,6 @@
#include "bmc150-accel.h" #include "bmc150-accel.h"
static const struct regmap_config bmc150_i2c_regmap_conf = {
.reg_bits = 8,
.val_bits = 8,
};
static int bmc150_accel_probe(struct i2c_client *client, static int bmc150_accel_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -43,7 +38,7 @@ static int bmc150_accel_probe(struct i2c_client *client, ...@@ -43,7 +38,7 @@ static int bmc150_accel_probe(struct i2c_client *client,
i2c_check_functionality(client->adapter, i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_READ_I2C_BLOCK); I2C_FUNC_SMBUS_READ_I2C_BLOCK);
regmap = devm_regmap_init_i2c(client, &bmc150_i2c_regmap_conf); regmap = devm_regmap_init_i2c(client, &bmc150_regmap_conf);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
dev_err(&client->dev, "Failed to initialize i2c regmap\n"); dev_err(&client->dev, "Failed to initialize i2c regmap\n");
return PTR_ERR(regmap); return PTR_ERR(regmap);
......
...@@ -25,18 +25,12 @@ ...@@ -25,18 +25,12 @@
#include "bmc150-accel.h" #include "bmc150-accel.h"
static const struct regmap_config bmc150_spi_regmap_conf = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0x3f,
};
static int bmc150_accel_probe(struct spi_device *spi) static int bmc150_accel_probe(struct spi_device *spi)
{ {
struct regmap *regmap; struct regmap *regmap;
const struct spi_device_id *id = spi_get_device_id(spi); const struct spi_device_id *id = spi_get_device_id(spi);
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf); regmap = devm_regmap_init_spi(spi, &bmc150_regmap_conf);
if (IS_ERR(regmap)) { if (IS_ERR(regmap)) {
dev_err(&spi->dev, "Failed to initialize spi regmap\n"); dev_err(&spi->dev, "Failed to initialize spi regmap\n");
return PTR_ERR(regmap); return PTR_ERR(regmap);
......
...@@ -16,5 +16,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq, ...@@ -16,5 +16,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name, bool block_supported); const char *name, bool block_supported);
int bmc150_accel_core_remove(struct device *dev); int bmc150_accel_core_remove(struct device *dev);
extern const struct dev_pm_ops bmc150_accel_pm_ops; extern const struct dev_pm_ops bmc150_accel_pm_ops;
extern const struct regmap_config bmc150_regmap_conf;
#endif /* _BMC150_ACCEL_H_ */ #endif /* _BMC150_ACCEL_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment