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
af0076e5
Commit
af0076e5
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
drivers/char/serial_tx3912.c converted to dynamic allocation
parent
44eeac38
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
32 deletions
+35
-32
drivers/char/serial_tx3912.c
drivers/char/serial_tx3912.c
+35
-32
No files found.
drivers/char/serial_tx3912.c
View file @
af0076e5
...
...
@@ -59,7 +59,7 @@ static struct real_driver rs_real_driver = {
/*
* Structures and such for TTY sessions and usage counts
*/
static
struct
tty_driver
rs_driver
;
static
struct
tty_driver
*
rs_driver
;
struct
rs_port
*
rs_ports
;
int
rs_initialized
=
0
;
...
...
@@ -764,45 +764,48 @@ static int rs_init_portstructs(void)
return
0
;
}
static
struct
tty_operations
rs_ops
=
{
.
open
=
rs_open
,
.
close
=
gs_close
,
.
write
=
gs_write
,
.
put_char
=
gs_put_char
,
.
flush_chars
=
gs_flush_chars
,
.
write_room
=
gs_write_room
,
.
chars_in_buffer
=
gs_chars_in_buffer
,
.
flush_buffer
=
gs_flush_buffer
,
.
ioctl
=
rs_ioctl
,
.
throttle
=
rs_throttle
,
.
unthrottle
=
rs_unthrottle
,
.
set_termios
=
gs_set_termios
,
.
stop
=
gs_stop
,
.
start
=
gs_start
,
.
hangup
=
gs_hangup
,
};
static
int
rs_init_drivers
(
void
)
{
int
error
;
func_enter
();
memset
(
&
rs_driver
,
0
,
sizeof
(
rs_driver
)
);
rs_driver
.
magic
=
TTY_DRIVER_MAGIC
;
rs_driver
.
owner
=
THIS_MODULE
;
rs_driver
.
driver_name
=
"serial"
;
rs_driver
.
name
=
"ttyS
"
;
rs_driver
.
major
=
TTY_MAJOR
;
rs_driver
.
minor_start
=
64
;
rs_driver
.
num
=
TX3912_UART_NPORTS
;
rs_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
rs_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
rs_driver
.
init_termios
=
tty_std_termios
;
rs_driver
.
init_termios
.
c_cflag
=
rs_driver
=
alloc_tty_driver
(
TX3912_UART_NPORTS
);
if
(
!
rs_driver
)
return
-
ENOMEM
;
rs_driver
->
owner
=
THIS_MODULE
;
rs_driver
->
driver_name
=
"serial
"
;
rs_driver
->
name
=
"ttyS"
;
rs_driver
->
major
=
TTY_MAJOR
;
rs_driver
->
minor_start
=
64
;
rs_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
rs_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
rs_driver
->
init_termios
=
tty_std_termios
;
rs_driver
->
init_termios
.
c_cflag
=
B115200
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rs_driver
.
open
=
rs_open
;
rs_driver
.
close
=
gs_close
;
rs_driver
.
write
=
gs_write
;
rs_driver
.
put_char
=
gs_put_char
;
rs_driver
.
flush_chars
=
gs_flush_chars
;
rs_driver
.
write_room
=
gs_write_room
;
rs_driver
.
chars_in_buffer
=
gs_chars_in_buffer
;
rs_driver
.
flush_buffer
=
gs_flush_buffer
;
rs_driver
.
ioctl
=
rs_ioctl
;
rs_driver
.
throttle
=
rs_throttle
;
rs_driver
.
unthrottle
=
rs_unthrottle
;
rs_driver
.
set_termios
=
gs_set_termios
;
rs_driver
.
stop
=
gs_stop
;
rs_driver
.
start
=
gs_start
;
rs_driver
.
hangup
=
gs_hangup
;
if
((
error
=
tty_register_driver
(
&
rs_driver
)))
{
tty_set_operations
(
rs_driver
,
&
rs_ops
);
if
((
error
=
tty_register_driver
(
rs_driver
)))
{
printk
(
KERN_ERR
"Couldn't register serial driver, error = %d
\n
"
,
error
);
put_tty_driver
(
rs_driver
);
return
1
;
}
return
0
;
...
...
@@ -924,7 +927,7 @@ static void serial_console_write(struct console *co, const char *s,
static
struct
tty_driver
*
serial_console_device
(
struct
console
*
c
,
int
*
index
)
{
*
index
=
c
->
index
;
return
&
rs_driver
;
return
rs_driver
;
}
static
__init
int
serial_console_setup
(
struct
console
*
co
,
char
*
options
)
...
...
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