Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
7d0c399f
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7d0c399f
编写于
5月 25, 2012
作者:
P
Paul Mundt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clocksource: sh_cmt: Convert timer lock to raw spinlock.
Signed-off-by:
N
Paul Mundt
<
lethal@linux-sh.org
>
上级
cfaf0251
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
13 addition
and
13 deletion
+13
-13
drivers/clocksource/sh_cmt.c
drivers/clocksource/sh_cmt.c
+13
-13
未找到文件。
drivers/clocksource/sh_cmt.c
浏览文件 @
7d0c399f
...
@@ -48,13 +48,13 @@ struct sh_cmt_priv {
...
@@ -48,13 +48,13 @@ struct sh_cmt_priv {
unsigned
long
next_match_value
;
unsigned
long
next_match_value
;
unsigned
long
max_match_value
;
unsigned
long
max_match_value
;
unsigned
long
rate
;
unsigned
long
rate
;
spinlock_t
lock
;
raw_
spinlock_t
lock
;
struct
clock_event_device
ced
;
struct
clock_event_device
ced
;
struct
clocksource
cs
;
struct
clocksource
cs
;
unsigned
long
total_cycles
;
unsigned
long
total_cycles
;
};
};
static
DEFINE_SPINLOCK
(
sh_cmt_lock
);
static
DEFINE_
RAW_
SPINLOCK
(
sh_cmt_lock
);
#define CMSTR -1
/* shared register */
#define CMSTR -1
/* shared register */
#define CMCSR 0
/* channel register */
#define CMCSR 0
/* channel register */
...
@@ -139,7 +139,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
...
@@ -139,7 +139,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
unsigned
long
flags
,
value
;
unsigned
long
flags
,
value
;
/* start stop register shared by multiple timer channels */
/* start stop register shared by multiple timer channels */
spin_lock_irqsave
(
&
sh_cmt_lock
,
flags
);
raw_
spin_lock_irqsave
(
&
sh_cmt_lock
,
flags
);
value
=
sh_cmt_read
(
p
,
CMSTR
);
value
=
sh_cmt_read
(
p
,
CMSTR
);
if
(
start
)
if
(
start
)
...
@@ -148,7 +148,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
...
@@ -148,7 +148,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
value
&=
~
(
1
<<
cfg
->
timer_bit
);
value
&=
~
(
1
<<
cfg
->
timer_bit
);
sh_cmt_write
(
p
,
CMSTR
,
value
);
sh_cmt_write
(
p
,
CMSTR
,
value
);
spin_unlock_irqrestore
(
&
sh_cmt_lock
,
flags
);
raw_
spin_unlock_irqrestore
(
&
sh_cmt_lock
,
flags
);
}
}
static
int
sh_cmt_enable
(
struct
sh_cmt_priv
*
p
,
unsigned
long
*
rate
)
static
int
sh_cmt_enable
(
struct
sh_cmt_priv
*
p
,
unsigned
long
*
rate
)
...
@@ -328,9 +328,9 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
...
@@ -328,9 +328,9 @@ static void sh_cmt_set_next(struct sh_cmt_priv *p, unsigned long delta)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
raw_
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
__sh_cmt_set_next
(
p
,
delta
);
__sh_cmt_set_next
(
p
,
delta
);
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
raw_
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
}
}
static
irqreturn_t
sh_cmt_interrupt
(
int
irq
,
void
*
dev_id
)
static
irqreturn_t
sh_cmt_interrupt
(
int
irq
,
void
*
dev_id
)
...
@@ -385,7 +385,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
...
@@ -385,7 +385,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
int
ret
=
0
;
int
ret
=
0
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
raw_
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
if
(
!
(
p
->
flags
&
(
FLAG_CLOCKEVENT
|
FLAG_CLOCKSOURCE
)))
if
(
!
(
p
->
flags
&
(
FLAG_CLOCKEVENT
|
FLAG_CLOCKSOURCE
)))
ret
=
sh_cmt_enable
(
p
,
&
p
->
rate
);
ret
=
sh_cmt_enable
(
p
,
&
p
->
rate
);
...
@@ -398,7 +398,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
...
@@ -398,7 +398,7 @@ static int sh_cmt_start(struct sh_cmt_priv *p, unsigned long flag)
if
((
flag
==
FLAG_CLOCKSOURCE
)
&&
(
!
(
p
->
flags
&
FLAG_CLOCKEVENT
)))
if
((
flag
==
FLAG_CLOCKSOURCE
)
&&
(
!
(
p
->
flags
&
FLAG_CLOCKEVENT
)))
__sh_cmt_set_next
(
p
,
p
->
max_match_value
);
__sh_cmt_set_next
(
p
,
p
->
max_match_value
);
out:
out:
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
raw_
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
return
ret
;
return
ret
;
}
}
...
@@ -408,7 +408,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
...
@@ -408,7 +408,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
unsigned
long
flags
;
unsigned
long
flags
;
unsigned
long
f
;
unsigned
long
f
;
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
raw_
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
f
=
p
->
flags
&
(
FLAG_CLOCKEVENT
|
FLAG_CLOCKSOURCE
);
f
=
p
->
flags
&
(
FLAG_CLOCKEVENT
|
FLAG_CLOCKSOURCE
);
p
->
flags
&=
~
flag
;
p
->
flags
&=
~
flag
;
...
@@ -420,7 +420,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
...
@@ -420,7 +420,7 @@ static void sh_cmt_stop(struct sh_cmt_priv *p, unsigned long flag)
if
((
flag
==
FLAG_CLOCKEVENT
)
&&
(
p
->
flags
&
FLAG_CLOCKSOURCE
))
if
((
flag
==
FLAG_CLOCKEVENT
)
&&
(
p
->
flags
&
FLAG_CLOCKSOURCE
))
__sh_cmt_set_next
(
p
,
p
->
max_match_value
);
__sh_cmt_set_next
(
p
,
p
->
max_match_value
);
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
raw_
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
}
}
static
struct
sh_cmt_priv
*
cs_to_sh_cmt
(
struct
clocksource
*
cs
)
static
struct
sh_cmt_priv
*
cs_to_sh_cmt
(
struct
clocksource
*
cs
)
...
@@ -435,13 +435,13 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
...
@@ -435,13 +435,13 @@ static cycle_t sh_cmt_clocksource_read(struct clocksource *cs)
unsigned
long
value
;
unsigned
long
value
;
int
has_wrapped
;
int
has_wrapped
;
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
raw_
spin_lock_irqsave
(
&
p
->
lock
,
flags
);
value
=
p
->
total_cycles
;
value
=
p
->
total_cycles
;
raw
=
sh_cmt_get_counter
(
p
,
&
has_wrapped
);
raw
=
sh_cmt_get_counter
(
p
,
&
has_wrapped
);
if
(
unlikely
(
has_wrapped
))
if
(
unlikely
(
has_wrapped
))
raw
+=
p
->
match_value
+
1
;
raw
+=
p
->
match_value
+
1
;
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
raw_
spin_unlock_irqrestore
(
&
p
->
lock
,
flags
);
return
value
+
raw
;
return
value
+
raw
;
}
}
...
@@ -591,7 +591,7 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name,
...
@@ -591,7 +591,7 @@ static int sh_cmt_register(struct sh_cmt_priv *p, char *name,
p
->
max_match_value
=
(
1
<<
p
->
width
)
-
1
;
p
->
max_match_value
=
(
1
<<
p
->
width
)
-
1
;
p
->
match_value
=
p
->
max_match_value
;
p
->
match_value
=
p
->
max_match_value
;
spin_lock_init
(
&
p
->
lock
);
raw_
spin_lock_init
(
&
p
->
lock
);
if
(
clockevent_rating
)
if
(
clockevent_rating
)
sh_cmt_register_clockevent
(
p
,
name
,
clockevent_rating
);
sh_cmt_register_clockevent
(
p
,
name
,
clockevent_rating
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录