regmap: Make regmap_check_range_table() a public API

Allow drivers to use an access table as part of their implementation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
Mark Brown 2013-05-08 13:55:23 +01:00
parent 697e85bc6a
commit 154881e59b
2 changed files with 10 additions and 7 deletions

View File

@ -65,9 +65,8 @@ bool regmap_reg_in_ranges(unsigned int reg,
} }
EXPORT_SYMBOL_GPL(regmap_reg_in_ranges); EXPORT_SYMBOL_GPL(regmap_reg_in_ranges);
static bool _regmap_check_range_table(struct regmap *map, bool regmap_check_range_table(struct regmap *map, unsigned int reg,
unsigned int reg, const struct regmap_access_table *table)
const struct regmap_access_table *table)
{ {
/* Check "no ranges" first */ /* Check "no ranges" first */
if (regmap_reg_in_ranges(reg, table->no_ranges, table->n_no_ranges)) if (regmap_reg_in_ranges(reg, table->no_ranges, table->n_no_ranges))
@ -80,6 +79,7 @@ static bool _regmap_check_range_table(struct regmap *map,
return regmap_reg_in_ranges(reg, table->yes_ranges, return regmap_reg_in_ranges(reg, table->yes_ranges,
table->n_yes_ranges); table->n_yes_ranges);
} }
EXPORT_SYMBOL_GPL(regmap_check_range_table);
bool regmap_writeable(struct regmap *map, unsigned int reg) bool regmap_writeable(struct regmap *map, unsigned int reg)
{ {
@ -90,7 +90,7 @@ bool regmap_writeable(struct regmap *map, unsigned int reg)
return map->writeable_reg(map->dev, reg); return map->writeable_reg(map->dev, reg);
if (map->wr_table) if (map->wr_table)
return _regmap_check_range_table(map, reg, map->wr_table); return regmap_check_range_table(map, reg, map->wr_table);
return true; return true;
} }
@ -107,7 +107,7 @@ bool regmap_readable(struct regmap *map, unsigned int reg)
return map->readable_reg(map->dev, reg); return map->readable_reg(map->dev, reg);
if (map->rd_table) if (map->rd_table)
return _regmap_check_range_table(map, reg, map->rd_table); return regmap_check_range_table(map, reg, map->rd_table);
return true; return true;
} }
@ -121,7 +121,7 @@ bool regmap_volatile(struct regmap *map, unsigned int reg)
return map->volatile_reg(map->dev, reg); return map->volatile_reg(map->dev, reg);
if (map->volatile_table) if (map->volatile_table)
return _regmap_check_range_table(map, reg, map->volatile_table); return regmap_check_range_table(map, reg, map->volatile_table);
return true; return true;
} }
@ -135,7 +135,7 @@ bool regmap_precious(struct regmap *map, unsigned int reg)
return map->precious_reg(map->dev, reg); return map->precious_reg(map->dev, reg);
if (map->precious_table) if (map->precious_table)
return _regmap_check_range_table(map, reg, map->precious_table); return regmap_check_range_table(map, reg, map->precious_table);
return false; return false;
} }

View File

@ -400,6 +400,9 @@ void regcache_cache_only(struct regmap *map, bool enable);
void regcache_cache_bypass(struct regmap *map, bool enable); void regcache_cache_bypass(struct regmap *map, bool enable);
void regcache_mark_dirty(struct regmap *map); void regcache_mark_dirty(struct regmap *map);
bool regmap_check_range_table(struct regmap *map, unsigned int reg,
const struct regmap_access_table *table);
int regmap_register_patch(struct regmap *map, const struct reg_default *regs, int regmap_register_patch(struct regmap *map, const struct reg_default *regs,
int num_regs); int num_regs);