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
43f47c56
Commit
43f47c56
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/sh-sci.c converted to dynamic allocation
parent
a7c4bba3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
39 deletions
+43
-39
drivers/char/sh-sci.c
drivers/char/sh-sci.c
+43
-39
No files found.
drivers/char/sh-sci.c
View file @
43f47c56
...
@@ -76,7 +76,7 @@ static int sci_request_irq(struct sci_port *port);
...
@@ -76,7 +76,7 @@ static int sci_request_irq(struct sci_port *port);
static
void
sci_free_irq
(
struct
sci_port
*
port
);
static
void
sci_free_irq
(
struct
sci_port
*
port
);
static
int
sci_init_drivers
(
void
);
static
int
sci_init_drivers
(
void
);
static
struct
tty_driver
sci_driver
;
static
struct
tty_driver
*
sci_driver
;
static
struct
sci_port
sci_ports
[
SCI_NPORTS
]
=
SCI_INIT
;
static
struct
sci_port
sci_ports
[
SCI_NPORTS
]
=
SCI_INIT
;
...
@@ -972,6 +972,27 @@ static int sci_read_proc(char *page, char **start, off_t off, int count,
...
@@ -972,6 +972,27 @@ static int sci_read_proc(char *page, char **start, off_t off, int count,
}
}
#endif
#endif
static
struct
tty_operations
sci_ops
=
{
.
open
=
sci_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
=
sci_ioctl
,
.
throttle
=
sci_throttle
,
.
unthrottle
=
sci_unthrottle
,
.
set_termios
=
gs_set_termios
,
.
stop
=
gs_stop
,
.
start
=
gs_start
,
.
hangup
=
gs_hangup
,
#ifdef CONFIG_PROC_FS
.
read_proc
=
sci_read_proc
,
#endif
};
/* ********************************************************************** *
/* ********************************************************************** *
* Here are the initialization routines. *
* Here are the initialization routines. *
* ********************************************************************** */
* ********************************************************************** */
...
@@ -980,45 +1001,27 @@ static int sci_init_drivers(void)
...
@@ -980,45 +1001,27 @@ static int sci_init_drivers(void)
{
{
int
error
;
int
error
;
struct
sci_port
*
port
;
struct
sci_port
*
port
;
sci_driver
=
alloc_tty_driver
(
SCI_NPORTS
);
memset
(
&
sci_driver
,
0
,
sizeof
(
sci_driver
));
if
(
!
sci_driver
)
sci_driver
.
magic
=
TTY_DRIVER_MAGIC
;
return
-
ENOMEM
;
sci_driver
.
owner
=
THIS_MODULE
;
sci_driver
.
driver_name
=
"sci"
;
sci_driver
->
owner
=
THIS_MODULE
;
sci_driver
.
name
=
"ttySC
"
;
sci_driver
->
driver_name
=
"sci
"
;
sci_driver
.
devfs_name
=
"ttsc/
"
;
sci_driver
->
name
=
"ttySC
"
;
sci_driver
.
major
=
SCI_MAJOR
;
sci_driver
->
devfs_name
=
"ttsc/"
;
sci_driver
.
minor_start
=
SCI_MINOR_START
;
sci_driver
->
major
=
SCI_MAJOR
;
sci_driver
.
num
=
SCI_NPORTS
;
sci_driver
->
minor_start
=
SCI_MINOR_START
;
sci_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
sci_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
sci_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
sci_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
sci_driver
.
init_termios
=
tty_std_termios
;
sci_driver
->
init_termios
=
tty_std_termios
;
sci_driver
.
init_termios
.
c_cflag
=
sci_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
|
CRTSCTS
;
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
|
CRTSCTS
;
sci_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
sci_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
sci_driver
,
&
sci_ops
);
sci_driver
.
open
=
sci_open
;
if
((
error
=
tty_register_driver
(
sci_driver
)))
{
sci_driver
.
close
=
gs_close
;
sci_driver
.
write
=
gs_write
;
sci_driver
.
put_char
=
gs_put_char
;
sci_driver
.
flush_chars
=
gs_flush_chars
;
sci_driver
.
write_room
=
gs_write_room
;
sci_driver
.
chars_in_buffer
=
gs_chars_in_buffer
;
sci_driver
.
flush_buffer
=
gs_flush_buffer
;
sci_driver
.
ioctl
=
sci_ioctl
;
sci_driver
.
throttle
=
sci_throttle
;
sci_driver
.
unthrottle
=
sci_unthrottle
;
sci_driver
.
set_termios
=
gs_set_termios
;
sci_driver
.
stop
=
gs_stop
;
sci_driver
.
start
=
gs_start
;
sci_driver
.
hangup
=
gs_hangup
;
#ifdef CONFIG_PROC_FS
sci_driver
.
read_proc
=
sci_read_proc
;
#endif
if
((
error
=
tty_register_driver
(
&
sci_driver
)))
{
printk
(
KERN_ERR
"sci: Couldn't register SCI driver, error = %d
\n
"
,
printk
(
KERN_ERR
"sci: Couldn't register SCI driver, error = %d
\n
"
,
error
);
error
);
put_tty_driver
(
sci_driver
);
return
1
;
return
1
;
}
}
...
@@ -1101,7 +1104,8 @@ module_init(sci_init);
...
@@ -1101,7 +1104,8 @@ module_init(sci_init);
void
cleanup_module
(
void
)
void
cleanup_module
(
void
)
{
{
tty_unregister_driver
(
&
sci_driver
);
tty_unregister_driver
(
sci_driver
);
put_tty_driver
(
sci_driver
);
}
}
#include "generic_serial.c"
#include "generic_serial.c"
...
@@ -1121,7 +1125,7 @@ static void serial_console_write(struct console *co, const char *s,
...
@@ -1121,7 +1125,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
&
sci_driver
;
return
sci_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