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
Kirill Smelkov
linux
Commits
8e46bef9
Commit
8e46bef9
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/istallion.c converted to dynamic allocation
parent
aade9842
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
36 deletions
+44
-36
drivers/char/istallion.c
drivers/char/istallion.c
+44
-36
No files found.
drivers/char/istallion.c
View file @
8e46bef9
...
@@ -170,7 +170,7 @@ static char *stli_drvname = "istallion";
...
@@ -170,7 +170,7 @@ static char *stli_drvname = "istallion";
static
char
*
stli_drvversion
=
"5.6.0"
;
static
char
*
stli_drvversion
=
"5.6.0"
;
static
char
*
stli_serialname
=
"ttyE"
;
static
char
*
stli_serialname
=
"ttyE"
;
static
struct
tty_driver
stli_serial
;
static
struct
tty_driver
*
stli_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
...
@@ -847,13 +847,14 @@ static void __exit istallion_module_exit(void)
...
@@ -847,13 +847,14 @@ static void __exit istallion_module_exit(void)
del_timer
(
&
stli_timerlist
);
del_timer
(
&
stli_timerlist
);
}
}
i
=
tty_unregister_driver
(
&
stli_serial
);
i
=
tty_unregister_driver
(
stli_serial
);
if
(
i
)
{
if
(
i
)
{
printk
(
"STALLION: failed to un-register tty driver, "
printk
(
"STALLION: failed to un-register tty driver, "
"errno=%d,%d
\n
"
,
-
i
);
"errno=%d,%d
\n
"
,
-
i
);
restore_flags
(
flags
);
restore_flags
(
flags
);
return
;
return
;
}
}
put_tty_driver
(
stli_serial
);
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
devfs_remove
(
"staliomem/%d"
,
i
);
devfs_remove
(
"staliomem/%d"
,
i
);
devfs_remove
(
"staliomem"
);
devfs_remove
(
"staliomem"
);
...
@@ -5237,6 +5238,28 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
...
@@ -5237,6 +5238,28 @@ static int stli_memioctl(struct inode *ip, struct file *fp, unsigned int cmd, un
return
(
rc
);
return
(
rc
);
}
}
static
struct
tty_operations
stli_ops
=
{
.
open
=
stli_open
,
.
close
=
stli_close
,
.
write
=
stli_write
,
.
put_char
=
stli_putchar
,
.
flush_chars
=
stli_flushchars
,
.
write_room
=
stli_writeroom
,
.
chars_in_buffer
=
stli_charsinbuffer
,
.
ioctl
=
stli_ioctl
,
.
set_termios
=
stli_settermios
,
.
throttle
=
stli_throttle
,
.
unthrottle
=
stli_unthrottle
,
.
stop
=
stli_stop
,
.
start
=
stli_start
,
.
hangup
=
stli_hangup
,
.
flush_buffer
=
stli_flushbuffer
,
.
break_ctl
=
stli_breakctl
,
.
wait_until_sent
=
stli_waituntilsent
,
.
send_xchar
=
stli_sendxchar
,
.
read_proc
=
stli_readproc
,
};
/*****************************************************************************/
/*****************************************************************************/
int
__init
stli_init
(
void
)
int
__init
stli_init
(
void
)
...
@@ -5246,6 +5269,10 @@ int __init stli_init(void)
...
@@ -5246,6 +5269,10 @@ int __init stli_init(void)
stli_initbrds
();
stli_initbrds
();
stli_serial
=
alloc_tty_driver
(
STL_MAXBRDS
*
STL_MAXPORTS
);
if
(
!
stli_serial
)
return
-
ENOMEM
;
/*
/*
* Allocate a temporary write buffer.
* Allocate a temporary write buffer.
*/
*/
...
@@ -5276,41 +5303,22 @@ int __init stli_init(void)
...
@@ -5276,41 +5303,22 @@ int __init stli_init(void)
/*
/*
* Set up the tty driver structure and register us as a driver.
* Set up the tty driver structure and register us as a driver.
*/
*/
memset
(
&
stli_serial
,
0
,
sizeof
(
struct
tty_driver
));
stli_serial
->
owner
=
THIS_MODULE
;
stli_serial
.
magic
=
TTY_DRIVER_MAGIC
;
stli_serial
->
driver_name
=
stli_drvname
;
stli_serial
.
owner
=
THIS_MODULE
;
stli_serial
->
name
=
stli_serialname
;
stli_serial
.
driver_name
=
stli_drvname
;
stli_serial
->
major
=
STL_SERIALMAJOR
;
stli_serial
.
name
=
stli_serialname
;
stli_serial
->
minor_start
=
0
;
stli_serial
.
major
=
STL_SERIALMAJOR
;
stli_serial
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
stli_serial
.
minor_start
=
0
;
stli_serial
->
subtype
=
SERIAL_TYPE_NORMAL
;
stli_serial
.
num
=
STL_MAXBRDS
*
STL_MAXPORTS
;
stli_serial
->
init_termios
=
stli_deftermios
;
stli_serial
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
stli_serial
->
flags
=
TTY_DRIVER_REAL_RAW
;
stli_serial
.
subtype
=
SERIAL_TYPE_NORMAL
;
tty_set_operations
(
stli_serial
,
&
stli_ops
);
stli_serial
.
init_termios
=
stli_deftermios
;
stli_serial
.
flags
=
TTY_DRIVER_REAL_RAW
;
if
(
tty_register_driver
(
stli_serial
))
{
put_tty_driver
(
stli_serial
);
stli_serial
.
open
=
stli_open
;
stli_serial
.
close
=
stli_close
;
stli_serial
.
write
=
stli_write
;
stli_serial
.
put_char
=
stli_putchar
;
stli_serial
.
flush_chars
=
stli_flushchars
;
stli_serial
.
write_room
=
stli_writeroom
;
stli_serial
.
chars_in_buffer
=
stli_charsinbuffer
;
stli_serial
.
ioctl
=
stli_ioctl
;
stli_serial
.
set_termios
=
stli_settermios
;
stli_serial
.
throttle
=
stli_throttle
;
stli_serial
.
unthrottle
=
stli_unthrottle
;
stli_serial
.
stop
=
stli_stop
;
stli_serial
.
start
=
stli_start
;
stli_serial
.
hangup
=
stli_hangup
;
stli_serial
.
flush_buffer
=
stli_flushbuffer
;
stli_serial
.
break_ctl
=
stli_breakctl
;
stli_serial
.
wait_until_sent
=
stli_waituntilsent
;
stli_serial
.
send_xchar
=
stli_sendxchar
;
stli_serial
.
read_proc
=
stli_readproc
;
if
(
tty_register_driver
(
&
stli_serial
))
printk
(
KERN_ERR
"STALLION: failed to register serial driver
\n
"
);
printk
(
KERN_ERR
"STALLION: failed to register serial driver
\n
"
);
return
-
EBUSY
;
}
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