Skip to content

Commit

Permalink
regmap: Implement writable register checks
Browse files Browse the repository at this point in the history
This is mainly intended to be used by devices which can dynamically
block register writes at runtime, for other devices there is usually
limited value.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Mark Brown committed Aug 8, 2011
1 parent fb2736b commit 7330478
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
void *buf;
int ret = -ENOTSUPP;
size_t len;
int i;

/* Check for unwritable registers before we start */
if (map->writeable_reg)
for (i = 0; i < val_len / map->format.val_bytes; i++)
if (!map->writeable_reg(map->dev, reg + i))
return -EINVAL;

map->format.format_reg(map->work_buf, reg);

Expand Down

0 comments on commit 7330478

Please sign in to comment.