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
1684b20f
Commit
1684b20f
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/mips/baget/vacserial.c converted to dynamic allocation
parent
71d84158
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
37 deletions
+42
-37
arch/mips/baget/vacserial.c
arch/mips/baget/vacserial.c
+42
-37
No files found.
arch/mips/baget/vacserial.c
View file @
1684b20f
...
...
@@ -29,7 +29,7 @@
#if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT)
#define DBG_CNT(s) baget_printk("(%s):[%x] refc=%d, serc=%d, ttyc=%d-> %s\n", \
tty->name,(info->flags),serial_driver
.
refcount,info->count,tty->count,s)
tty->name,(info->flags),serial_driver
->
refcount,info->count,tty->count,s)
#else
#define DBG_CNT(s)
#endif
...
...
@@ -95,7 +95,7 @@ static char *serial_version = "4.26";
static
DECLARE_TASK_QUEUE
(
tq_serial
);
static
struct
tty_driver
serial_driver
;
static
struct
tty_driver
*
serial_driver
;
/* number of characters left in xmit buffer before we ask for more */
#define WAKEUP_CHARS 256
...
...
@@ -2252,6 +2252,28 @@ static void rs_timer(unsigned long dummy)
}
}
static
struct
tty_operations
rs_ops
=
{
.
open
=
rs_open
,
.
close
=
rs_close
,
.
write
=
rs_write
,
.
put_char
=
rs_put_char
,
.
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
,
.
send_xchar
=
rs_send_xchar
,
.
set_termios
=
rs_set_termios
,
.
stop
=
rs_stop
,
.
start
=
rs_start
,
.
hangup
=
rs_hangup
,
.
break_ctl
=
rs_break
,
.
wait_until_sent
=
rs_wait_until_sent
,
.
read_proc
=
rs_read_proc
,
};
/*
* The serial driver boot-time initialization code!
*/
...
...
@@ -2300,45 +2322,27 @@ int __init rs_init(void)
#endif
#endif
serial_driver
=
alloc_tty_driver
(
NR_PORTS
);
if
(
!
serial_driver
)
return
-
ENOMEM
;
show_serial_version
();
/* Initialize the tty_driver structure */
memset
(
&
serial_driver
,
0
,
sizeof
(
struct
tty_driver
));
serial_driver
.
magic
=
TTY_DRIVER_MAGIC
;
serial_driver
.
driver_name
=
"serial"
;
serial_driver
.
name
=
"ttyS"
;
serial_driver
.
major
=
TTY_MAJOR
;
serial_driver
.
minor_start
=
64
;
serial_driver
.
num
=
NR_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
=
serial_driver
->
driver_name
=
"serial"
;
serial_driver
->
name
=
"ttyS"
;
serial_driver
->
major
=
TTY_MAJOR
;
serial_driver
->
minor_start
=
64
;
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
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
serial_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
serial_driver
.
open
=
rs_open
;
serial_driver
.
close
=
rs_close
;
serial_driver
.
write
=
rs_write
;
serial_driver
.
put_char
=
rs_put_char
;
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
.
send_xchar
=
rs_send_xchar
;
serial_driver
.
set_termios
=
rs_set_termios
;
serial_driver
.
stop
=
rs_stop
;
serial_driver
.
start
=
rs_start
;
serial_driver
.
hangup
=
rs_hangup
;
serial_driver
.
break_ctl
=
rs_break
;
serial_driver
.
wait_until_sent
=
rs_wait_until_sent
;
serial_driver
.
read_proc
=
rs_read_proc
;
if
(
tty_register_driver
(
&
serial_driver
))
serial_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
serial_driver
,
&
rs_ops
);
if
(
tty_register_driver
(
serial_driver
))
panic
(
"Couldn't register serial driver
\n
"
);
for
(
i
=
0
,
state
=
rs_table
;
i
<
NR_PORTS
;
i
++
,
state
++
)
{
...
...
@@ -2460,10 +2464,11 @@ void cleanup_module(void)
del_timer_sync
(
&
vacs_timer
);
remove_bh
(
SERIAL_BH
);
if
((
e1
=
tty_unregister_driver
(
&
serial_driver
)))
if
((
e1
=
tty_unregister_driver
(
serial_driver
)))
printk
(
"SERIAL: failed to unregister serial driver (%d)
\n
"
,
e1
);
restore_flags
(
flags
);
put_tty_driver
(
serial_driver
);
for
(
i
=
0
;
i
<
NR_PORTS
;
i
++
)
{
if
(
rs_table
[
i
].
type
!=
PORT_UNKNOWN
)
...
...
@@ -2551,7 +2556,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
&
serial_driver
;
return
serial_driver
;
}
/*
...
...
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