提交 237b98f6 编写于 作者: P Paul Mundt

sh: sem2mutex conversion for clock framework.

Simple sem2mutex conversion.
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 9f23e7e9
/* /*
* arch/sh/kernel/cpu/clock.c - SuperH clock framework * arch/sh/kernel/cpu/clock.c - SuperH clock framework
* *
* Copyright (C) 2005 Paul Mundt * Copyright (C) 2005, 2006 Paul Mundt
* *
* This clock framework is derived from the OMAP version by: * This clock framework is derived from the OMAP version by:
* *
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
...@@ -24,7 +25,7 @@ ...@@ -24,7 +25,7 @@
static LIST_HEAD(clock_list); static LIST_HEAD(clock_list);
static DEFINE_SPINLOCK(clock_lock); static DEFINE_SPINLOCK(clock_lock);
static DECLARE_MUTEX(clock_list_sem); static DEFINE_MUTEX(clock_list_sem);
/* /*
* Each subtype is expected to define the init routines for these clocks, * Each subtype is expected to define the init routines for these clocks,
...@@ -140,21 +141,21 @@ void clk_disable(struct clk *clk) ...@@ -140,21 +141,21 @@ void clk_disable(struct clk *clk)
int clk_register(struct clk *clk) int clk_register(struct clk *clk)
{ {
down(&clock_list_sem); mutex_lock(&clock_list_sem);
list_add(&clk->node, &clock_list); list_add(&clk->node, &clock_list);
kref_init(&clk->kref); kref_init(&clk->kref);
up(&clock_list_sem); mutex_unlock(&clock_list_sem);
return 0; return 0;
} }
void clk_unregister(struct clk *clk) void clk_unregister(struct clk *clk)
{ {
down(&clock_list_sem); mutex_lock(&clock_list_sem);
list_del(&clk->node); list_del(&clk->node);
up(&clock_list_sem); mutex_unlock(&clock_list_sem);
} }
inline unsigned long clk_get_rate(struct clk *clk) inline unsigned long clk_get_rate(struct clk *clk)
...@@ -198,14 +199,14 @@ struct clk *clk_get(const char *id) ...@@ -198,14 +199,14 @@ struct clk *clk_get(const char *id)
{ {
struct clk *p, *clk = ERR_PTR(-ENOENT); struct clk *p, *clk = ERR_PTR(-ENOENT);
down(&clock_list_sem); mutex_lock(&clock_list_sem);
list_for_each_entry(p, &clock_list, node) { list_for_each_entry(p, &clock_list, node) {
if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
clk = p; clk = p;
break; break;
} }
} }
up(&clock_list_sem); mutex_unlock(&clock_list_sem);
return clk; return clk;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册