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
f50308a8
Commit
f50308a8
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/specialix.c converted to dynamic allocation
parent
c3527bf0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
31 deletions
+38
-31
drivers/char/specialix.c
drivers/char/specialix.c
+38
-31
No files found.
drivers/char/specialix.c
View file @
f50308a8
...
...
@@ -176,7 +176,7 @@ DECLARE_TASK_QUEUE(tq_specialix);
#undef RS_EVENT_WRITE_WAKEUP
#define RS_EVENT_WRITE_WAKEUP 0
static
struct
tty_driver
specialix_driver
;
static
struct
tty_driver
*
specialix_driver
;
static
unsigned
char
*
tmp_buf
;
static
DECLARE_MUTEX
(
tmp_buf_sem
);
...
...
@@ -2151,48 +2151,54 @@ static void do_softint(void *private_)
}
}
static
struct
tty_operations
sx_ops
=
{
.
open
=
sx_open
,
.
close
=
sx_close
,
.
write
=
sx_write
,
.
put_char
=
sx_put_char
,
.
flush_chars
=
sx_flush_chars
,
.
write_room
=
sx_write_room
,
.
chars_in_buffer
=
sx_chars_in_buffer
,
.
flush_buffer
=
sx_flush_buffer
,
.
ioctl
=
sx_ioctl
,
.
throttle
=
sx_throttle
,
.
unthrottle
=
sx_unthrottle
,
.
set_termios
=
sx_set_termios
,
.
stop
=
sx_stop
,
.
start
=
sx_start
,
.
hangup
=
sx_hangup
,
};
static
int
sx_init_drivers
(
void
)
{
int
error
;
int
i
;
specialix_driver
=
alloc_tty_driver
(
SX_NBOARD
*
SX_NPORT
);
if
(
!
specialix_driver
)
{
printk
(
KERN_ERR
"sx: Couldn't allocate tty_driver.
\n
"
);
return
1
;
}
if
(
!
(
tmp_buf
=
(
unsigned
char
*
)
get_zeroed_page
(
GFP_KERNEL
)))
{
printk
(
KERN_ERR
"sx: Couldn't get free page.
\n
"
);
put_tty_driver
(
specialix_driver
);
return
1
;
}
init_bh
(
SPECIALIX_BH
,
do_specialix_bh
);
memset
(
&
specialix_driver
,
0
,
sizeof
(
specialix_driver
));
specialix_driver
.
magic
=
TTY_DRIVER_MAGIC
;
specialix_driver
.
owner
=
THIS_MODULE
;
specialix_driver
.
name
=
"ttyW"
;
specialix_driver
.
major
=
SPECIALIX_NORMAL_MAJOR
;
specialix_driver
.
num
=
SX_NBOARD
*
SX_NPORT
;
specialix_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
specialix_driver
.
subtype
=
SERIAL_TYPE_NORMAL
;
specialix_driver
.
init_termios
=
tty_std_termios
;
specialix_driver
.
init_termios
.
c_cflag
=
specialix_driver
->
owner
=
THIS_MODULE
;
specialix_driver
->
name
=
"ttyW"
;
specialix_driver
->
major
=
SPECIALIX_NORMAL_MAJOR
;
specialix_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
specialix_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
specialix_driver
->
init_termios
=
tty_std_termios
;
specialix_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
specialix_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
specialix_driver
.
open
=
sx_open
;
specialix_driver
.
close
=
sx_close
;
specialix_driver
.
write
=
sx_write
;
specialix_driver
.
put_char
=
sx_put_char
;
specialix_driver
.
flush_chars
=
sx_flush_chars
;
specialix_driver
.
write_room
=
sx_write_room
;
specialix_driver
.
chars_in_buffer
=
sx_chars_in_buffer
;
specialix_driver
.
flush_buffer
=
sx_flush_buffer
;
specialix_driver
.
ioctl
=
sx_ioctl
;
specialix_driver
.
throttle
=
sx_throttle
;
specialix_driver
.
unthrottle
=
sx_unthrottle
;
specialix_driver
.
set_termios
=
sx_set_termios
;
specialix_driver
.
stop
=
sx_stop
;
specialix_driver
.
start
=
sx_start
;
specialix_driver
.
hangup
=
sx_hangup
;
if
((
error
=
tty_register_driver
(
&
specialix_driver
)))
{
specialix_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
specialix_driver
,
&
sx_ops
);
if
((
error
=
tty_register_driver
(
specialix_driver
)))
{
put_tty_driver
(
specialix_driver
);
free_page
((
unsigned
long
)
tmp_buf
);
printk
(
KERN_ERR
"sx: Couldn't register specialix IO8+ driver, error = %d
\n
"
,
error
);
...
...
@@ -2218,7 +2224,8 @@ static int sx_init_drivers(void)
static
void
sx_release_drivers
(
void
)
{
free_page
((
unsigned
long
)
tmp_buf
);
tty_unregister_driver
(
&
specialix_driver
);
tty_unregister_driver
(
specialix_driver
);
put_tty_driver
(
specialix_driver
);
}
...
...
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