Commit e9e9d397 authored by Axel Lin's avatar Axel Lin Committed by Lee Jones

mfd: da9052: Avoid setting read_flag_mask for da9052-i2c driver

Current code init regmap with &da9052_regmap_config for both da9052-spi and
da9052-i2c drivers. da9052-spi sets the read_flag_mask.
The same setting may be applied for da9052-i2c if da9052-spi driver is loaded
first because they actually use the same regmap_config setting.
Fix this issue by using a local variable for regmap_config in da9052-spi driver,
so the settings in spi driver won't impact the settings in i2c driver.
Also makes da9052_regmap_config const to avoid similar issue.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent c38715fe
...@@ -522,7 +522,7 @@ static const struct mfd_cell da9052_subdev_info[] = { ...@@ -522,7 +522,7 @@ static const struct mfd_cell da9052_subdev_info[] = {
}, },
}; };
struct regmap_config da9052_regmap_config = { const struct regmap_config da9052_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
static int da9052_spi_probe(struct spi_device *spi) static int da9052_spi_probe(struct spi_device *spi)
{ {
struct regmap_config config;
int ret; int ret;
const struct spi_device_id *id = spi_get_device_id(spi); const struct spi_device_id *id = spi_get_device_id(spi);
struct da9052 *da9052; struct da9052 *da9052;
...@@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi) ...@@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, da9052); spi_set_drvdata(spi, da9052);
da9052_regmap_config.read_flag_mask = 1; config = da9052_regmap_config;
da9052_regmap_config.write_flag_mask = 0; config.read_flag_mask = 1;
da9052->regmap = devm_regmap_init_spi(spi, &da9052_regmap_config); da9052->regmap = devm_regmap_init_spi(spi, &config);
if (IS_ERR(da9052->regmap)) { if (IS_ERR(da9052->regmap)) {
ret = PTR_ERR(da9052->regmap); ret = PTR_ERR(da9052->regmap);
dev_err(&spi->dev, "Failed to allocate register map: %d\n", dev_err(&spi->dev, "Failed to allocate register map: %d\n",
......
...@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, ...@@ -211,7 +211,7 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
int da9052_device_init(struct da9052 *da9052, u8 chip_id); int da9052_device_init(struct da9052 *da9052, u8 chip_id);
void da9052_device_exit(struct da9052 *da9052); void da9052_device_exit(struct da9052 *da9052);
extern struct regmap_config da9052_regmap_config; extern const struct regmap_config da9052_regmap_config;
int da9052_irq_init(struct da9052 *da9052); int da9052_irq_init(struct da9052 *da9052);
int da9052_irq_exit(struct da9052 *da9052); int da9052_irq_exit(struct da9052 *da9052);
......
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