regmap: Implement dev_get_regmap()
Subsystems (2)
PATCH 1/1 regmap: Implement dev_get_regmap()
Use devres to implement dev_get_regmap(). This should mean that in almost all cases devices wishing to take advantage of framework features based on regmap shouldn't need to explicitly pass the regmap into the framework. This simplifies device setup a bit.
Signed-off-by Mark Brown <[email protected]>
--- drivers/base/regmap/internal.h | 1 + drivers/base/regmap/regmap.c | 61 +++++++++++++++++++++++++++++++++++++++- include/linux/regmap.h | 8 ++++++ 3 files changed, 69 insertions(+), 1 deletion(-)
drivers/base/regmap/internal.h +1 -0
@@ -45,6 +45,7 @@ struct regmap {struct regmap_format format;/* Buffer format */ const struct regmap_bus *bus;void *bus_context; +const char *name;#ifdef CONFIG_DEBUG_FS struct dentry *debugfs;
drivers/base/regmap/regmap.c +60 -1
93 lines not on this page · raw message
include/linux/regmap.h +8 -0
@@ -170,6 +170,7 @@ struct regmap *devm_regmap_init_mmio(struct device *dev,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);int regmap_write (struct regmap *map,unsigned int reg,unsigned int val);int regmap_raw_write (struct regmap *map,unsigned int reg,const void *val,size_t val_len);
@@ -354,6 +355,13 @@ static inline int regmap_register_patch(struct regmap *map,return -EINVAL ; } +static inline struct regmap *dev_get_regmap (struct device *dev, +const char *name) +{ +WARN_ONCE (1 ,"regmap API is disabled" ); +return NULL ; +} +#endif #endif
Signature · 1 line
1.7.10