Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
b60f38c6
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,发现更多精彩内容 >>
提交
b60f38c6
编写于
9月 11, 2018
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
isicom: switch to ->[sg]et_serial()
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
a7b06fcf
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
47 deletion
+25
-47
drivers/tty/isicom.c
drivers/tty/isicom.c
+25
-47
未找到文件。
drivers/tty/isicom.c
浏览文件 @
b60f38c6
...
...
@@ -1091,34 +1091,33 @@ static int isicom_tiocmset(struct tty_struct *tty,
}
static
int
isicom_set_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
__user
*
info
)
struct
serial_struct
*
ss
)
{
struct
isi_port
*
port
=
tty
->
driver_data
;
struct
serial_struct
newinfo
;
int
reconfig_port
;
if
(
copy_from_user
(
&
newinfo
,
info
,
sizeof
(
newinfo
)
))
return
-
E
FAULT
;
if
(
isicom_paranoia_check
(
port
,
tty
->
name
,
"isicom_ioctl"
))
return
-
E
NODEV
;
mutex_lock
(
&
port
->
port
.
mutex
);
reconfig_port
=
((
port
->
port
.
flags
&
ASYNC_SPD_MASK
)
!=
(
newinfo
.
flags
&
ASYNC_SPD_MASK
));
(
ss
->
flags
&
ASYNC_SPD_MASK
));
if
(
!
capable
(
CAP_SYS_ADMIN
))
{
if
((
newinfo
.
close_delay
!=
port
->
port
.
close_delay
)
||
(
newinfo
.
closing_wait
!=
port
->
port
.
closing_wait
)
||
((
newinfo
.
flags
&
~
ASYNC_USR_MASK
)
!=
if
((
ss
->
close_delay
!=
port
->
port
.
close_delay
)
||
(
ss
->
closing_wait
!=
port
->
port
.
closing_wait
)
||
((
ss
->
flags
&
~
ASYNC_USR_MASK
)
!=
(
port
->
port
.
flags
&
~
ASYNC_USR_MASK
)))
{
mutex_unlock
(
&
port
->
port
.
mutex
);
return
-
EPERM
;
}
port
->
port
.
flags
=
((
port
->
port
.
flags
&
~
ASYNC_USR_MASK
)
|
(
newinfo
.
flags
&
ASYNC_USR_MASK
));
(
ss
->
flags
&
ASYNC_USR_MASK
));
}
else
{
port
->
port
.
close_delay
=
newinfo
.
close_delay
;
port
->
port
.
closing_wait
=
newinfo
.
closing_wait
;
port
->
port
.
close_delay
=
ss
->
close_delay
;
port
->
port
.
closing_wait
=
ss
->
closing_wait
;
port
->
port
.
flags
=
((
port
->
port
.
flags
&
~
ASYNC_FLAGS
)
|
(
newinfo
.
flags
&
ASYNC_FLAGS
));
(
ss
->
flags
&
ASYNC_FLAGS
));
}
if
(
reconfig_port
)
{
unsigned
long
flags
;
...
...
@@ -1130,46 +1129,24 @@ static int isicom_set_serial_info(struct tty_struct *tty,
return
0
;
}
static
int
isicom_get_serial_info
(
struct
isi_port
*
port
,
struct
serial_struct
__user
*
info
)
{
struct
serial_struct
out_info
;
mutex_lock
(
&
port
->
port
.
mutex
);
memset
(
&
out_info
,
0
,
sizeof
(
out_info
));
/* out_info.type = ? */
out_info
.
line
=
port
-
isi_ports
;
out_info
.
port
=
port
->
card
->
base
;
out_info
.
irq
=
port
->
card
->
irq
;
out_info
.
flags
=
port
->
port
.
flags
;
/* out_info.baud_base = ? */
out_info
.
close_delay
=
port
->
port
.
close_delay
;
out_info
.
closing_wait
=
port
->
port
.
closing_wait
;
mutex_unlock
(
&
port
->
port
.
mutex
);
if
(
copy_to_user
(
info
,
&
out_info
,
sizeof
(
out_info
)))
return
-
EFAULT
;
return
0
;
}
static
int
isicom_ioctl
(
struct
tty_struct
*
tty
,
unsigned
int
cmd
,
unsigned
long
arg
)
static
int
isicom_get_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
*
ss
)
{
struct
isi_port
*
port
=
tty
->
driver_data
;
void
__user
*
argp
=
(
void
__user
*
)
arg
;
if
(
isicom_paranoia_check
(
port
,
tty
->
name
,
"isicom_ioctl"
))
return
-
ENODEV
;
switch
(
cmd
)
{
case
TIOCGSERIAL
:
return
isicom_get_serial_info
(
port
,
argp
)
;
case
TIOCSSERIAL
:
return
isicom_set_serial_info
(
tty
,
argp
)
;
default:
return
-
ENOIOCTLCMD
;
}
mutex_lock
(
&
port
->
port
.
mutex
);
/* ss->type = ? */
ss
->
line
=
port
-
isi_ports
;
ss
->
port
=
port
->
card
->
base
;
ss
->
irq
=
port
->
card
->
irq
;
ss
->
flags
=
port
->
port
.
flags
;
/* ss->baud_base = ? */
ss
->
close_delay
=
port
->
port
.
close_delay
;
ss
->
closing_wait
=
port
->
port
.
closing_wait
;
mutex_unlock
(
&
port
->
port
.
mutex
);
return
0
;
}
...
...
@@ -1273,7 +1250,6 @@ static const struct tty_operations isicom_ops = {
.
flush_chars
=
isicom_flush_chars
,
.
write_room
=
isicom_write_room
,
.
chars_in_buffer
=
isicom_chars_in_buffer
,
.
ioctl
=
isicom_ioctl
,
.
set_termios
=
isicom_set_termios
,
.
throttle
=
isicom_throttle
,
.
unthrottle
=
isicom_unthrottle
,
...
...
@@ -1284,6 +1260,8 @@ static const struct tty_operations isicom_ops = {
.
tiocmget
=
isicom_tiocmget
,
.
tiocmset
=
isicom_tiocmset
,
.
break_ctl
=
isicom_send_break
,
.
get_serial
=
isicom_get_serial_info
,
.
set_serial
=
isicom_set_serial_info
,
};
static
const
struct
tty_port_operations
isicom_port_ops
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录