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
Hide 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);
...
@@ -201,7 +201,7 @@ static int rio_init_drivers(void);
void
my_hd
(
void
*
addr
,
int
len
);
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
/* The name "p" is a bit non-descript. But that's what the rio-lynxos
sources use all over the place. */
sources use all over the place. */
...
@@ -361,7 +361,7 @@ int RIODelay_ni (struct Port *PortP, int njiffies)
...
@@ -361,7 +361,7 @@ int RIODelay_ni (struct Port *PortP, int njiffies)
int
rio_minor
(
struct
tty_struct
*
tty
)
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,60 +860,77 @@ struct vpd_prom *get_VPD_PROM (struct Host *hp)
...
@@ -860,60 +860,77 @@ struct vpd_prom *get_VPD_PROM (struct Host *hp)
return
&
vpdp
;
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
)
static
int
rio_init_drivers
(
void
)
{
{
int
error
;
int
error
=
-
ENOMEM
;
func_enter
();
rio_driver
=
alloc_tty_driver
(
256
);
if
(
!
rio_driver
)
memset
(
&
rio_driver
,
0
,
sizeof
(
rio_driver
));
goto
out
;
rio_driver
.
magic
=
TTY_DRIVER_MAGIC
;
rio_driver2
=
alloc_tty_driver
(
256
);
rio_driver
.
owner
=
THIS_MODULE
;
if
(
!
rio_driver2
)
rio_driver
.
driver_name
=
"specialix_rio"
;
goto
out1
;
rio_driver
.
name
=
"ttySR"
;
rio_driver
.
major
=
RIO_NORMAL_MAJOR0
;
func_enter
();
rio_driver
.
num
=
256
;
rio_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver
->
owner
=
THIS_MODULE
;
rio_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver
->
driver_name
=
"specialix_rio"
;
rio_driver
.
init_termios
=
tty_std_termios
;
rio_driver
->
name
=
"ttySR"
;
rio_driver
.
init_termios
.
c_cflag
=
rio_driver
->
major
=
RIO_NORMAL_MAJOR0
;
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
rio_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver
->
init_termios
=
tty_std_termios
;
rio_driver
.
open
=
riotopen
;
rio_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver
.
close
=
gs_close
;
rio_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
rio_driver
.
write
=
gs_write
;
tty_set_operations
(
rio_driver
,
&
rio_ops
);
rio_driver
.
put_char
=
gs_put_char
;
rio_driver
.
flush_chars
=
gs_flush_chars
;
rio_driver2
->
owner
=
THIS_MODULE
;
rio_driver
.
write_room
=
gs_write_room
;
rio_driver2
->
driver_name
=
"specialix_rio"
;
rio_driver
.
chars_in_buffer
=
gs_chars_in_buffer
;
rio_driver2
->
name
=
"ttySR"
;
rio_driver
.
flush_buffer
=
gs_flush_buffer
;
rio_driver2
->
major
=
RIO_NORMAL_MAJOR1
;
rio_driver
.
ioctl
=
rio_ioctl
;
rio_driver2
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
rio_driver
.
throttle
=
rio_throttle
;
rio_driver2
->
subtype
=
SERIAL_TYPE_NORMAL
;
rio_driver
.
unthrottle
=
rio_unthrottle
;
rio_driver2
->
init_termios
=
tty_std_termios
;
rio_driver
.
set_termios
=
gs_set_termios
;
rio_driver2
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
rio_driver
.
stop
=
gs_stop
;
rio_driver2
->
flags
=
TTY_DRIVER_REAL_RAW
;
rio_driver
.
start
=
gs_start
;
tty_set_operations
(
rio_driver2
,
&
rio_ops
);
rio_driver
.
hangup
=
gs_hangup
;
rio_dprintk
(
RIO_DEBUG_INIT
,
"set_termios = %p
\n
"
,
gs_set_termios
);
rio_driver2
=
rio_driver
;
rio_driver2
.
major
=
RIO_NORMAL_MAJOR1
;
if
((
error
=
tty_register_driver
(
rio_driver
)))
goto
out2
;
rio_dprintk
(
RIO_DEBUG_INIT
,
"set_termios = %p
\n
"
,
gs_set_termios
);
if
((
error
=
tty_register_driver
(
rio_driver2
)))
goto
out3
;
if
((
error
=
tty_register_driver
(
&
rio_driver
)))
goto
bad1
;
func_exit
();
if
((
error
=
tty_register_driver
(
&
rio_driver2
)))
goto
bad2
;
return
0
;
out3:
func_exit
();
tty_unregister_driver
(
rio_driver
);
return
0
;
out2:
/*
put_tty_driver
(
rio_driver2
);
bad3:tty_unregister_driver (&rio_driver2);
out1:
bad2:tty_unregister_driver (&rio_driver);
put_tty_driver
(
rio_driver
);
bad1:printk(KERN_ERR "rio: Couldn't register a rio driver, error = %d\n",
out:
error);
printk
(
KERN_ERR
"rio: Couldn't register a rio driver, error = %d
\n
"
,
return 1;
error
);
return
1
;
}
}
...
@@ -1009,8 +1026,10 @@ static int rio_init_datastructures (void)
...
@@ -1009,8 +1026,10 @@ static int rio_init_datastructures (void)
static
void
__exit
rio_release_drivers
(
void
)
static
void
__exit
rio_release_drivers
(
void
)
{
{
func_enter
();
func_enter
();
tty_unregister_driver
(
&
rio_driver2
);
tty_unregister_driver
(
rio_driver2
);
tty_unregister_driver
(
&
rio_driver
);
tty_unregister_driver
(
rio_driver
);
put_tty_driver
(
rio_driver2
);
put_tty_driver
(
rio_driver
);
func_exit
();
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