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
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
Hide 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 $";
...
@@ -335,7 +335,7 @@ static char *serial_version = "$Revision: 1.3 $";
static
DECLARE_TASK_QUEUE
(
tq_serial
);
static
DECLARE_TASK_QUEUE
(
tq_serial
);
st
ruct
tty_driver
serial_driver
;
st
atic
struct
tty_driver
*
serial_driver
;
/* serial subtype definitions */
/* serial subtype definitions */
#ifndef SERIAL_TYPE_NORMAL
#ifndef SERIAL_TYPE_NORMAL
...
@@ -3418,12 +3418,37 @@ show_serial_version(void)
...
@@ -3418,12 +3418,37 @@ show_serial_version(void)
}
}
/* rs_init inits the driver at boot (using the module_init chain) */
/* 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
static
int
__init
rs_init
(
void
)
rs_init
(
void
)
{
{
int
i
;
int
i
;
struct
e100_serial
*
info
;
struct
e100_serial
*
info
;
struct
tty_driver
*
driver
=
alloc_tty_driver
(
NR_PORTS
);
if
(
!
driver
)
return
-
ENOMEM
;
show_serial_version
();
show_serial_version
();
...
@@ -3439,48 +3464,20 @@ rs_init(void)
...
@@ -3439,48 +3464,20 @@ rs_init(void)
/* Initialize the tty_driver structure */
/* Initialize the tty_driver structure */
memset
(
&
serial_driver
,
0
,
sizeof
(
struct
tty_driver
));
driver
->
driver_name
=
"serial"
;
serial_driver
.
magic
=
TTY_DRIVER_MAGIC
;
driver
->
name
=
"ttyS"
;
#if (LINUX_VERSION_CODE > 0x20100)
driver
->
major
=
TTY_MAJOR
;
serial_driver
.
driver_name
=
"serial"
;
driver
->
minor_start
=
64
;
#endif
driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
serial_driver
.
name
=
"ttyS"
;
driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
serial_driver
.
major
=
TTY_MAJOR
;
driver
->
init_termios
=
tty_std_termios
;
serial_driver
.
minor_start
=
64
;
driver
->
init_termios
.
c_cflag
=
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
=
B115200
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
/* is normally B9600 default... */
B115200
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
/* is normally B9600 default... */
serial_driver
.
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
tty_set_operations
(
driver
,
&
rs_ops
);
serial_driver
.
open
=
rs_open
;
if
(
tty_register_driver
(
driver
))
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
))
panic
(
"Couldn't register serial driver
\n
"
);
panic
(
"Couldn't register serial driver
\n
"
);
serial_driver
=
driver
;
/* do some initializing for the separate ports */
/* do some initializing for the separate ports */
...
@@ -3520,7 +3517,7 @@ rs_init(void)
...
@@ -3520,7 +3517,7 @@ rs_init(void)
if
(
info
->
enabled
)
{
if
(
info
->
enabled
)
{
printk
(
KERN_INFO
"%s%d at 0x%x is a builtin UART with DMA
\n
"
,
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