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
956bf124
Commit
956bf124
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/rio/rio_linux.c converted to dynamic allocation
parent
f4861b30
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
55 deletions
+74
-55
drivers/char/rio/rio_linux.c
drivers/char/rio/rio_linux.c
+74
-55
No files found.
drivers/char/rio/rio_linux.c
View file @
956bf124
...
...
@@ -201,7 +201,7 @@ static int rio_init_drivers(void);
void
my_hd
(
void
*
addr
,
int
len
);
static
struct
tty_driver
rio_driver
,
rio_driver2
;
static
struct
tty_driver
*
rio_driver
,
*
rio_driver2
;
/* The name "p" is a bit non-descript. But that's what the rio-lynxos
sources use all over the place. */
...
...
@@ -361,7 +361,7 @@ int RIODelay_ni (struct Port *PortP, int njiffies)
int
rio_minor
(
struct
tty_struct
*
tty
)
{
return
tty
->
index
+
(
tty
->
driver
==
&
rio_driver
)
?
0
:
256
;
return
tty
->
index
+
(
tty
->
driver
==
rio_driver
)
?
0
:
256
;
}
...
...
@@ -860,58 +860,75 @@ struct vpd_prom *get_VPD_PROM (struct Host *hp)
return
&
vpdp
;
}
static
struct
tty_operations
rio_ops
=
{
.
open
=
riotopen
,
.
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
=
rio_ioctl
,
.
throttle
=
rio_throttle
,
.
unthrottle
=
rio_unthrottle
,
.
set_termios
=
gs_set_termios
,
.
stop
=
gs_stop
,
.
start
=
gs_start
,
.
hangup
=
gs_hangup
,
};
static
int
rio_init_drivers
(
void
)
{
int
error
;
int
error
=
-
ENOMEM
;
rio_driver
=
alloc_tty_driver
(
256
);
if
(
!
rio_driver
)
goto
out
;
rio_driver2
=
alloc_tty_driver
(
256
);
if
(
!
rio_driver2
)
goto
out1
;
func_enter
();
memset
(
&
rio_driver
,
0
,
sizeof
(
rio_driver
));
rio_driver
.
magic
=
TTY_DRIVER_MAGIC
;
rio_driver
.
owner
=
THIS_MODULE
;
rio_driver
.
driver_name
=
"specialix_rio"
;
rio_driver
.
name
=
"ttySR"
;
rio_driver
.
major
=
RIO_NORMAL_MAJOR0
;
rio_driver
.
num
=
256
;
rio_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver
.
init_termios
=
tty_std_termios
;
rio_driver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
rio_driver
.
open
=
riotopen
;
rio_driver
.
close
=
gs_close
;
rio_driver
.
write
=
gs_write
;
rio_driver
.
put_char
=
gs_put_char
;
rio_driver
.
flush_chars
=
gs_flush_chars
;
rio_driver
.
write_room
=
gs_write_room
;
rio_driver
.
chars_in_buffer
=
gs_chars_in_buffer
;
rio_driver
.
flush_buffer
=
gs_flush_buffer
;
rio_driver
.
ioctl
=
rio_ioctl
;
rio_driver
.
throttle
=
rio_throttle
;
rio_driver
.
unthrottle
=
rio_unthrottle
;
rio_driver
.
set_termios
=
gs_set_termios
;
rio_driver
.
stop
=
gs_stop
;
rio_driver
.
start
=
gs_start
;
rio_driver
.
hangup
=
gs_hangup
;
rio_driver2
=
rio_driver
;
rio_driver2
.
major
=
RIO_NORMAL_MAJOR1
;
rio_driver
->
owner
=
THIS_MODULE
;
rio_driver
->
driver_name
=
"specialix_rio"
;
rio_driver
->
name
=
"ttySR"
;
rio_driver
->
major
=
RIO_NORMAL_MAJOR0
;
rio_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver
->
init_termios
=
tty_std_termios
;
rio_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
rio_driver
,
&
rio_ops
);
rio_driver2
->
owner
=
THIS_MODULE
;
rio_driver2
->
driver_name
=
"specialix_rio"
;
rio_driver2
->
name
=
"ttySR"
;
rio_driver2
->
major
=
RIO_NORMAL_MAJOR1
;
rio_driver2
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver2
->
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver2
->
init_termios
=
tty_std_termios
;
rio_driver2
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver2
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
rio_driver2
,
&
rio_ops
);
rio_dprintk
(
RIO_DEBUG_INIT
,
"set_termios = %p
\n
"
,
gs_set_termios
);
if
((
error
=
tty_register_driver
(
&
rio_driver
)))
goto
bad1
;
if
((
error
=
tty_register_driver
(
&
rio_driver2
)))
goto
bad2
;
if
((
error
=
tty_register_driver
(
rio_driver
)))
goto
out2
;
if
((
error
=
tty_register_driver
(
rio_driver2
)))
goto
out3
;
func_exit
();
return
0
;
/*
bad3:tty_unregister_driver (&rio_driver2);
bad2:tty_unregister_driver (&rio_driver);
bad1:printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n",
out3:
tty_unregister_driver
(
rio_driver
);
out2:
put_tty_driver
(
rio_driver2
);
out1:
put_tty_driver
(
rio_driver
);
out:
printk
(
KERN_ERR
"rio: Couldn't register a rio driver, error = %d
\n
"
,
error
);
return
1
;
}
...
...
@@ -1009,8 +1026,10 @@ static int rio_init_datastructures (void)
static
void
__exit
rio_release_drivers
(
void
)
{
func_enter
();
tty_unregister_driver
(
&
rio_driver2
);
tty_unregister_driver
(
&
rio_driver
);
tty_unregister_driver
(
rio_driver2
);
tty_unregister_driver
(
rio_driver
);
put_tty_driver
(
rio_driver2
);
put_tty_driver
(
rio_driver
);
func_exit
();
}
...
...
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