]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
regmap: Introduce regmap_get_max_register
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 21 May 2015 16:42:43 +0000 (17:42 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 22 May 2015 11:19:18 +0000 (12:19 +0100)
This patch introduces regmap_get_max_register() function which would be
used by the infrastructures like nvmem framework built on top of
regmap.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap.c
include/linux/regmap.h

index 6273ff072f3eaa4cbd777b1a4f41fb3cf533a42a..d6c84047b9574f9dc03553656e06b380adab058f 100644 (file)
@@ -2613,6 +2613,18 @@ int regmap_get_val_bytes(struct regmap *map)
 }
 EXPORT_SYMBOL_GPL(regmap_get_val_bytes);
 
+/**
+ * regmap_get_max_register(): Report the max register value
+ *
+ * Report the max register value, mainly intended to for use by
+ * generic infrastructure built on top of regmap.
+ */
+int regmap_get_max_register(struct regmap *map)
+{
+       return map->max_register ? map->max_register : -EINVAL;
+}
+EXPORT_SYMBOL_GPL(regmap_get_max_register);
+
 int regmap_parse_val(struct regmap *map, const void *buf,
                        unsigned int *val)
 {
index 116655d922691b3143b8c9d840b944fed3a70adb..2d87deda79cd59034763376bbdc4503cfc754000 100644 (file)
@@ -433,6 +433,7 @@ int regmap_update_bits_check_async(struct regmap *map, unsigned int reg,
                                   unsigned int mask, unsigned int val,
                                   bool *change);
 int regmap_get_val_bytes(struct regmap *map);
+int regmap_get_max_register(struct regmap *map);
 int regmap_async_complete(struct regmap *map);
 bool regmap_can_raw_write(struct regmap *map);
 
@@ -676,6 +677,12 @@ static inline int regmap_get_val_bytes(struct regmap *map)
        return -EINVAL;
 }
 
+static inline int regmap_get_max_register(struct regmap *map)
+{
+       WARN_ONCE(1, "regmap API is disabled");
+       return -EINVAL;
+}
+
 static inline int regcache_sync(struct regmap *map)
 {
        WARN_ONCE(1, "regmap API is disabled");