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
568b33db
Commit
568b33db
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/tc/zs.c converted to dynamic allocation
parent
4b1fa7e1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
36 deletions
+39
-36
drivers/tc/zs.c
drivers/tc/zs.c
+39
-36
No files found.
drivers/tc/zs.c
View file @
568b33db
...
@@ -180,7 +180,7 @@ static unsigned char zs_init_regs[16] __initdata = {
...
@@ -180,7 +180,7 @@ static unsigned char zs_init_regs[16] __initdata = {
DECLARE_TASK_QUEUE
(
tq_zs_serial
);
DECLARE_TASK_QUEUE
(
tq_zs_serial
);
st
ruct
tty_driver
serial_driver
;
st
atic
struct
tty_driver
*
serial_driver
;
/* serial subtype definitions */
/* serial subtype definitions */
#define SERIAL_TYPE_NORMAL 1
#define SERIAL_TYPE_NORMAL 1
...
@@ -1800,6 +1800,25 @@ static void __init probe_sccs(void)
...
@@ -1800,6 +1800,25 @@ static void __init probe_sccs(void)
restore_flags(flags); */
restore_flags(flags); */
}
}
static
struct
tty_operations
serial_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
,
.
wait_until_sent
=
rs_wait_until_sent
,
};
/* zs_init inits the driver */
/* zs_init inits the driver */
int
__init
zs_init
(
void
)
int
__init
zs_init
(
void
)
{
{
...
@@ -1817,45 +1836,29 @@ int __init zs_init(void)
...
@@ -1817,45 +1836,29 @@ int __init zs_init(void)
if
(
zs_chain
==
0
)
if
(
zs_chain
==
0
)
probe_sccs
();
probe_sccs
();
serial_driver
=
alloc_tty_driver
(
zs_channels_found
);
if
(
!
serial_driver
)
return
-
ENOMEM
;
show_serial_version
();
show_serial_version
();
/* Initialize the tty_driver structure */
/* Initialize the tty_driver structure */
/* Not all of this is exactly right for us. */
/* Not all of this is exactly right for us. */
memset
(
&
serial_driver
,
0
,
sizeof
(
struct
tty_driver
));
serial_driver
->
owner
=
THIS_MODULE
;
serial_driver
.
magic
=
TTY_DRIVER_MAGIC
;
serial_driver
->
devfs_name
=
"tts/"
;
serial_driver
.
owner
=
THIS_MODULE
;
serial_driver
->
name
=
"ttyS"
;
serial_driver
.
devfs_name
=
"tts/"
;
serial_driver
->
major
=
TTY_MAJOR
;
serial_driver
.
name
=
"ttyS"
;
serial_driver
->
minor_start
=
64
;
serial_driver
.
major
=
TTY_MAJOR
;
serial_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
.
minor_start
=
64
;
serial_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
num
=
zs_channels_found
;
serial_driver
->
init_termios
=
tty_std_termios
;
serial_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
->
init_termios
.
c_cflag
=
serial_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
init_termios
=
tty_std_termios
;
serial_driver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
serial_driver
.
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
serial_driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
tty_set_operations
(
serial_driver
,
&
serial_ops
);
serial_driver
.
open
=
rs_open
;
serial_driver
.
close
=
rs_close
;
if
(
tty_register_driver
(
serial_driver
))
serial_driver
.
write
=
rs_write
;
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
;
serial_driver
.
break_ctl
=
rs_break
;
serial_driver
.
wait_until_sent
=
rs_wait_until_sent
;
if
(
tty_register_driver
(
&
serial_driver
))
panic
(
"Couldn't register serial driver
\n
"
);
panic
(
"Couldn't register serial driver
\n
"
);
save_flags
(
flags
);
cli
();
save_flags
(
flags
);
cli
();
...
@@ -1899,7 +1902,7 @@ int __init zs_init(void)
...
@@ -1899,7 +1902,7 @@ int __init zs_init(void)
printk
(
"ttyS%02d at 0x%08x (irq = %d)"
,
info
->
line
,
printk
(
"ttyS%02d at 0x%08x (irq = %d)"
,
info
->
line
,
info
->
port
,
info
->
irq
);
info
->
port
,
info
->
irq
);
printk
(
" is a Z85C30 SCC
\n
"
);
printk
(
" is a Z85C30 SCC
\n
"
);
tty_register_device
(
&
serial_driver
,
info
->
line
,
NULL
);
tty_register_device
(
serial_driver
,
info
->
line
,
NULL
);
}
}
restore_flags
(
flags
);
restore_flags
(
flags
);
...
@@ -2051,7 +2054,7 @@ static void serial_console_write(struct console *co, const char *s,
...
@@ -2051,7 +2054,7 @@ static void serial_console_write(struct console *co, const char *s,
static
struct
tty_driver
*
serial_console_device
(
struct
console
*
c
,
int
*
index
)
static
struct
tty_driver
*
serial_console_device
(
struct
console
*
c
,
int
*
index
)
{
{
*
index
=
c
->
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