projects
/
firefly-linux-kernel-4.4.55.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ea850c0
)
rk30: tsadc: add mutex to protect rk30_tsadc_get
author
黄涛
<huangtao@rock-chips.com>
Fri, 20 Apr 2012 06:58:07 +0000
(14:58 +0800)
committer
黄涛
<huangtao@rock-chips.com>
Fri, 20 Apr 2012 06:58:07 +0000
(14:58 +0800)
arch/arm/mach-rk30/tsadc.c
patch
|
blob
|
history
diff --git
a/arch/arm/mach-rk30/tsadc.c
b/arch/arm/mach-rk30/tsadc.c
index 86794765ad801cdef7a3a19c927c1e9437076c98..702d816bf09c1bd7e45dfadcedf055ddf892e993 100644
(file)
--- a/
arch/arm/mach-rk30/tsadc.c
+++ b/
arch/arm/mach-rk30/tsadc.c
@@
-106,6
+106,7
@@
static void tsadc_writel(u32 val, u32 offset)
writel_relaxed(val, g_dev->regs + offset);
}
+static DEFINE_MUTEX(tsadc_mutex);
static void rk30_tsadc_get(unsigned int chn, int *temp, int *code)
{
*temp = 0;
@@
-114,6
+115,8
@@
static void rk30_tsadc_get(unsigned int chn, int *temp, int *code)
if (!g_dev || chn > 1)
return;
+ mutex_lock(&tsadc_mutex);
+
clk_enable(g_dev->pclk);
clk_enable(g_dev->clk);
@@
-135,6
+138,8
@@
static void rk30_tsadc_get(unsigned int chn, int *temp, int *code)
clk_disable(g_dev->clk);
clk_disable(g_dev->pclk);
+
+ mutex_unlock(&tsadc_mutex);
}
int rk30_tsadc_get_temp(unsigned int chn)