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
Kirill Smelkov
linux
Commits
b129cbc9
Commit
b129cbc9
authored
Sep 11, 2018
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amiserial: switch to ->[sg]et_serial()
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
0aad5ad5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
45 deletions
+33
-45
drivers/tty/amiserial.c
drivers/tty/amiserial.c
+33
-45
No files found.
drivers/tty/amiserial.c
View file @
b129cbc9
...
@@ -996,63 +996,55 @@ static void rs_unthrottle(struct tty_struct * tty)
...
@@ -996,63 +996,55 @@ static void rs_unthrottle(struct tty_struct * tty)
* ------------------------------------------------------------
* ------------------------------------------------------------
*/
*/
static
int
get_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_state
*
state
,
static
int
get_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
*
ss
)
struct
serial_struct
__user
*
retinfo
)
{
{
struct
serial_struct
tmp
;
struct
serial_state
*
state
=
tty
->
driver_data
;
memset
(
&
tmp
,
0
,
sizeof
(
tmp
));
tty_lock
(
tty
);
tty_lock
(
tty
);
tmp
.
line
=
tty
->
index
;
ss
->
line
=
tty
->
index
;
tmp
.
port
=
state
->
port
;
ss
->
port
=
state
->
port
;
tmp
.
flags
=
state
->
tport
.
flags
;
ss
->
flags
=
state
->
tport
.
flags
;
tmp
.
xmit_fifo_size
=
state
->
xmit_fifo_size
;
ss
->
xmit_fifo_size
=
state
->
xmit_fifo_size
;
tmp
.
baud_base
=
state
->
baud_base
;
ss
->
baud_base
=
state
->
baud_base
;
tmp
.
close_delay
=
state
->
tport
.
close_delay
;
ss
->
close_delay
=
state
->
tport
.
close_delay
;
tmp
.
closing_wait
=
state
->
tport
.
closing_wait
;
ss
->
closing_wait
=
state
->
tport
.
closing_wait
;
tmp
.
custom_divisor
=
state
->
custom_divisor
;
ss
->
custom_divisor
=
state
->
custom_divisor
;
tty_unlock
(
tty
);
tty_unlock
(
tty
);
if
(
copy_to_user
(
retinfo
,
&
tmp
,
sizeof
(
*
retinfo
)))
return
-
EFAULT
;
return
0
;
return
0
;
}
}
static
int
set_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_state
*
state
,
static
int
set_serial_info
(
struct
tty_struct
*
tty
,
struct
serial_struct
*
ss
)
struct
serial_struct
__user
*
new_info
)
{
{
struct
serial_state
*
state
=
tty
->
driver_data
;
struct
tty_port
*
port
=
&
state
->
tport
;
struct
tty_port
*
port
=
&
state
->
tport
;
struct
serial_struct
new_serial
;
bool
change_spd
;
bool
change_spd
;
int
retval
=
0
;
int
retval
=
0
;
if
(
copy_from_user
(
&
new_serial
,
new_info
,
sizeof
(
new_serial
)))
return
-
EFAULT
;
tty_lock
(
tty
);
tty_lock
(
tty
);
change_spd
=
((
new_serial
.
flags
^
port
->
flags
)
&
ASYNC_SPD_MASK
)
||
change_spd
=
((
ss
->
flags
^
port
->
flags
)
&
ASYNC_SPD_MASK
)
||
new_serial
.
custom_divisor
!=
state
->
custom_divisor
;
ss
->
custom_divisor
!=
state
->
custom_divisor
;
if
(
new_serial
.
irq
||
new_serial
.
port
!=
state
->
port
||
if
(
ss
->
irq
||
ss
->
port
!=
state
->
port
||
new_serial
.
xmit_fifo_size
!=
state
->
xmit_fifo_size
)
{
ss
->
xmit_fifo_size
!=
state
->
xmit_fifo_size
)
{
tty_unlock
(
tty
);
tty_unlock
(
tty
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
if
(
!
serial_isroot
())
{
if
(
!
serial_isroot
())
{
if
((
new_serial
.
baud_base
!=
state
->
baud_base
)
||
if
((
ss
->
baud_base
!=
state
->
baud_base
)
||
(
new_serial
.
close_delay
!=
port
->
close_delay
)
||
(
ss
->
close_delay
!=
port
->
close_delay
)
||
(
new_serial
.
xmit_fifo_size
!=
state
->
xmit_fifo_size
)
||
(
ss
->
xmit_fifo_size
!=
state
->
xmit_fifo_size
)
||
((
new_serial
.
flags
&
~
ASYNC_USR_MASK
)
!=
((
ss
->
flags
&
~
ASYNC_USR_MASK
)
!=
(
port
->
flags
&
~
ASYNC_USR_MASK
)))
{
(
port
->
flags
&
~
ASYNC_USR_MASK
)))
{
tty_unlock
(
tty
);
tty_unlock
(
tty
);
return
-
EPERM
;
return
-
EPERM
;
}
}
port
->
flags
=
((
port
->
flags
&
~
ASYNC_USR_MASK
)
|
port
->
flags
=
((
port
->
flags
&
~
ASYNC_USR_MASK
)
|
(
new_serial
.
flags
&
ASYNC_USR_MASK
));
(
ss
->
flags
&
ASYNC_USR_MASK
));
state
->
custom_divisor
=
new_serial
.
custom_divisor
;
state
->
custom_divisor
=
ss
->
custom_divisor
;
goto
check_and_exit
;
goto
check_and_exit
;
}
}
if
(
new_serial
.
baud_base
<
9600
)
{
if
(
ss
->
baud_base
<
9600
)
{
tty_unlock
(
tty
);
tty_unlock
(
tty
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
...
@@ -1062,19 +1054,19 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
...
@@ -1062,19 +1054,19 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
* At this point, we start making changes.....
* At this point, we start making changes.....
*/
*/
state
->
baud_base
=
new_serial
.
baud_base
;
state
->
baud_base
=
ss
->
baud_base
;
port
->
flags
=
((
port
->
flags
&
~
ASYNC_FLAGS
)
|
port
->
flags
=
((
port
->
flags
&
~
ASYNC_FLAGS
)
|
(
new_serial
.
flags
&
ASYNC_FLAGS
));
(
ss
->
flags
&
ASYNC_FLAGS
));
state
->
custom_divisor
=
new_serial
.
custom_divisor
;
state
->
custom_divisor
=
ss
->
custom_divisor
;
port
->
close_delay
=
new_serial
.
close_delay
*
HZ
/
100
;
port
->
close_delay
=
ss
->
close_delay
*
HZ
/
100
;
port
->
closing_wait
=
new_serial
.
closing_wait
*
HZ
/
100
;
port
->
closing_wait
=
ss
->
closing_wait
*
HZ
/
100
;
port
->
low_latency
=
(
port
->
flags
&
ASYNC_LOW_LATENCY
)
?
1
:
0
;
port
->
low_latency
=
(
port
->
flags
&
ASYNC_LOW_LATENCY
)
?
1
:
0
;
check_and_exit:
check_and_exit:
if
(
tty_port_initialized
(
port
))
{
if
(
tty_port_initialized
(
port
))
{
if
(
change_spd
)
{
if
(
change_spd
)
{
/* warn about deprecation unless clearing */
/* warn about deprecation unless clearing */
if
(
new_serial
.
flags
&
ASYNC_SPD_MASK
)
if
(
ss
->
flags
&
ASYNC_SPD_MASK
)
dev_warn_ratelimited
(
tty
->
dev
,
"use of SPD flags is deprecated
\n
"
);
dev_warn_ratelimited
(
tty
->
dev
,
"use of SPD flags is deprecated
\n
"
);
change_speed
(
tty
,
state
,
NULL
);
change_speed
(
tty
,
state
,
NULL
);
}
}
...
@@ -1084,7 +1076,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
...
@@ -1084,7 +1076,6 @@ static int set_serial_info(struct tty_struct *tty, struct serial_state *state,
return
retval
;
return
retval
;
}
}
/*
/*
* get_lsr_info - get line status register info
* get_lsr_info - get line status register info
*
*
...
@@ -1224,18 +1215,13 @@ static int rs_ioctl(struct tty_struct *tty,
...
@@ -1224,18 +1215,13 @@ static int rs_ioctl(struct tty_struct *tty,
if
(
serial_paranoia_check
(
info
,
tty
->
name
,
"rs_ioctl"
))
if
(
serial_paranoia_check
(
info
,
tty
->
name
,
"rs_ioctl"
))
return
-
ENODEV
;
return
-
ENODEV
;
if
((
cmd
!=
TIOCGSERIAL
)
&&
(
cmd
!=
TIOCSSERIAL
)
&&
if
((
cmd
!=
TIOCSERCONFIG
)
&&
(
cmd
!=
TIOCSERGSTRUCT
)
&&
(
cmd
!=
TIOCSERCONFIG
)
&&
(
cmd
!=
TIOCSERGSTRUCT
)
&&
(
cmd
!=
TIOCMIWAIT
)
&&
(
cmd
!=
TIOCGICOUNT
))
{
(
cmd
!=
TIOCMIWAIT
)
&&
(
cmd
!=
TIOCGICOUNT
))
{
if
(
tty_io_error
(
tty
))
if
(
tty_io_error
(
tty
))
return
-
EIO
;
return
-
EIO
;
}
}
switch
(
cmd
)
{
switch
(
cmd
)
{
case
TIOCGSERIAL
:
return
get_serial_info
(
tty
,
info
,
argp
);
case
TIOCSSERIAL
:
return
set_serial_info
(
tty
,
info
,
argp
);
case
TIOCSERCONFIG
:
case
TIOCSERCONFIG
:
return
0
;
return
0
;
...
@@ -1607,6 +1593,8 @@ static const struct tty_operations serial_ops = {
...
@@ -1607,6 +1593,8 @@ static const struct tty_operations serial_ops = {
.
tiocmget
=
rs_tiocmget
,
.
tiocmget
=
rs_tiocmget
,
.
tiocmset
=
rs_tiocmset
,
.
tiocmset
=
rs_tiocmset
,
.
get_icount
=
rs_get_icount
,
.
get_icount
=
rs_get_icount
,
.
set_serial
=
set_serial_info
,
.
get_serial
=
get_serial_info
,
.
proc_show
=
rs_proc_show
,
.
proc_show
=
rs_proc_show
,
};
};
...
...
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