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
bb6b371b
Commit
bb6b371b
authored
Jun 11, 2003
by
Alexander Viro
Committed by
Linus Torvalds
Jun 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] tty_driver refcounting
arch/cris/drivers/serial.c converted to dynamic allocation
parent
6b98d858
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
42 deletions
+39
-42
arch/cris/drivers/serial.c
arch/cris/drivers/serial.c
+39
-42
No files found.
arch/cris/drivers/serial.c
View file @
bb6b371b
...
...
@@ -335,7 +335,7 @@ static char *serial_version = "$Revision: 1.3 $";
static
DECLARE_TASK_QUEUE
(
tq_serial
);
st
ruct
tty_driver
serial_driver
;
st
atic
struct
tty_driver
*
serial_driver
;
/* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL
...
...
@@ -3419,11 +3419,36 @@ show_serial_version(void)
/* rs_init inits the driver at boot (using the module_init chain) */
static
struct
tty_operations
rs_ops
=
{
.
open
=
rs_open
,
.
close
=
rs_close
,
.
write
=
rs_write
,
.
flush_chars
=
rs_flush_chars
,
.
write_room
=
rs_write_room
,
.
chars_in_buffer
=
rs_chars_in_buffer
,
.
flush_buffer
=
rs_flush_buffer
,
.
ioctl
=
rs_ioctl
,
.
throttle
=
rs_throttle
,
.
unthrottle
=
rs_unthrottle
,
.
set_termios
=
rs_set_termios
,
.
stop
=
rs_stop
,
.
start
=
rs_start
,
.
hangup
=
rs_hangup
,
.
break_ctl
=
rs_break
,
.
send_xchar
=
rs_send_xchar
,
.
wait_until_sent
=
rs_wait_until_sent
,
.
read_proc
=
rs_read_proc
,
};
static
int
__init
rs_init
(
void
)
{
int
i
;
struct
e100_serial
*
info
;
struct
tty_driver
*
driver
=
alloc_tty_driver
(
NR_PORTS
);
if
(
!
driver
)
return
-
ENOMEM
;
show_serial_version
();
...
...
@@ -3439,48 +3464,20 @@ rs_init(void)
/* Initialize the tty_driver structure */
memset
(
&
serial_driver
,
0
,
sizeof
(
struct
tty_driver
));
serial_driver
.
magic
=
TTY_DRIVER_MAGIC
;
#if (LINUX_VERSION_CODE > 0x20100)
serial_driver
.
driver_name
=
"serial"
;
#endif
serial_driver
.
name
=
"ttyS"
;
serial_driver
.
major
=
TTY_MAJOR
;
serial_driver
.
minor_start
=
64
;
serial_driver
.
num
=
NR_PORTS
;
/* etrax100 has 4 serial ports */
serial_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
init_termios
=
tty_std_termios
;
serial_driver
.
init_termios
.
c_cflag
=
driver
->
driver_name
=
"serial"
;
driver
->
name
=
"ttyS"
;
driver
->
major
=
TTY_MAJOR
;
driver
->
minor_start
=
64
;
driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
driver
->
init_termios
=
tty_std_termios
;
driver
->
init_termios
.
c_cflag
=
B115200
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
/* is normally B9600 default... */
serial_driver
.
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
serial_driver
.
open
=
rs_open
;
serial_driver
.
close
=
rs_close
;
serial_driver
.
write
=
rs_write
;
/* should we have an rs_put_char as well here ? */
serial_driver
.
flush_chars
=
rs_flush_chars
;
serial_driver
.
write_room
=
rs_write_room
;
serial_driver
.
chars_in_buffer
=
rs_chars_in_buffer
;
serial_driver
.
flush_buffer
=
rs_flush_buffer
;
serial_driver
.
ioctl
=
rs_ioctl
;
serial_driver
.
throttle
=
rs_throttle
;
serial_driver
.
unthrottle
=
rs_unthrottle
;
serial_driver
.
set_termios
=
rs_set_termios
;
serial_driver
.
stop
=
rs_stop
;
serial_driver
.
start
=
rs_start
;
serial_driver
.
hangup
=
rs_hangup
;
#if (LINUX_VERSION_CODE >= 131394)
/* Linux 2.1.66 */
serial_driver
.
break_ctl
=
rs_break
;
#endif
#if (LINUX_VERSION_CODE >= 131343)
serial_driver
.
send_xchar
=
rs_send_xchar
;
serial_driver
.
wait_until_sent
=
rs_wait_until_sent
;
serial_driver
.
read_proc
=
rs_read_proc
;
#endif
if
(
tty_register_driver
(
&
serial_driver
))
driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
tty_set_operations
(
driver
,
&
rs_ops
);
if
(
tty_register_driver
(
driver
))
panic
(
"Couldn't register serial driver
\n
"
);
serial_driver
=
driver
;
/* do some initializing for the separate ports */
...
...
@@ -3520,7 +3517,7 @@ rs_init(void)
if
(
info
->
enabled
)
{
printk
(
KERN_INFO
"%s%d at 0x%x is a builtin UART with DMA
\n
"
,
serial_driver
.
name
,
info
->
line
,
(
unsigned
int
)
info
->
port
);
serial_driver
->
name
,
info
->
line
,
(
unsigned
int
)
info
->
port
);
}
}
...
...
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