Commit 73304781 authored by Mark Brown's avatar Mark Brown

regmap: Implement writable register checks

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent fb2736bb
...@@ -211,6 +211,13 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg, ...@@ -211,6 +211,13 @@ static int _regmap_raw_write(struct regmap *map, unsigned int reg,
void *buf; void *buf;
int ret = -ENOTSUPP; int ret = -ENOTSUPP;
size_t len; 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); map->format.format_reg(map->work_buf, reg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment