Implement syscon_regmap_lookup_by_compatible() to simplify porting kernel code. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- Forgot to send this one first. Should be applied prior to the fixed up commit. drivers/mfd/syscon.c | 14 ++++++++++++++ include/mfd/syscon.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 30ed65f73700..b1ff1b1eac5e 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -160,6 +160,20 @@ struct regmap *syscon_node_to_regmap(struct device_node *np) return syscon->regmap; } +struct regmap *syscon_regmap_lookup_by_compatible(const char *s) +{ + struct device_node *syscon_np; + struct regmap *regmap; + + syscon_np = of_find_compatible_node(NULL, NULL, s); + if (!syscon_np) + return ERR_PTR(-ENODEV); + + regmap = syscon_node_to_regmap(syscon_np); + + return regmap; +} + static int syscon_probe(struct device_d *dev) { struct syscon *syscon; diff --git a/include/mfd/syscon.h b/include/mfd/syscon.h index 63b893e4aee7..902f9fa2f339 100644 --- a/include/mfd/syscon.h +++ b/include/mfd/syscon.h @@ -21,6 +21,7 @@ void __iomem *syscon_base_lookup_by_pdevname(const char *s); void __iomem *syscon_base_lookup_by_phandle (struct device_node *np, const char *property); struct regmap *syscon_node_to_regmap(struct device_node *np); +struct regmap *syscon_regmap_lookup_by_compatible(const char *s); #else static inline void __iomem *syscon_base_lookup_by_pdevname(const char *s) { @@ -37,6 +38,10 @@ static inline struct regmap *syscon_node_to_regmap(struct device_node *np) { return ERR_PTR(-ENOSYS); } +static inline struct regmap *syscon_regmap_lookup_by_compatible(const char *s) +{ + return ERR_PTR(-ENOSYS); +} #endif #endif -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox