Skip to content

Commit

Permalink
regmap: if format_write is used, declare all registers as "unreadable"
Browse files Browse the repository at this point in the history
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: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Wolfram Sang authored and Mark Brown committed Jan 30, 2012
1 parent c212acc commit 4191f19
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ bool regmap_readable(struct regmap *map, unsigned int reg)
if (map->max_register && reg > map->max_register)
return false;

if (map->format.format_write)
return false;

if (map->readable_reg)
return map->readable_reg(map->dev, reg);

Expand All @@ -44,7 +47,7 @@ bool regmap_readable(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;

if (map->volatile_reg)
Expand All @@ -55,7 +58,7 @@ bool regmap_volatile(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;

if (map->precious_reg)
Expand Down

0 comments on commit 4191f19

Please sign in to comment.