Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
515729ec
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
515729ec
编写于
11月 08, 2005
作者:
P
Paul Mackerras
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
powermac: Use a spinlock in swim3.c (floppy driver) instead of cli
Signed-off-by:
N
Paul Mackerras
<
paulus@samba.org
>
上级
3fb62b51
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
10 deletion
+10
-10
drivers/block/swim3.c
drivers/block/swim3.c
+10
-10
未找到文件。
drivers/block/swim3.c
浏览文件 @
515729ec
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
#include <linux/devfs_fs_kernel.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/dbdma.h>
#include <asm/dbdma.h>
#include <asm/prom.h>
#include <asm/prom.h>
...
@@ -176,6 +177,7 @@ struct swim3 {
...
@@ -176,6 +177,7 @@ struct swim3 {
struct
floppy_state
{
struct
floppy_state
{
enum
swim_state
state
;
enum
swim_state
state
;
spinlock_t
lock
;
struct
swim3
__iomem
*
swim3
;
/* hardware registers */
struct
swim3
__iomem
*
swim3
;
/* hardware registers */
struct
dbdma_regs
__iomem
*
dma
;
/* DMA controller registers */
struct
dbdma_regs
__iomem
*
dma
;
/* DMA controller registers */
int
swim3_intr
;
/* interrupt number for SWIM3 */
int
swim3_intr
;
/* interrupt number for SWIM3 */
...
@@ -304,7 +306,6 @@ static void do_fd_request(request_queue_t * q)
...
@@ -304,7 +306,6 @@ static void do_fd_request(request_queue_t * q)
#endif
/* CONFIG_PMAC_MEDIABAY */
#endif
/* CONFIG_PMAC_MEDIABAY */
start_request
(
&
floppy_states
[
i
]);
start_request
(
&
floppy_states
[
i
]);
}
}
sti
();
}
}
static
void
start_request
(
struct
floppy_state
*
fs
)
static
void
start_request
(
struct
floppy_state
*
fs
)
...
@@ -370,7 +371,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
...
@@ -370,7 +371,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
{
{
unsigned
long
flags
;
unsigned
long
flags
;
s
ave_flags
(
flags
);
cli
(
);
s
pin_lock_irqsave
(
&
fs
->
lock
,
flags
);
if
(
fs
->
timeout_pending
)
if
(
fs
->
timeout_pending
)
del_timer
(
&
fs
->
timeout
);
del_timer
(
&
fs
->
timeout
);
fs
->
timeout
.
expires
=
jiffies
+
nticks
;
fs
->
timeout
.
expires
=
jiffies
+
nticks
;
...
@@ -378,7 +379,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
...
@@ -378,7 +379,7 @@ static void set_timeout(struct floppy_state *fs, int nticks,
fs
->
timeout
.
data
=
(
unsigned
long
)
fs
;
fs
->
timeout
.
data
=
(
unsigned
long
)
fs
;
add_timer
(
&
fs
->
timeout
);
add_timer
(
&
fs
->
timeout
);
fs
->
timeout_pending
=
1
;
fs
->
timeout_pending
=
1
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
fs
->
lock
,
flags
);
}
}
static
inline
void
scan_track
(
struct
floppy_state
*
fs
)
static
inline
void
scan_track
(
struct
floppy_state
*
fs
)
...
@@ -790,14 +791,13 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
...
@@ -790,14 +791,13 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
{
{
unsigned
long
flags
;
unsigned
long
flags
;
save_flags
(
flags
);
spin_lock_irqsave
(
&
fs
->
lock
,
flags
);
cli
();
if
(
fs
->
state
!=
idle
)
{
if
(
fs
->
state
!=
idle
)
{
++
fs
->
wanted
;
++
fs
->
wanted
;
while
(
fs
->
state
!=
available
)
{
while
(
fs
->
state
!=
available
)
{
if
(
interruptible
&&
signal_pending
(
current
))
{
if
(
interruptible
&&
signal_pending
(
current
))
{
--
fs
->
wanted
;
--
fs
->
wanted
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
fs
->
lock
,
flags
);
return
-
EINTR
;
return
-
EINTR
;
}
}
interruptible_sleep_on
(
&
fs
->
wait
);
interruptible_sleep_on
(
&
fs
->
wait
);
...
@@ -805,7 +805,7 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
...
@@ -805,7 +805,7 @@ static int grab_drive(struct floppy_state *fs, enum swim_state state,
--
fs
->
wanted
;
--
fs
->
wanted
;
}
}
fs
->
state
=
state
;
fs
->
state
=
state
;
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
fs
->
lock
,
flags
);
return
0
;
return
0
;
}
}
...
@@ -813,11 +813,10 @@ static void release_drive(struct floppy_state *fs)
...
@@ -813,11 +813,10 @@ static void release_drive(struct floppy_state *fs)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
save_flags
(
flags
);
spin_lock_irqsave
(
&
fs
->
lock
,
flags
);
cli
();
fs
->
state
=
idle
;
fs
->
state
=
idle
;
start_request
(
fs
);
start_request
(
fs
);
restore_flags
(
flags
);
spin_unlock_irqrestore
(
&
fs
->
lock
,
flags
);
}
}
static
int
fd_eject
(
struct
floppy_state
*
fs
)
static
int
fd_eject
(
struct
floppy_state
*
fs
)
...
@@ -1109,6 +1108,7 @@ static int swim3_add_device(struct device_node *swim)
...
@@ -1109,6 +1108,7 @@ static int swim3_add_device(struct device_node *swim)
pmac_call_feature
(
PMAC_FTR_SWIM3_ENABLE
,
swim
,
0
,
1
);
pmac_call_feature
(
PMAC_FTR_SWIM3_ENABLE
,
swim
,
0
,
1
);
memset
(
fs
,
0
,
sizeof
(
*
fs
));
memset
(
fs
,
0
,
sizeof
(
*
fs
));
spin_lock_init
(
&
fs
->
lock
);
fs
->
state
=
idle
;
fs
->
state
=
idle
;
fs
->
swim3
=
(
struct
swim3
__iomem
*
)
fs
->
swim3
=
(
struct
swim3
__iomem
*
)
ioremap
(
swim
->
addrs
[
0
].
address
,
0x200
);
ioremap
(
swim
->
addrs
[
0
].
address
,
0x200
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录