Commit 2efe1642 authored by Mark Brown's avatar Mark Brown

regmap: Skip precious registers when dumping registers via debugfs

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 31244e39
...@@ -45,6 +45,7 @@ struct regmap { ...@@ -45,6 +45,7 @@ struct regmap {
bool (*writeable_reg)(struct device *dev, unsigned int reg); bool (*writeable_reg)(struct device *dev, unsigned int reg);
bool (*readable_reg)(struct device *dev, unsigned int reg); bool (*readable_reg)(struct device *dev, unsigned int reg);
bool (*volatile_reg)(struct device *dev, unsigned int reg); bool (*volatile_reg)(struct device *dev, unsigned int reg);
bool (*precious_reg)(struct device *dev, unsigned int reg);
}; };
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
......
...@@ -56,6 +56,10 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf, ...@@ -56,6 +56,10 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
!map->readable_reg(map->dev, i)) !map->readable_reg(map->dev, i))
continue; continue;
if (map->precious_reg &&
map->precious_reg(map->dev, i))
continue;
/* If we're in the region the user is trying to read */ /* If we're in the region the user is trying to read */
if (p >= *ppos) { if (p >= *ppos) {
/* ...but not beyond it */ /* ...but not beyond it */
......
...@@ -101,6 +101,7 @@ struct regmap *regmap_init(struct device *dev, ...@@ -101,6 +101,7 @@ struct regmap *regmap_init(struct device *dev,
map->writeable_reg = config->writeable_reg; map->writeable_reg = config->writeable_reg;
map->readable_reg = config->readable_reg; map->readable_reg = config->readable_reg;
map->volatile_reg = config->volatile_reg; map->volatile_reg = config->volatile_reg;
map->precious_reg = config->precious_reg;
switch (config->reg_bits) { switch (config->reg_bits) {
case 4: case 4:
......
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