Skip to content

Commit 3e47b88

Browse files
committed
regmap: Drop early readability check
We have some drivers that have a use case for cached write only registers, doing read/modify/writes on read only registers in order to work more easily with bitfields. Go back to trying the cache before we check if we can read from the device. Fixes: eab5abd ("regmap: Check for register readability before checking cache during read") Reported-by: Konrad Dybcio <konradybcio@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230615-regmap-drop-early-readability-v1-1-8135094362de@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 505cb70 commit 3e47b88

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/base/regmap/regmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2897,9 +2897,6 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
28972897
int ret;
28982898
void *context = _regmap_map_get_context(map);
28992899

2900-
if (!regmap_readable(map, reg))
2901-
return -EIO;
2902-
29032900
if (!map->cache_bypass) {
29042901
ret = regcache_read(map, reg, val);
29052902
if (ret == 0)
@@ -2909,6 +2906,9 @@ static int _regmap_read(struct regmap *map, unsigned int reg,
29092906
if (map->cache_only)
29102907
return -EBUSY;
29112908

2909+
if (!regmap_readable(map, reg))
2910+
return -EIO;
2911+
29122912
ret = map->reg_read(context, reg, val);
29132913
if (ret == 0) {
29142914
if (regmap_should_log(map))

0 commit comments

Comments
 (0)