summaryrefslogtreecommitdiff
path: root/drivers/mfd/da9052-spi.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-08-16 21:23:40 +0800
committerLee Jones <lee.jones@linaro.org>2014-09-26 08:15:54 +0100
commite9e9d3973594cadd9e892bc79f914f299bb61124 (patch)
tree30b3bb2865a5f4e267b7353efdd41c4888249872 /drivers/mfd/da9052-spi.c
parentc38715fed8f51a8fba4a15f86732ad885f073d78 (diff)
downloadlwn-e9e9d3973594cadd9e892bc79f914f299bb61124.tar.gz
lwn-e9e9d3973594cadd9e892bc79f914f299bb61124.zip
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: Axel Lin <axel.lin@ingics.com> Acked-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/da9052-spi.c')
-rw-r--r--drivers/mfd/da9052-spi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index 17666b40b70c..45ae0b7d13ef 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -23,6 +23,7 @@
static int da9052_spi_probe(struct spi_device *spi)
{
+ struct regmap_config config;
int ret;
const struct spi_device_id *id = spi_get_device_id(spi);
struct da9052 *da9052;
@@ -40,10 +41,10 @@ static int da9052_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, da9052);
- da9052_regmap_config.read_flag_mask = 1;
- da9052_regmap_config.write_flag_mask = 0;
+ config = da9052_regmap_config;
+ 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)) {
ret = PTR_ERR(da9052->regmap);
dev_err(&spi->dev, "Failed to allocate register map: %d\n",