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
8bfd2705
Commit
8bfd2705
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/hvc_console.c converted to dynamic allocation
parent
c5bea379
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
28 deletions
+34
-28
drivers/char/hvc_console.c
drivers/char/hvc_console.c
+34
-28
No files found.
drivers/char/hvc_console.c
View file @
8bfd2705
...
@@ -41,7 +41,7 @@ extern int hvc_put_chars(int index, const char *buf, int count);
...
@@ -41,7 +41,7 @@ extern int hvc_put_chars(int index, const char *buf, int count);
#define TIMEOUT ((HZ + 99) / 100)
#define TIMEOUT ((HZ + 99) / 100)
st
ruct
tty_driver
hvc_driver
;
st
atic
struct
tty_driver
*
hvc_driver
;
static
int
hvc_offset
;
static
int
hvc_offset
;
#ifdef CONFIG_MAGIC_SYSRQ
#ifdef CONFIG_MAGIC_SYSRQ
static
int
sysrq_pressed
;
static
int
sysrq_pressed
;
...
@@ -246,42 +246,48 @@ int khvcd(void *unused)
...
@@ -246,42 +246,48 @@ int khvcd(void *unused)
}
}
}
}
static
struct
tty_operations
hvc_ops
=
{
.
open
=
hvc_open
,
.
close
=
hvc_close
,
.
write
=
hvc_write
,
.
hangup
=
hvc_hangup
,
.
write_room
=
hvc_write_room
,
.
chars_in_buffer
=
hvc_chars_in_buffer
,
};
int
__init
hvc_init
(
void
)
int
__init
hvc_init
(
void
)
{
{
int
num
=
hvc_count
(
&
hvc_offset
);
int
i
;
int
i
;
memset
(
&
hvc_driver
,
0
,
sizeof
(
struct
tty_driver
));
if
(
num
>
MAX_NR_HVC_CONSOLES
)
num
=
MAX_NR_HVC_CONSOLES
;
hvc_driver
.
magic
=
TTY_DRIVER_MAGIC
;
hvc_driver
.
owner
=
THIS_MODULE
;
hvc_driver
=
alloc_tty_driver
(
num
);
hvc_driver
.
driver_name
=
"hvc"
;
if
(
!
hvc_driver
)
hvc_driver
.
name
=
"hvc/"
;
return
-
ENOMEM
;
hvc_driver
.
major
=
HVC_MAJOR
;
hvc_driver
.
minor_start
=
HVC_MINOR
;
hvc_driver
->
owner
=
THIS_MODULE
;
hvc_driver
.
num
=
hvc_count
(
&
hvc_offset
);
hvc_driver
->
driver_name
=
"hvc"
;
if
(
hvc_driver
.
num
>
MAX_NR_HVC_CONSOLES
)
hvc_driver
->
name
=
"hvc/"
;
hvc_driver
.
num
=
MAX_NR_HVC_CONSOLES
;
hvc_driver
->
major
=
HVC_MAJOR
;
hvc_driver
.
type
=
TTY_DRIVER_TYPE_SYSTEM
;
hvc_driver
->
minor_start
=
HVC_MINOR
;
hvc_driver
.
init_termios
=
tty_std_termios
;
hvc_driver
->
type
=
TTY_DRIVER_TYPE_SYSTEM
;
hvc_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
hvc_driver
->
init_termios
=
tty_std_termios
;
hvc_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
hvc_driver
.
open
=
hvc_open
;
tty_set_operations
(
hvc_driver
,
&
hvc_ops
);
hvc_driver
.
close
=
hvc_close
;
for
(
i
=
0
;
i
<
num
;
i
++
)
{
hvc_driver
.
write
=
hvc_write
;
hvc_driver
.
hangup
=
hvc_hangup
;
hvc_driver
.
write_room
=
hvc_write_room
;
hvc_driver
.
chars_in_buffer
=
hvc_chars_in_buffer
;
for
(
i
=
0
;
i
<
hvc_driver
.
num
;
i
++
)
{
hvc_struct
[
i
].
lock
=
SPIN_LOCK_UNLOCKED
;
hvc_struct
[
i
].
lock
=
SPIN_LOCK_UNLOCKED
;
hvc_struct
[
i
].
index
=
i
;
hvc_struct
[
i
].
index
=
i
;
tty_register_device
(
&
hvc_driver
,
i
,
NULL
);
}
}
if
(
tty_register_driver
(
&
hvc_driver
))
if
(
tty_register_driver
(
hvc_driver
))
panic
(
"Couldn't register hvc console driver
\n
"
);
panic
(
"Couldn't register hvc console driver
\n
"
);
if
(
hvc_driver
.
num
>
0
)
for
(
i
=
0
;
i
<
num
;
i
++
)
tty_register_device
(
hvc_driver
,
i
,
NULL
);
if
(
num
>
0
)
kernel_thread
(
khvcd
,
NULL
,
CLONE_KERNEL
);
kernel_thread
(
khvcd
,
NULL
,
CLONE_KERNEL
);
return
0
;
return
0
;
...
@@ -325,7 +331,7 @@ void hvc_console_print(struct console *co, const char *b, unsigned count)
...
@@ -325,7 +331,7 @@ void hvc_console_print(struct console *co, const char *b, unsigned count)
static
struct
tty_driver
*
hvc_console_device
(
struct
console
*
c
,
int
*
index
)
static
struct
tty_driver
*
hvc_console_device
(
struct
console
*
c
,
int
*
index
)
{
{
*
index
=
c
->
index
;
*
index
=
c
->
index
;
return
&
hvc_driver
;
return
hvc_driver
;
}
}
static
int
__init
hvc_console_setup
(
struct
console
*
co
,
char
*
options
)
static
int
__init
hvc_console_setup
(
struct
console
*
co
,
char
*
options
)
...
...
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