Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
b60f38c6
Commit
b60f38c6
authored
Sep 11, 2018
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isicom: switch to ->[sg]et_serial()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
a7b06fcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
47 deletions
+25
-47
drivers/tty/isicom.c
drivers/tty/isicom.c
+25
-47
No files found.
drivers/tty/isicom.c
View file @
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
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment