mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clkdev: add helper function to register one clock lookup for a struct clk
@ 2012-10-18 19:40 Carlo Caione
  0 siblings, 0 replies; only message in thread
From: Carlo Caione @ 2012-10-18 19:40 UTC (permalink / raw)
  To: barebox

Signed-off-by: Carlo Caione <carlo.caione@gmail.com>
---
 drivers/clk/clkdev.c   | 21 +++++++++++++++++++++
 include/linux/clkdev.h |  1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
index 1ae822f..5441eeb 100644
--- a/drivers/clk/clkdev.c
+++ b/drivers/clk/clkdev.c
@@ -178,6 +178,27 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,
 }
 EXPORT_SYMBOL(clkdev_alloc);
 
+int clk_register_clkdev(struct clk *clk, const char *con_id,
+	const char *dev_fmt, ...)
+{
+	struct clk_lookup *cl;
+	va_list ap;
+
+	if (IS_ERR(clk))
+                return PTR_ERR(clk);
+
+	va_start(ap, dev_fmt);
+	cl = clkdev_alloc(clk, con_id, dev_fmt, ap);
+	va_end(ap);
+
+	if (!cl)
+		return -ENOMEM;
+
+	clkdev_add(cl);
+
+	return 0;
+}
+
 int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,
 	struct device_d *dev)
 {
diff --git a/include/linux/clkdev.h b/include/linux/clkdev.h
index d2f0d89..1fc0ab9 100644
--- a/include/linux/clkdev.h
+++ b/include/linux/clkdev.h
@@ -33,6 +33,7 @@ void clkdev_drop(struct clk_lookup *cl);
 
 void clkdev_add_table(struct clk_lookup *, size_t);
 int clk_add_alias(const char *, const char *, char *, struct device_d *);
+int clk_register_clkdev(struct clk *, const char *, const char *, ...);
 
 int clkdev_add_physbase(struct clk *clk, unsigned long base, const char *id);
 
-- 
1.7.12.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-18 19:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-18 19:40 [PATCH] clkdev: add helper function to register one clock lookup for a struct clk Carlo Caione

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox