regmap: Skip precious registers when dumping registers via debugfs
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 8 Aug 2011 06:41:46 +0000 (15:41 +0900)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Mon, 8 Aug 2011 06:57:35 +0000 (15:57 +0900)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/base/regmap/internal.h
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap.c

index 78f87f316a1bc8d75d7ce6eb0903f7d47fc53743..a67dc68aba5e34abe2a201541b50cbf60608e1de 100644 (file)
@@ -45,6 +45,7 @@ struct regmap {
        bool (*writeable_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 (*precious_reg)(struct device *dev, unsigned int reg);
 };
 
 #ifdef CONFIG_DEBUG_FS
index 2be8bf86825b3013e4699297d8f7652cedf95e82..184b618e318e82979386de3a4bcd3a6b4537083d 100644 (file)
@@ -56,6 +56,10 @@ static ssize_t regmap_map_read_file(struct file *file, char __user *user_buf,
                    !map->readable_reg(map->dev, i))
                        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 (p >= *ppos) {
                        /* ...but not beyond it */
index a3eaef6552ce9d3eeec6861934365d7e52454b21..d74d306a938b54df3c2acfa962753b356e17feb8 100644 (file)
@@ -101,6 +101,7 @@ struct regmap *regmap_init(struct device *dev,
        map->writeable_reg = config->writeable_reg;
        map->readable_reg = config->readable_reg;
        map->volatile_reg = config->volatile_reg;
+       map->precious_reg = config->precious_reg;
 
        switch (config->reg_bits) {
        case 4: