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
56250ab0
Commit
56250ab0
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/isdn/i4l/isdn_tty.c converted to dynamic allocation
parent
8bfd2705
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
33 deletions
+37
-33
drivers/isdn/i4l/isdn_tty.c
drivers/isdn/i4l/isdn_tty.c
+36
-32
drivers/isdn/i4l/isdn_tty.h
drivers/isdn/i4l/isdn_tty.h
+1
-1
No files found.
drivers/isdn/i4l/isdn_tty.c
View file @
56250ab0
...
...
@@ -1986,6 +1986,21 @@ modem_write_profile(atemu * m)
group_send_sig_info
(
SIGIO
,
SEND_SIG_PRIV
,
dev
->
profd
);
}
static
struct
tty_operations
modem_ops
=
{
.
open
=
isdn_tty_open
,
.
close
=
isdn_tty_close
,
.
write
=
isdn_tty_write
,
.
flush_chars
=
isdn_tty_flush_chars
,
.
write_room
=
isdn_tty_write_room
,
.
chars_in_buffer
=
isdn_tty_chars_in_buffer
,
.
flush_buffer
=
isdn_tty_flush_buffer
,
.
ioctl
=
isdn_tty_ioctl
,
.
throttle
=
isdn_tty_throttle
,
.
unthrottle
=
isdn_tty_unthrottle
,
.
set_termios
=
isdn_tty_set_termios
,
.
hangup
=
isdn_tty_hangup
,
};
int
isdn_tty_init
(
void
)
{
...
...
@@ -1994,36 +2009,21 @@ isdn_tty_init(void)
modem_info
*
info
;
m
=
&
isdn_mdm
;
memset
(
&
m
->
tty_modem
,
0
,
sizeof
(
struct
tty_driver
));
m
->
tty_modem
.
magic
=
TTY_DRIVER_MAGIC
;
m
->
tty_modem
.
name
=
"ttyI"
;
m
->
tty_modem
.
devfs_name
=
"isdn/ttyI"
;
m
->
tty_modem
.
major
=
ISDN_TTY_MAJOR
;
m
->
tty_modem
.
minor_start
=
0
;
m
->
tty_modem
.
num
=
ISDN_MAX_CHANNELS
;
m
->
tty_modem
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
m
->
tty_modem
.
subtype
=
SERIAL_TYPE_NORMAL
;
m
->
tty_modem
.
init_termios
=
tty_std_termios
;
m
->
tty_modem
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
m
->
tty_modem
.
flags
=
TTY_DRIVER_REAL_RAW
;
m
->
tty_modem
.
open
=
isdn_tty_open
;
m
->
tty_modem
.
close
=
isdn_tty_close
;
m
->
tty_modem
.
write
=
isdn_tty_write
;
m
->
tty_modem
.
put_char
=
NULL
;
m
->
tty_modem
.
flush_chars
=
isdn_tty_flush_chars
;
m
->
tty_modem
.
write_room
=
isdn_tty_write_room
;
m
->
tty_modem
.
chars_in_buffer
=
isdn_tty_chars_in_buffer
;
m
->
tty_modem
.
flush_buffer
=
isdn_tty_flush_buffer
;
m
->
tty_modem
.
ioctl
=
isdn_tty_ioctl
;
m
->
tty_modem
.
throttle
=
isdn_tty_throttle
;
m
->
tty_modem
.
unthrottle
=
isdn_tty_unthrottle
;
m
->
tty_modem
.
set_termios
=
isdn_tty_set_termios
;
m
->
tty_modem
.
stop
=
NULL
;
m
->
tty_modem
.
start
=
NULL
;
m
->
tty_modem
.
hangup
=
isdn_tty_hangup
;
m
->
tty_modem
.
driver_name
=
"isdn_tty"
;
retval
=
tty_register_driver
(
&
m
->
tty_modem
);
m
->
tty_modem
=
alloc_tty_driver
(
ISDN_MAX_CHANNELS
);
if
(
!
m
->
tty_modem
)
return
-
ENOMEM
;
m
->
tty_modem
->
name
=
"ttyI"
;
m
->
tty_modem
->
devfs_name
=
"isdn/ttyI"
;
m
->
tty_modem
->
major
=
ISDN_TTY_MAJOR
;
m
->
tty_modem
->
minor_start
=
0
;
m
->
tty_modem
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
m
->
tty_modem
->
subtype
=
SERIAL_TYPE_NORMAL
;
m
->
tty_modem
->
init_termios
=
tty_std_termios
;
m
->
tty_modem
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
m
->
tty_modem
->
flags
=
TTY_DRIVER_REAL_RAW
;
m
->
tty_modem
->
driver_name
=
"isdn_tty"
;
tty_set_operations
(
m
->
tty_modem
,
&
modem_ops
);
retval
=
tty_register_driver
(
m
->
tty_modem
);
if
(
retval
)
{
printk
(
KERN_WARNING
"isdn_tty: Couldn't register modem-device
\n
"
);
goto
err
;
...
...
@@ -2096,8 +2096,10 @@ isdn_tty_init(void)
kfree
(
info
->
xmit_buf
-
4
);
}
err_unregister_tty:
tty_unregister_driver
(
&
isdn_mdm
.
tty_modem
);
tty_unregister_driver
(
&
isdn_mdm
->
tty_modem
);
err:
put_tty_driver
(
&
isdn_mdm
->
tty_modem
);
isdn_mdm
->
tty_modem
=
NULL
;
return
retval
;
}
...
...
@@ -2116,7 +2118,9 @@ isdn_tty_exit(void)
#endif
kfree
(
info
->
xmit_buf
-
4
);
}
tty_unregister_driver
(
&
isdn_mdm
.
tty_modem
);
tty_unregister_driver
(
&
isdn_mdm
->
tty_modem
);
put_tty_driver
(
&
isdn_mdm
->
tty_modem
);
isdn_mdm
->
tty_modem
=
NULL
;
}
/*
...
...
drivers/isdn/i4l/isdn_tty.h
View file @
56250ab0
...
...
@@ -114,7 +114,7 @@ extern int isdn_tty_init(void);
extern
void
isdn_tty_exit
(
void
);
struct
isdn_modem
{
struct
tty_driver
tty_modem
;
/* tty-device */
struct
tty_driver
*
tty_modem
;
/* tty-device */
modem_info
info
[
ISDN_MAX_CHANNELS
];
/* Private data */
};
...
...
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