提交 4191f197 编写于 作者: W Wolfram Sang 提交者: Mark Brown

regmap: if format_write is used, declare all registers as "unreadable"

Using .format_write means, we have a custom function to write to the
chip, but not to read back. Also, mark registers as "not precious" and
"not volatile" which is implicit because we cannot read them. Make those
functions use 'regmap_readable' to reuse the checks done there.
Signed-off-by: NWolfram Sang <w.sang@pengutronix.de>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 c212accc
...@@ -36,6 +36,9 @@ bool regmap_readable(struct regmap *map, unsigned int reg) ...@@ -36,6 +36,9 @@ bool regmap_readable(struct regmap *map, unsigned int reg)
if (map->max_register && reg > map->max_register) if (map->max_register && reg > map->max_register)
return false; return false;
if (map->format.format_write)
return false;
if (map->readable_reg) if (map->readable_reg)
return map->readable_reg(map->dev, reg); return map->readable_reg(map->dev, reg);
...@@ -44,7 +47,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg) ...@@ -44,7 +47,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg)
bool regmap_volatile(struct regmap *map, unsigned int reg) bool regmap_volatile(struct regmap *map, unsigned int reg)
{ {
if (map->max_register && reg > map->max_register) if (!regmap_readable(map, reg))
return false; return false;
if (map->volatile_reg) if (map->volatile_reg)
...@@ -55,7 +58,7 @@ bool regmap_volatile(struct regmap *map, unsigned int reg) ...@@ -55,7 +58,7 @@ bool regmap_volatile(struct regmap *map, unsigned int reg)
bool regmap_precious(struct regmap *map, unsigned int reg) bool regmap_precious(struct regmap *map, unsigned int reg)
{ {
if (map->max_register && reg > map->max_register) if (!regmap_readable(map, reg))
return false; return false;
if (map->precious_reg) if (map->precious_reg)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册