summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regmap.c
diff options
context:
space:
mode:
authorLucas Tanure <tanureal@opensource.cirrus.com>2020-11-12 18:02:17 +0300
committerMark Brown <broonie@kernel.org>2020-11-12 19:05:17 +0300
commitf7d01359b0d96331fce7bd4051d3b68a4bb5ea83 (patch)
treea86d5c3bd91430e5c6b447894c43812c13869093 /drivers/base/regmap/regmap.c
parent6e1e90ec027509a7e8d4efbd77a65b32b5a8b3ec (diff)
downloadlinux-f7d01359b0d96331fce7bd4051d3b68a4bb5ea83.tar.xz
regmap: Fix order of regmap write log
_regmap_write can trigger a _regmap_select_page, which will call another _regmap_write that will be executed first, but the log shows the inverse order Also, keep consistency with _regmap_read which only logs in case of success Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20201112150217.459844-1-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r--drivers/base/regmap/regmap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index 5db536ccfcd6..297e95be25b3 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -1924,12 +1924,15 @@ int _regmap_write(struct regmap *map, unsigned int reg,
}
}
- if (regmap_should_log(map))
- dev_info(map->dev, "%x <= %x\n", reg, val);
+ ret = map->reg_write(context, reg, val);
+ if (ret == 0) {
+ if (regmap_should_log(map))
+ dev_info(map->dev, "%x <= %x\n", reg, val);
- trace_regmap_reg_write(map, reg, val);
+ trace_regmap_reg_write(map, reg, val);
+ }
- return map->reg_write(context, reg, val);
+ return ret;
}
/**