Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
b98e5a67
K
Kernel
项目概览
openeuler
/
Kernel
2 年多 前同步成功
通知
9
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b98e5a67
编写于
9月 11, 2018
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fwserial: switch to ->[sg]et_serial()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
617a2811
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
38 deletion
+28
-38
drivers/staging/fwserial/fwserial.c
drivers/staging/fwserial/fwserial.c
+28
-38
未找到文件。
drivers/staging/fwserial/fwserial.c
浏览文件 @
b98e5a67
...
...
@@ -1209,42 +1209,40 @@ static int wait_msr_change(struct fwtty_port *port, unsigned long mask)
check_msr_delta
(
port
,
mask
,
&
prev
));
}
static
int
get_serial_info
(
struct
fwtty_port
*
port
,
struct
serial_struct
__user
*
info
)
static
int
get_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
*
ss
)
{
struct
serial_struct
tmp
;
memset
(
&
tmp
,
0
,
sizeof
(
tmp
));
tmp
.
type
=
PORT_UNKNOWN
;
tmp
.
line
=
port
->
port
.
tty
->
index
;
tmp
.
flags
=
port
->
port
.
flags
;
tmp
.
xmit_fifo_size
=
FWTTY_PORT_TXFIFO_LEN
;
tmp
.
baud_base
=
400000000
;
tmp
.
close_delay
=
port
->
port
.
close_delay
;
return
(
copy_to_user
(
info
,
&
tmp
,
sizeof
(
*
info
)))
?
-
EFAULT
:
0
;
struct
fwtty_port
*
port
=
tty
->
driver_data
;
mutex_lock
(
&
port
->
port
.
mutex
);
ss
->
type
=
PORT_UNKNOWN
;
ss
->
line
=
port
->
port
.
tty
->
index
;
ss
->
flags
=
port
->
port
.
flags
;
ss
->
xmit_fifo_size
=
FWTTY_PORT_TXFIFO_LEN
;
ss
->
baud_base
=
400000000
;
ss
->
close_delay
=
port
->
port
.
close_delay
;
mutex_unlock
(
&
port
->
port
.
mutex
);
return
0
;
}
static
int
set_serial_info
(
struct
fwtty_port
*
port
,
struct
serial_struct
__user
*
info
)
static
int
set_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
*
ss
)
{
struct
serial_struct
tmp
;
if
(
copy_from_user
(
&
tmp
,
info
,
sizeof
(
tmp
)))
return
-
EFAULT
;
struct
fwtty_port
*
port
=
tty
->
driver_data
;
if
(
tmp
.
irq
!=
0
||
tmp
.
port
!=
0
||
tmp
.
custom_divisor
!=
0
||
tmp
.
baud_base
!=
400000000
)
if
(
ss
->
irq
!=
0
||
ss
->
port
!=
0
||
ss
->
custom_divisor
!=
0
||
ss
->
baud_base
!=
400000000
)
return
-
EPERM
;
mutex_lock
(
&
port
->
port
.
mutex
);
if
(
!
capable
(
CAP_SYS_ADMIN
))
{
if
(((
tmp
.
flags
&
~
ASYNC_USR_MASK
)
!=
(
port
->
port
.
flags
&
~
ASYNC_USR_MASK
)))
if
(((
ss
->
flags
&
~
ASYNC_USR_MASK
)
!=
(
port
->
port
.
flags
&
~
ASYNC_USR_MASK
)))
{
mutex_unlock
(
&
port
->
port
.
mutex
);
return
-
EPERM
;
}
else
{
port
->
port
.
close_delay
=
tmp
.
close_delay
*
HZ
/
100
;
}
}
port
->
port
.
close_delay
=
ss
->
close_delay
*
HZ
/
100
;
mutex_unlock
(
&
port
->
port
.
mutex
);
return
0
;
}
...
...
@@ -1256,18 +1254,6 @@ static int fwtty_ioctl(struct tty_struct *tty, unsigned int cmd,
int
err
;
switch
(
cmd
)
{
case
TIOCGSERIAL
:
mutex_lock
(
&
port
->
port
.
mutex
);
err
=
get_serial_info
(
port
,
(
void
__user
*
)
arg
);
mutex_unlock
(
&
port
->
port
.
mutex
);
break
;
case
TIOCSSERIAL
:
mutex_lock
(
&
port
->
port
.
mutex
);
err
=
set_serial_info
(
port
,
(
void
__user
*
)
arg
);
mutex_unlock
(
&
port
->
port
.
mutex
);
break
;
case
TIOCMIWAIT
:
err
=
wait_msr_change
(
port
,
arg
);
break
;
...
...
@@ -1557,6 +1543,8 @@ static const struct tty_operations fwtty_ops = {
.
tiocmget
=
fwtty_tiocmget
,
.
tiocmset
=
fwtty_tiocmset
,
.
get_icount
=
fwtty_get_icount
,
.
set_serial
=
set_serial_info
,
.
get_serial
=
get_serial_info
,
.
proc_show
=
fwtty_proc_show
,
};
...
...
@@ -1578,6 +1566,8 @@ static const struct tty_operations fwloop_ops = {
.
tiocmget
=
fwtty_tiocmget
,
.
tiocmset
=
fwtty_tiocmset
,
.
get_icount
=
fwtty_get_icount
,
.
set_serial
=
set_serial_info
,
.
get_serial
=
get_serial_info
,
};
static
inline
int
mgmt_pkt_expected_len
(
__be16
code
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录