From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: sam@ravnborg.org
Cc: barebox@lists.infradead.org
Subject: [PATCH] regmap: Implement syscon_regmap_lookup_by_compatible()
Date: Tue, 19 Feb 2019 09:02:36 +0100 [thread overview]
Message-ID: <20190219080235.17763-1-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20190219075239.12448-1-a.fatoum@pengutronix.de>
Implement syscon_regmap_lookup_by_compatible() to simplify porting kernel code.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-02-19 8:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-18 19:47 [PATCH v3 0/9] at91: Support PMC clock bindings Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 1/9] arm: at91: fix at91_configure_usart6 warning Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 2/9] clocksource: Do not mix depends and select for ATMEL_PIT Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 3/9] arm: at91: add SOC_SAMA5{D3,D4} Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 4/9] clk: at91: add at91sam9260 Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 5/9] clk: at91: add at91sam9rl Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 6/9] clk: at91: add at91sam9x5 Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 7/9] clk: at91: add sama5d2 Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 8/9] clk: at91: add sama5d4 Sam Ravnborg
2019-02-18 19:47 ` [PATCH v3 9/9] clk: at91: update to PMC bindings Sam Ravnborg
2019-02-19 7:50 ` Ahmad Fatoum
2019-02-19 7:52 ` [PATCH] fixup! " Ahmad Fatoum
2019-02-19 8:02 ` Ahmad Fatoum [this message]
2019-02-19 10:04 ` Sam Ravnborg
2019-02-19 11:14 ` Ahmad Fatoum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190219080235.17763-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox