mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Carlo Caione <carlo.caione@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] clkdev: add helper function to register one clock lookup for a struct clk
Date: Thu, 18 Oct 2012 21:40:16 +0200	[thread overview]
Message-ID: <1350589216-82634-1-git-send-email-carlo.caione@gmail.com> (raw)

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

                 reply	other threads:[~2012-10-18 19:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1350589216-82634-1-git-send-email-carlo.caione@gmail.com \
    --to=carlo.caione@gmail.com \
    --cc=barebox@lists.infradead.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