regmap: Add functions to check for access on registers

We're going to be using these in quite a few places so factor out the
readable/writable/volatile/precious checks.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown
2011-08-10 17:14:41 +09:00
parent 13c54137f7
commit 8de2f081ef
3 changed files with 51 additions and 4 deletions

View File

@@ -52,12 +52,10 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
tot_len = reg_len + val_len + 3; /* : \n */
for (i = 0; i < map->max_register; i++) {
if (map->readable_reg &&
!map->readable_reg(map->dev, i))
if (!regmap_readable(map, i))
continue;
if (map->precious_reg &&
map->precious_reg(map->dev, i))
if (regmap_precious(map, i))
continue;
/* If we're in the region the user is trying to read */