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
5d85b66a
Commit
5d85b66a
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/v850/kernel/{memcons,simcons}.c converted to dynamic allocation
parent
174cc1e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
38 deletions
+56
-38
arch/v850/kernel/memcons.c
arch/v850/kernel/memcons.c
+28
-18
arch/v850/kernel/simcons.c
arch/v850/kernel/simcons.c
+28
-20
No files found.
arch/v850/kernel/memcons.c
View file @
5d85b66a
...
...
@@ -58,11 +58,12 @@ static void memcons_write (struct console *co, const char *buf, unsigned len)
len
-=
write
(
buf
,
len
);
}
extern
struct
tty_driver
tty_driver
;
static
struct
tty_driver
*
tty_driver
;
static
struct
tty_driver
*
memcons_device
(
struct
console
*
co
,
int
*
index
)
{
*
index
=
co
->
index
;
return
&
tty_driver
;
return
tty_driver
;
}
static
struct
console
memcons
=
...
...
@@ -82,8 +83,6 @@ void memcons_setup (void)
/* Higher level TTY interface. */
static
struct
tty_driver
tty_driver
=
{
0
};
int
memcons_tty_open
(
struct
tty_struct
*
tty
,
struct
file
*
filp
)
{
return
0
;
...
...
@@ -106,21 +105,32 @@ int memcons_tty_chars_in_buffer (struct tty_struct *tty)
return
0
;
}
static
struct
tty_operations
ops
=
{
.
open
=
memcons_tty_open
,
.
write
=
memcons_tty_write
,
.
write_room
=
memcons_tty_write_room
,
.
chars_in_buffer
=
memcons_tty_chars_in_buffer
,
};
int
__init
memcons_tty_init
(
void
)
{
tty_driver
.
name
=
"memcons"
;
tty_driver
.
major
=
TTY_MAJOR
;
tty_driver
.
minor_start
=
64
;
tty_driver
.
num
=
1
;
tty_driver
.
type
=
TTY_DRIVER_TYPE_SYSCONS
;
tty_driver
.
init_termios
=
tty_std_termios
;
tty_driver
.
open
=
memcons_tty_open
;
tty_driver
.
write
=
memcons_tty_write
;
tty_driver
.
write_room
=
memcons_tty_write_room
;
tty_driver
.
chars_in_buffer
=
memcons_tty_chars_in_buffer
;
tty_register_driver
(
&
tty_driver
);
int
err
;
struct
tty_driver
*
driver
=
alloc_tty_driver
(
1
);
if
(
!
driver
)
return
-
ENOMEM
;
driver
->
name
=
"memcons"
;
driver
->
major
=
TTY_MAJOR
;
driver
->
minor_start
=
64
;
driver
->
type
=
TTY_DRIVER_TYPE_SYSCONS
;
driver
->
init_termios
=
tty_std_termios
;
tty_set_operations
(
driver
,
&
ops
);
err
=
tty_register_driver
(
driver
);
if
(
err
)
{
put_tty_driver
(
driver
);
return
err
;
}
tty_driver
=
driver
;
return
0
;
}
__initcall
(
memcons_tty_init
);
arch/v850/kernel/simcons.c
View file @
5d85b66a
...
...
@@ -35,11 +35,11 @@ static int simcons_read (struct console *co, const char *buf, unsigned len)
return
V850_SIM_SYSCALL
(
read
,
0
,
buf
,
len
);
}
extern
struct
tty_driver
tty_driver
;
static
struct
tty_driver
*
tty_driver
;
static
struct
tty_driver
*
simcons_device
(
struct
console
*
c
,
int
*
index
)
{
*
index
=
c
->
index
;
return
&
tty_driver
;
return
tty_driver
;
}
static
struct
console
simcons
=
...
...
@@ -54,8 +54,6 @@ static struct console simcons =
/* Higher level TTY interface. */
static
struct
tty_driver
tty_driver
=
{
0
};
int
simcons_tty_open
(
struct
tty_struct
*
tty
,
struct
file
*
filp
)
{
return
0
;
...
...
@@ -79,22 +77,32 @@ int simcons_tty_chars_in_buffer (struct tty_struct *tty)
return
0
;
}
static
struct
tty_operations
ops
=
{
.
open
=
simcons_tty_open
,
.
write
=
simcons_tty_write
,
.
write_room
=
simcons_tty_write_room
,
.
chars_in_buffer
=
simcons_tty_chars_in_buffer
,
};
int
__init
simcons_tty_init
(
void
)
{
tty_driver
.
name
=
"simcons"
;
tty_driver
.
major
=
TTY_MAJOR
;
tty_driver
.
minor_start
=
64
;
tty_driver
.
num
=
1
;
tty_driver
.
type
=
TTY_DRIVER_TYPE_SYSCONS
;
tty_driver
.
init_termios
=
tty_std_termios
;
tty_driver
.
open
=
simcons_tty_open
;
tty_driver
.
write
=
simcons_tty_write
;
tty_driver
.
write_room
=
simcons_tty_write_room
;
tty_driver
.
chars_in_buffer
=
simcons_tty_chars_in_buffer
;
tty_register_driver
(
&
tty_driver
);
struct
tty_driver
*
driver
=
alloc_tty_driver
(
1
);
int
err
;
if
(
!
driver
)
return
-
ENOMEM
;
driver
->
name
=
"simcons"
;
driver
->
major
=
TTY_MAJOR
;
driver
->
minor_start
=
64
;
driver
->
type
=
TTY_DRIVER_TYPE_SYSCONS
;
driver
->
init_termios
=
tty_std_termios
;
tty_set_operations
(
driver
,
&
ops
);
err
=
tty_register_driver
(
driver
);
if
(
err
)
{
put_tty_driver
(
driver
);
return
err
;
}
tty_driver
=
driver
;
return
0
;
}
__initcall
(
simcons_tty_init
);
...
...
@@ -139,8 +147,8 @@ void simcons_poll_tty (struct tty_struct *tty)
void
simcons_poll_ttys
(
void
)
{
if
(
tty_driver
.
ttys
[
0
])
simcons_poll_tty
(
tty_driver
.
ttys
[
0
]);
if
(
tty_driver
&&
tty_driver
->
ttys
[
0
])
simcons_poll_tty
(
tty_driver
->
ttys
[
0
]);
}
void
simcons_setup
(
void
)
...
...
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