diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-11-16 16:28:17 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-11-16 17:34:53 +0000 |
commit | 720e4616e8fd85284ef1addd8b8d93d8415e8dbc (patch) | |
tree | 7e168b437b5b4ecb1154186e3234fbdbf9c52b92 /drivers/base/regmap | |
parent | e5e3b8abeda1cf45f5a079458dbc267952694c7a (diff) | |
download | linux-3.10-720e4616e8fd85284ef1addd8b8d93d8415e8dbc.tar.gz linux-3.10-720e4616e8fd85284ef1addd8b8d93d8415e8dbc.tar.bz2 linux-3.10-720e4616e8fd85284ef1addd8b8d93d8415e8dbc.zip |
regmap: Make reg_config reg_defaults const
The reg_defaults field usually points to a static per driver array, which should
not be modified. Make requirement this explicit by making reg_defaults const.
To allow this the regcache_init code needs some minor changes. Previoulsy the
reg_config was not available in regcache_init and regmap->reg_defaults was used
to pass the default register set to regcache_init. Now that the reg_config is
available we can work on it directly.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap')
-rw-r--r-- | drivers/base/regmap/regcache.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/base/regmap/regcache.c b/drivers/base/regmap/regcache.c index 0ad6cfb2c8c..d687df6ebdb 100644 --- a/drivers/base/regmap/regcache.c +++ b/drivers/base/regmap/regcache.c @@ -108,7 +108,6 @@ int regcache_init(struct regmap *map, const struct regmap_config *config) return -EINVAL; } - map->reg_defaults = config->reg_defaults; map->num_reg_defaults = config->num_reg_defaults; map->num_reg_defaults_raw = config->num_reg_defaults_raw; map->reg_defaults_raw = config->reg_defaults_raw; @@ -127,10 +126,10 @@ int regcache_init(struct regmap *map, const struct regmap_config *config) * won't vanish from under us. We'll need to make * a copy of it. */ - if (map->reg_defaults) { + if (config->reg_defaults) { if (!map->num_reg_defaults) return -EINVAL; - tmp_buf = kmemdup(map->reg_defaults, map->num_reg_defaults * + tmp_buf = kmemdup(config->reg_defaults, map->num_reg_defaults * sizeof(struct reg_default), GFP_KERNEL); if (!tmp_buf) return -ENOMEM; |