sh: Introduce clk_always_enable() function

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:08 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=de9254...
Commit:     de9254263b8c8b1809520a1009dd516e41976519
Parent:     152fe36ebee82b63a9c6e510c52aaa82f4b1940d
Author:     Magnus Damm <damm@igel.co.jp>
AuthorDate: Thu Jul 17 19:09:51 2008 +0900
Committer:  Paul Mundt <lethal@linux-sh.org>
CommitDate: Mon Jul 28 18:10:36 2008 +0900

    sh: Introduce clk_always_enable() function
    
    Add SuperH specific funcion clk_always_enable(), useful to enable MSTPCR
    bits in processor or board specific code.
    
    Signed-off-by: Magnus Damm <damm@igel.co.jp>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>
---
 include/asm-sh/clock.h |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/include/asm-sh/clock.h b/include/asm-sh/clock.h
index 252f155..720dfab 100644
--- a/include/asm-sh/clock.h
+++ b/include/asm-sh/clock.h
@@ -5,6 +5,7 @@
 #include <linux/list.h>
 #include <linux/seq_file.h>
 #include <linux/clk.h>
+#include <linux/err.h>
 
 struct clk;
 
@@ -47,6 +48,22 @@ void clk_recalc_rate(struct clk *);
 int clk_register(struct clk *);
 void clk_unregister(struct clk *);
 
+static inline int clk_always_enable(const char *id)
+{
+	struct clk *clk;
+	int ret;
+
+	clk = clk_get(NULL, id);
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+
+	ret = clk_enable(clk);
+	if (ret)
+		clk_put(clk);
+
+	return ret;
+}
+
 /* the exported API, in addition to clk_set_rate */
 /**
  * clk_set_rate_ex - set the clock rate for a clock source, with additional parameter
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
sh: Introduce clk_always_enable() function, Linux Kernel Mailing ..., (Mon Jul 28, 10:08 am)