Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Lucas Tanure and committed by
Mark Brown
f7d01359 6e1e90ec

+7 -4
+7 -4
drivers/base/regmap/regmap.c
··· 1924 1924 } 1925 1925 } 1926 1926 1927 - if (regmap_should_log(map)) 1928 - dev_info(map->dev, "%x <= %x\n", reg, val); 1927 + ret = map->reg_write(context, reg, val); 1928 + if (ret == 0) { 1929 + if (regmap_should_log(map)) 1930 + dev_info(map->dev, "%x <= %x\n", reg, val); 1929 1931 1930 - trace_regmap_reg_write(map, reg, val); 1932 + trace_regmap_reg_write(map, reg, val); 1933 + } 1931 1934 1932 - return map->reg_write(context, reg, val); 1935 + return ret; 1933 1936 } 1934 1937 1935 1938 /**