Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
1bbfc20d
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1bbfc20d
编写于
9月 29, 2009
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MIPS: VPE: Get rid of BKL.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
c0648e02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
42 deletion
+50
-42
arch/mips/kernel/rtlx.c
arch/mips/kernel/rtlx.c
+4
-11
arch/mips/kernel/vpe.c
arch/mips/kernel/vpe.c
+46
-31
未找到文件。
arch/mips/kernel/rtlx.c
浏览文件 @
1bbfc20d
...
...
@@ -72,8 +72,9 @@ static void rtlx_dispatch(void)
*/
static
irqreturn_t
rtlx_interrupt
(
int
irq
,
void
*
dev_id
)
{
unsigned
int
vpeflags
;
unsigned
long
flags
;
int
i
;
unsigned
int
flags
,
vpeflags
;
/* Ought not to be strictly necessary for SMTC builds */
local_irq_save
(
flags
);
...
...
@@ -392,20 +393,12 @@ ssize_t rtlx_write(int index, const void __user *buffer, size_t count)
static
int
file_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
int
minor
=
iminor
(
inode
);
int
err
;
lock_kernel
();
err
=
rtlx_open
(
minor
,
(
filp
->
f_flags
&
O_NONBLOCK
)
?
0
:
1
);
unlock_kernel
();
return
err
;
return
rtlx_open
(
iminor
(
inode
),
(
filp
->
f_flags
&
O_NONBLOCK
)
?
0
:
1
);
}
static
int
file_release
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
int
minor
=
iminor
(
inode
);
return
rtlx_release
(
minor
);
return
rtlx_release
(
iminor
(
inode
));
}
static
unsigned
int
file_poll
(
struct
file
*
file
,
poll_table
*
wait
)
...
...
arch/mips/kernel/vpe.c
浏览文件 @
1bbfc20d
...
...
@@ -144,14 +144,15 @@ struct tc {
};
struct
{
/* Virtual processing elements */
struct
list_head
vpe_list
;
/* Thread contexts */
struct
list_head
tc_list
;
spinlock_t
vpe_list_lock
;
struct
list_head
vpe_list
;
/* Virtual processing elements */
spinlock_t
tc_list_lock
;
struct
list_head
tc_list
;
/* Thread contexts */
}
vpecontrol
=
{
.
vpe_list
=
LIST_HEAD_INIT
(
vpecontrol
.
vpe_list
),
.
tc_list
=
LIST_HEAD_INIT
(
vpecontrol
.
tc_list
)
.
vpe_list_lock
=
SPIN_LOCK_UNLOCKED
,
.
vpe_list
=
LIST_HEAD_INIT
(
vpecontrol
.
vpe_list
),
.
tc_list_lock
=
SPIN_LOCK_UNLOCKED
,
.
tc_list
=
LIST_HEAD_INIT
(
vpecontrol
.
tc_list
)
};
static
void
release_progmem
(
void
*
ptr
);
...
...
@@ -159,28 +160,38 @@ static void release_progmem(void *ptr);
/* get the vpe associated with this minor */
static
struct
vpe
*
get_vpe
(
int
minor
)
{
struct
vpe
*
v
;
struct
vpe
*
res
,
*
v
;
if
(
!
cpu_has_mipsmt
)
return
NULL
;
res
=
NULL
;
spin_lock
(
&
vpecontrol
.
vpe_list_lock
);
list_for_each_entry
(
v
,
&
vpecontrol
.
vpe_list
,
list
)
{
if
(
v
->
minor
==
minor
)
return
v
;
if
(
v
->
minor
==
minor
)
{
res
=
v
;
break
;
}
}
spin_unlock
(
&
vpecontrol
.
vpe_list_lock
);
return
NULL
;
return
res
;
}
/* get the vpe associated with this minor */
static
struct
tc
*
get_tc
(
int
index
)
{
struct
tc
*
t
;
struct
tc
*
res
,
*
t
;
res
=
NULL
;
spin_lock
(
&
vpecontrol
.
tc_list_lock
);
list_for_each_entry
(
t
,
&
vpecontrol
.
tc_list
,
list
)
{
if
(
t
->
index
==
index
)
return
t
;
if
(
t
->
index
==
index
)
{
res
=
t
;
break
;
}
}
spin_unlock
(
&
vpecontrol
.
tc_list_lock
);
return
NULL
;
}
...
...
@@ -190,15 +201,17 @@ static struct vpe *alloc_vpe(int minor)
{
struct
vpe
*
v
;
if
((
v
=
kzalloc
(
sizeof
(
struct
vpe
),
GFP_KERNEL
))
==
NULL
)
{
if
((
v
=
kzalloc
(
sizeof
(
struct
vpe
),
GFP_KERNEL
))
==
NULL
)
return
NULL
;
}
INIT_LIST_HEAD
(
&
v
->
tc
);
spin_lock
(
&
vpecontrol
.
vpe_list_lock
);
list_add_tail
(
&
v
->
list
,
&
vpecontrol
.
vpe_list
);
spin_unlock
(
&
vpecontrol
.
vpe_list_lock
);
INIT_LIST_HEAD
(
&
v
->
notify
);
v
->
minor
=
minor
;
return
v
;
}
...
...
@@ -212,7 +225,10 @@ static struct tc *alloc_tc(int index)
INIT_LIST_HEAD
(
&
tc
->
tc
);
tc
->
index
=
index
;
spin_lock
(
&
vpecontrol
.
tc_list_lock
);
list_add_tail
(
&
tc
->
list
,
&
vpecontrol
.
tc_list
);
spin_unlock
(
&
vpecontrol
.
tc_list_lock
);
out:
return
tc
;
...
...
@@ -227,7 +243,7 @@ static void release_vpe(struct vpe *v)
kfree
(
v
);
}
static
void
dump_mtregs
(
void
)
static
void
__maybe_unused
dump_mtregs
(
void
)
{
unsigned
long
val
;
...
...
@@ -1048,20 +1064,19 @@ static int vpe_open(struct inode *inode, struct file *filp)
enum
vpe_state
state
;
struct
vpe_notifications
*
not
;
struct
vpe
*
v
;
int
ret
,
err
=
0
;
int
ret
;
lock_kernel
();
if
(
minor
!=
iminor
(
inode
))
{
/* assume only 1 device at the moment. */
pr
intk
(
KERN_WARNING
"VPE loader: only vpe1 is supported
\n
"
);
err
=
-
ENODEV
;
goto
out
;
pr
_warning
(
"VPE loader: only vpe1 is supported
\n
"
);
return
-
ENODEV
;
}
if
((
v
=
get_vpe
(
tclimit
))
==
NULL
)
{
pr
intk
(
KERN_WARNING
"VPE loader: unable to get vpe
\n
"
);
err
=
-
ENODEV
;
goto
out
;
pr
_warning
(
"VPE loader: unable to get vpe
\n
"
);
return
-
ENODEV
;
}
state
=
xchg
(
&
v
->
state
,
VPE_STATE_INUSE
);
...
...
@@ -1101,8 +1116,8 @@ static int vpe_open(struct inode *inode, struct file *filp)
v
->
shared_ptr
=
NULL
;
v
->
__start
=
0
;
out:
unlock_kernel
();
return
0
;
}
...
...
@@ -1594,14 +1609,14 @@ static void __exit vpe_module_exit(void)
{
struct
vpe
*
v
,
*
n
;
device_del
(
&
vpe_device
);
unregister_chrdev
(
major
,
module_name
);
/* No locking needed here */
list_for_each_entry_safe
(
v
,
n
,
&
vpecontrol
.
vpe_list
,
list
)
{
if
(
v
->
state
!=
VPE_STATE_UNUSED
)
{
if
(
v
->
state
!=
VPE_STATE_UNUSED
)
release_vpe
(
v
);
}
}
device_del
(
&
vpe_device
);
unregister_chrdev
(
major
,
module_name
);
}
module_init
(
vpe_module_init
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录