diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-07-13 06:26:44 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-13 06:49:18 -0400 |
commit | 04dc91ce2cca5927159c689aa1f47663f8c51530 (patch) | |
tree | db8d4393b3fe3d7ed21f04f6c8073993547af6d2 | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
regmap: Add better support for devices without readback support
Currently regmap requires that a reg_read callback is supplied, otherwise a
warning is emitted each time regmap_read() is called. This means a device
or bus without readback support needs to supply dummy reg_read callback.
Apart from that regmap_read() will still work fine if a cache is used.
Remove the warning and let regmap_readable() return false if not reg_read
callback is supplied. This means a device no longer has to supply a dummy
callback if it does not support readback and it also doesn't have to have a
readable_reg callback that always returns false since this is now implicit.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/base/regmap/regmap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 7111d04f2621..8894b992043e 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -93,6 +93,9 @@ bool regmap_writeable(struct regmap *map, unsigned int reg) | |||
93 | 93 | ||
94 | bool regmap_readable(struct regmap *map, unsigned int reg) | 94 | bool regmap_readable(struct regmap *map, unsigned int reg) |
95 | { | 95 | { |
96 | if (!map->reg_read) | ||
97 | return false; | ||
98 | |||
96 | if (map->max_register && reg > map->max_register) | 99 | if (map->max_register && reg > map->max_register) |
97 | return false; | 100 | return false; |
98 | 101 | ||
@@ -2097,8 +2100,6 @@ static int _regmap_read(struct regmap *map, unsigned int reg, | |||
2097 | int ret; | 2100 | int ret; |
2098 | void *context = _regmap_map_get_context(map); | 2101 | void *context = _regmap_map_get_context(map); |
2099 | 2102 | ||
2100 | WARN_ON(!map->reg_read); | ||
2101 | |||
2102 | if (!map->cache_bypass) { | 2103 | if (!map->cache_bypass) { |
2103 | ret = regcache_read(map, reg, val); | 2104 | ret = regcache_read(map, reg, val); |
2104 | if (ret == 0) | 2105 | if (ret == 0) |