Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ttynkkynen@nvidia.com>
Signed-off-by: Mark Brown <broonie@linaro.org>

authored by

Tuomas Tynkkynen and committed by
Mark Brown
8d7d3972 7171511e

+19
+12
drivers/base/regmap/regmap.c
··· 1073 1073 } 1074 1074 EXPORT_SYMBOL_GPL(dev_get_regmap); 1075 1075 1076 + /** 1077 + * regmap_get_device(): Obtain the device from a regmap 1078 + * 1079 + * @map: Register map to operate on. 1080 + * 1081 + * Returns the underlying device that the regmap has been created for. 1082 + */ 1083 + struct device *regmap_get_device(struct regmap *map) 1084 + { 1085 + return map->dev; 1086 + } 1087 + 1076 1088 static int _regmap_select_page(struct regmap *map, unsigned int *reg, 1077 1089 struct regmap_range_node *range, 1078 1090 unsigned int val_num)
+7
include/linux/regmap.h
··· 396 396 int regmap_reinit_cache(struct regmap *map, 397 397 const struct regmap_config *config); 398 398 struct regmap *dev_get_regmap(struct device *dev, const char *name); 399 + struct device *regmap_get_device(struct regmap *map); 399 400 int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); 400 401 int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); 401 402 int regmap_raw_write(struct regmap *map, unsigned int reg, ··· 728 727 const char *name) 729 728 { 730 729 return NULL; 730 + } 731 + 732 + static inline struct device *regmap_get_device(struct regmap *map) 733 + { 734 + WARN_ONCE(1, "regmap API is disabled"); 735 + return -EINVAL; 731 736 } 732 737 733 738 #endif