aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/cpu/clock.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index e7eef07536f5..51ec64cdf348 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/sh/kernel/cpu/clock.c - SuperH clock framework 2 * arch/sh/kernel/cpu/clock.c - SuperH clock framework
3 * 3 *
4 * Copyright (C) 2005 Paul Mundt 4 * Copyright (C) 2005, 2006 Paul Mundt
5 * 5 *
6 * This clock framework is derived from the OMAP version by: 6 * This clock framework is derived from the OMAP version by:
7 * 7 *
@@ -15,6 +15,7 @@
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/mutex.h>
18#include <linux/list.h> 19#include <linux/list.h>
19#include <linux/kref.h> 20#include <linux/kref.h>
20#include <linux/seq_file.h> 21#include <linux/seq_file.h>
@@ -24,7 +25,7 @@
24 25
25static LIST_HEAD(clock_list); 26static LIST_HEAD(clock_list);
26static DEFINE_SPINLOCK(clock_lock); 27static DEFINE_SPINLOCK(clock_lock);
27static DECLARE_MUTEX(clock_list_sem); 28static DEFINE_MUTEX(clock_list_sem);
28 29
29/* 30/*
30 * Each subtype is expected to define the init routines for these clocks, 31 * Each subtype is expected to define the init routines for these clocks,
@@ -140,21 +141,21 @@ void clk_disable(struct clk *clk)
140 141
141int clk_register(struct clk *clk) 142int clk_register(struct clk *clk)
142{ 143{
143 down(&clock_list_sem); 144 mutex_lock(&clock_list_sem);
144 145
145 list_add(&clk->node, &clock_list); 146 list_add(&clk->node, &clock_list);
146 kref_init(&clk->kref); 147 kref_init(&clk->kref);
147 148
148 up(&clock_list_sem); 149 mutex_unlock(&clock_list_sem);
149 150
150 return 0; 151 return 0;
151} 152}
152 153
153void clk_unregister(struct clk *clk) 154void clk_unregister(struct clk *clk)
154{ 155{
155 down(&clock_list_sem); 156 mutex_lock(&clock_list_sem);
156 list_del(&clk->node); 157 list_del(&clk->node);
157 up(&clock_list_sem); 158 mutex_unlock(&clock_list_sem);
158} 159}
159 160
160inline unsigned long clk_get_rate(struct clk *clk) 161inline unsigned long clk_get_rate(struct clk *clk)
@@ -198,14 +199,14 @@ struct clk *clk_get(const char *id)
198{ 199{
199 struct clk *p, *clk = ERR_PTR(-ENOENT); 200 struct clk *p, *clk = ERR_PTR(-ENOENT);
200 201
201 down(&clock_list_sem); 202 mutex_lock(&clock_list_sem);
202 list_for_each_entry(p, &clock_list, node) { 203 list_for_each_entry(p, &clock_list, node) {
203 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 204 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
204 clk = p; 205 clk = p;
205 break; 206 break;
206 } 207 }
207 } 208 }
208 up(&clock_list_sem); 209 mutex_unlock(&clock_list_sem);
209 210
210 return clk; 211 return clk;
211} 212}