From 8d7d3972a9ae962bbf8ce49c83f4a40082708f69 Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Mon, 21 Jul 2014 18:38:47 +0300 Subject: regmap: Add regmap_get_device Add a new function regmap_get_device to obtain the underlying struct device from a regmap. Signed-off-by: Tuomas Tynkkynen Signed-off-by: Mark Brown --- include/linux/regmap.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 7b0e4b425cdf..cd480fd59795 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -396,6 +396,7 @@ void regmap_exit(struct regmap *map); int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config); struct regmap *dev_get_regmap(struct device *dev, const char *name); +struct device *regmap_get_device(struct regmap *map); int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); int regmap_raw_write(struct regmap *map, unsigned int reg, @@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev, return NULL; } +static inline struct device *regmap_get_device(struct regmap *map) +{ + WARN_ONCE(1, "regmap API is disabled"); + return -EINVAL; +} + #endif #endif -- cgit v1.2.3 From 1d33dc6b0f0fd1a1f65011f54165c558daf46638 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 25 Jul 2014 19:01:53 +0100 Subject: regmap: Fix return code for stub regmap_get_device() We return a pointer, not an int. Signed-off-by: Mark Brown --- include/linux/regmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/regmap.h b/include/linux/regmap.h index cd480fd59795..c5ed83f49c4e 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -733,7 +733,7 @@ static inline struct regmap *dev_get_regmap(struct device *dev, static inline struct device *regmap_get_device(struct regmap *map) { WARN_ONCE(1, "regmap API is disabled"); - return -EINVAL; + return NULL; } #endif -- cgit v1.2.3