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
aade9842
Commit
aade9842
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/stallion.c converted to dynamic allocation
parent
37e21205
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
40 deletions
+45
-40
drivers/char/stallion.c
drivers/char/stallion.c
+45
-40
No files found.
drivers/char/stallion.c
View file @
aade9842
...
@@ -137,7 +137,7 @@ static char *stl_drvtitle = "Stallion Multiport Serial Driver";
...
@@ -137,7 +137,7 @@ static char *stl_drvtitle = "Stallion Multiport Serial Driver";
static
char
*
stl_drvname
=
"stallion"
;
static
char
*
stl_drvname
=
"stallion"
;
static
char
*
stl_drvversion
=
"5.6.0"
;
static
char
*
stl_drvversion
=
"5.6.0"
;
static
struct
tty_driver
stl_serial
;
static
struct
tty_driver
*
stl_serial
;
/*
/*
* We will need to allocate a temporary write buffer for chars that
* We will need to allocate a temporary write buffer for chars that
...
@@ -783,7 +783,8 @@ static void __exit stallion_module_exit(void)
...
@@ -783,7 +783,8 @@ static void __exit stallion_module_exit(void)
* a hangup on every open port - to try to flush out any processes
* a hangup on every open port - to try to flush out any processes
* hanging onto ports.
* hanging onto ports.
*/
*/
i
=
tty_unregister_driver
(
&
stl_serial
);
i
=
tty_unregister_driver
(
stl_serial
);
put_tty_driver
(
stl_serial
);
if
(
i
)
{
if
(
i
)
{
printk
(
"STALLION: failed to un-register tty driver, "
printk
(
"STALLION: failed to un-register tty driver, "
"errno=%d
\n
"
,
-
i
);
"errno=%d
\n
"
,
-
i
);
...
@@ -3120,6 +3121,28 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns
...
@@ -3120,6 +3121,28 @@ static int stl_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, uns
return
(
rc
);
return
(
rc
);
}
}
static
struct
tty_operations
stl_ops
=
{
.
open
=
stl_open
,
.
close
=
stl_close
,
.
write
=
stl_write
,
.
put_char
=
stl_putchar
,
.
flush_chars
=
stl_flushchars
,
.
write_room
=
stl_writeroom
,
.
chars_in_buffer
=
stl_charsinbuffer
,
.
ioctl
=
stl_ioctl
,
.
set_termios
=
stl_settermios
,
.
throttle
=
stl_throttle
,
.
unthrottle
=
stl_unthrottle
,
.
stop
=
stl_stop
,
.
start
=
stl_start
,
.
hangup
=
stl_hangup
,
.
flush_buffer
=
stl_flushbuffer
,
.
break_ctl
=
stl_breakctl
,
.
wait_until_sent
=
stl_waituntilsent
,
.
send_xchar
=
stl_sendxchar
,
.
read_proc
=
stl_readproc
,
};
/*****************************************************************************/
/*****************************************************************************/
int
__init
stl_init
(
void
)
int
__init
stl_init
(
void
)
...
@@ -3129,6 +3152,10 @@ int __init stl_init(void)
...
@@ -3129,6 +3152,10 @@ int __init stl_init(void)
stl_initbrds
();
stl_initbrds
();
stl_serial
=
alloc_tty_driver
(
STL_MAXBRDS
*
STL_MAXPORTS
);
if
(
!
stl_serial
)
return
-
1
;
/*
/*
* Allocate a temporary write buffer.
* Allocate a temporary write buffer.
*/
*/
...
@@ -3151,45 +3178,23 @@ int __init stl_init(void)
...
@@ -3151,45 +3178,23 @@ int __init stl_init(void)
&
stl_fsiomem
,
NULL
,
"staliomem/%d"
,
i
);
&
stl_fsiomem
,
NULL
,
"staliomem/%d"
,
i
);
}
}
/*
stl_serial
->
owner
=
THIS_MODULE
;
* Set up the tty driver structure and register us as a driver.
stl_serial
->
driver_name
=
stl_drvname
;
*/
stl_serial
->
name
=
"ttyE"
;
memset
(
&
stl_serial
,
0
,
sizeof
(
struct
tty_driver
));
stl_serial
->
devfs_name
=
"tts/E"
;
stl_serial
.
magic
=
TTY_DRIVER_MAGIC
;
stl_serial
->
major
=
STL_SERIALMAJOR
;
stl_serial
.
owner
=
THIS_MODULE
;
stl_serial
->
minor_start
=
0
;
stl_serial
.
driver_name
=
stl_drvname
;
stl_serial
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
stl_serial
.
name
=
"ttyE"
;
stl_serial
->
subtype
=
SERIAL_TYPE_NORMAL
;
stl_serial
.
devfs_name
=
"tts/E"
;
stl_serial
->
init_termios
=
stl_deftermios
;
stl_serial
.
major
=
STL_SERIALMAJOR
;
stl_serial
->
flags
=
TTY_DRIVER_REAL_RAW
;
stl_serial
.
minor_start
=
0
;
tty_set_operations
(
stl_serial
,
&
stl_ops
);
stl_serial
.
num
=
STL_MAXBRDS
*
STL_MAXPORTS
;
stl_serial
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
if
(
tty_register_driver
(
stl_serial
))
{
stl_serial
.
subtype
=
SERIAL_TYPE_NORMAL
;
put_tty_driver
(
stl_serial
);
stl_serial
.
init_termios
=
stl_deftermios
;
stl_serial
.
flags
=
TTY_DRIVER_REAL_RAW
;
stl_serial
.
open
=
stl_open
;
stl_serial
.
close
=
stl_close
;
stl_serial
.
write
=
stl_write
;
stl_serial
.
put_char
=
stl_putchar
;
stl_serial
.
flush_chars
=
stl_flushchars
;
stl_serial
.
write_room
=
stl_writeroom
;
stl_serial
.
chars_in_buffer
=
stl_charsinbuffer
;
stl_serial
.
ioctl
=
stl_ioctl
;
stl_serial
.
set_termios
=
stl_settermios
;
stl_serial
.
throttle
=
stl_throttle
;
stl_serial
.
unthrottle
=
stl_unthrottle
;
stl_serial
.
stop
=
stl_stop
;
stl_serial
.
start
=
stl_start
;
stl_serial
.
hangup
=
stl_hangup
;
stl_serial
.
flush_buffer
=
stl_flushbuffer
;
stl_serial
.
break_ctl
=
stl_breakctl
;
stl_serial
.
wait_until_sent
=
stl_waituntilsent
;
stl_serial
.
send_xchar
=
stl_sendxchar
;
stl_serial
.
read_proc
=
stl_readproc
;
if
(
tty_register_driver
(
&
stl_serial
))
printk
(
"STALLION: failed to register serial driver
\n
"
);
printk
(
"STALLION: failed to register serial driver
\n
"
);
return
-
1
;
}
return
(
0
);
return
(
0
);
}
}
...
...
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