From: Magnus Damm Date: Thu, 17 Jul 2008 10:09:51 +0000 (+0900) Subject: sh: Introduce clk_always_enable() function X-Git-Tag: v3.12-rc1~19022^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=de9254263b8c8b1809520a1009dd516e41976519;p=kernel%2Fkernel-generic.git 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 Signed-off-by: Paul Mundt --- 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 #include #include +#include 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