Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
ea2959a2
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
169
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ea2959a2
编写于
5月 15, 2008
作者:
J
Jonathan Corbet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
paride: cdev lock_kernel() pushdown
Signed-off-by:
N
Jonathan Corbet
<
corbet@lwn.net
>
上级
579174a5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
23 addition
and
7 deletion
+23
-7
drivers/block/paride/pg.c
drivers/block/paride/pg.c
+16
-6
drivers/block/paride/pt.c
drivers/block/paride/pt.c
+7
-1
未找到文件。
drivers/block/paride/pg.c
浏览文件 @
ea2959a2
...
@@ -162,6 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
...
@@ -162,6 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
#include <linux/pg.h>
#include <linux/pg.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/sched.h>
/* current, TASK_* */
#include <linux/sched.h>
/* current, TASK_* */
#include <linux/smp_lock.h>
#include <linux/jiffies.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
...
@@ -515,12 +516,18 @@ static int pg_open(struct inode *inode, struct file *file)
...
@@ -515,12 +516,18 @@ static int pg_open(struct inode *inode, struct file *file)
{
{
int
unit
=
iminor
(
inode
)
&
0x7f
;
int
unit
=
iminor
(
inode
)
&
0x7f
;
struct
pg
*
dev
=
&
devices
[
unit
];
struct
pg
*
dev
=
&
devices
[
unit
];
int
ret
=
0
;
if
((
unit
>=
PG_UNITS
)
||
(
!
dev
->
present
))
lock_kernel
();
return
-
ENODEV
;
if
((
unit
>=
PG_UNITS
)
||
(
!
dev
->
present
))
{
ret
=
-
ENODEV
;
goto
out
;
}
if
(
test_and_set_bit
(
0
,
&
dev
->
access
))
if
(
test_and_set_bit
(
0
,
&
dev
->
access
))
{
return
-
EBUSY
;
ret
=
-
EBUSY
;
goto
out
;
}
if
(
dev
->
busy
)
{
if
(
dev
->
busy
)
{
pg_reset
(
dev
);
pg_reset
(
dev
);
...
@@ -533,12 +540,15 @@ static int pg_open(struct inode *inode, struct file *file)
...
@@ -533,12 +540,15 @@ static int pg_open(struct inode *inode, struct file *file)
if
(
dev
->
bufptr
==
NULL
)
{
if
(
dev
->
bufptr
==
NULL
)
{
clear_bit
(
0
,
&
dev
->
access
);
clear_bit
(
0
,
&
dev
->
access
);
printk
(
"%s: buffer allocation failed
\n
"
,
dev
->
name
);
printk
(
"%s: buffer allocation failed
\n
"
,
dev
->
name
);
return
-
ENOMEM
;
ret
=
-
ENOMEM
;
goto
out
;
}
}
file
->
private_data
=
dev
;
file
->
private_data
=
dev
;
return
0
;
out:
unlock_kernel
();
return
ret
;
}
}
static
int
pg_release
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
pg_release
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
drivers/block/paride/pt.c
浏览文件 @
ea2959a2
...
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
...
@@ -146,6 +146,7 @@ static int (*drives[4])[6] = {&drive0, &drive1, &drive2, &drive3};
#include <linux/mtio.h>
#include <linux/mtio.h>
#include <linux/device.h>
#include <linux/device.h>
#include <linux/sched.h>
/* current, TASK_*, schedule_timeout() */
#include <linux/sched.h>
/* current, TASK_*, schedule_timeout() */
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
...
@@ -650,8 +651,11 @@ static int pt_open(struct inode *inode, struct file *file)
...
@@ -650,8 +651,11 @@ static int pt_open(struct inode *inode, struct file *file)
struct
pt_unit
*
tape
=
pt
+
unit
;
struct
pt_unit
*
tape
=
pt
+
unit
;
int
err
;
int
err
;
if
(
unit
>=
PT_UNITS
||
(
!
tape
->
present
))
lock_kernel
();
if
(
unit
>=
PT_UNITS
||
(
!
tape
->
present
))
{
unlock_kernel
();
return
-
ENODEV
;
return
-
ENODEV
;
}
err
=
-
EBUSY
;
err
=
-
EBUSY
;
if
(
!
atomic_dec_and_test
(
&
tape
->
available
))
if
(
!
atomic_dec_and_test
(
&
tape
->
available
))
...
@@ -678,10 +682,12 @@ static int pt_open(struct inode *inode, struct file *file)
...
@@ -678,10 +682,12 @@ static int pt_open(struct inode *inode, struct file *file)
}
}
file
->
private_data
=
tape
;
file
->
private_data
=
tape
;
unlock_kernel
();
return
0
;
return
0
;
out:
out:
atomic_inc
(
&
tape
->
available
);
atomic_inc
(
&
tape
->
available
);
unlock_kernel
();
return
err
;
return
err
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录