diff options
author | Tuomas Tynkkynen <ttynkkynen@nvidia.com> | 2014-07-21 11:38:47 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-07-25 13:29:28 -0400 |
commit | 8d7d3972a9ae962bbf8ce49c83f4a40082708f69 (patch) | |
tree | 07afde20ecc6fa6ab8a6e9372f44f2a0101a2191 | |
parent | 7171511eaec5bf23fb06078f59784a3a0626b38f (diff) |
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>
-rw-r--r-- | drivers/base/regmap/regmap.c | 12 | ||||
-rw-r--r-- | include/linux/regmap.h | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 74d8c0672cf6..5ba0263fce21 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1073,6 +1073,18 @@ struct regmap *dev_get_regmap(struct device *dev, const char *name) | |||
1073 | } | 1073 | } |
1074 | EXPORT_SYMBOL_GPL(dev_get_regmap); | 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 | static int _regmap_select_page(struct regmap *map, unsigned int *reg, | 1088 | static int _regmap_select_page(struct regmap *map, unsigned int *reg, |
1077 | struct regmap_range_node *range, | 1089 | struct regmap_range_node *range, |
1078 | unsigned int val_num) | 1090 | unsigned int val_num) |
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); | |||
396 | int regmap_reinit_cache(struct regmap *map, | 396 | int regmap_reinit_cache(struct regmap *map, |
397 | const struct regmap_config *config); | 397 | const struct regmap_config *config); |
398 | struct regmap *dev_get_regmap(struct device *dev, const char *name); | 398 | struct regmap *dev_get_regmap(struct device *dev, const char *name); |
399 | struct device *regmap_get_device(struct regmap *map); | ||
399 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); | 400 | int regmap_write(struct regmap *map, unsigned int reg, unsigned int val); |
400 | int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); | 401 | int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val); |
401 | int regmap_raw_write(struct regmap *map, unsigned int reg, | 402 | int regmap_raw_write(struct regmap *map, unsigned int reg, |
@@ -729,6 +730,12 @@ static inline struct regmap *dev_get_regmap(struct device *dev, | |||
729 | return NULL; | 730 | return NULL; |
730 | } | 731 | } |
731 | 732 | ||
733 | static inline struct device *regmap_get_device(struct regmap *map) | ||
734 | { | ||
735 | WARN_ONCE(1, "regmap API is disabled"); | ||
736 | return -EINVAL; | ||
737 | } | ||
738 | |||
732 | #endif | 739 | #endif |
733 | 740 | ||
734 | #endif | 741 | #endif |