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
4dee1fc3
Commit
4dee1fc3
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/mxser.c converted to dynamic allocation
parent
a285b1ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
32 deletions
+37
-32
drivers/char/mxser.c
drivers/char/mxser.c
+37
-32
No files found.
drivers/char/mxser.c
View file @
4dee1fc3
...
...
@@ -288,7 +288,7 @@ static int mxserBoardCAP[MXSER_BOARDS] =
};
static
struct
tty_driver
mxvar_sdriver
;
static
struct
tty_driver
*
mxvar_sdriver
;
static
struct
mxser_struct
mxvar_table
[
MXSER_PORTS
];
static
struct
mxser_log
mxvar_log
;
static
int
mxvar_diagflag
;
...
...
@@ -364,8 +364,9 @@ static void __exit mxser_module_exit(void)
if
(
verbose
)
printk
(
"Unloading module mxser ...
\n
"
);
if
((
err
|=
tty_unregister_driver
(
&
mxvar_sdriver
)))
if
((
err
|=
tty_unregister_driver
(
mxvar_sdriver
)))
printk
(
"Couldn't unregister MOXA Smartio family serial driver
\n
"
);
put_tty_driver
(
mxvar_sdriver
);
for
(
i
=
0
;
i
<
MXSER_BOARDS
;
i
++
)
{
if
(
mxsercfg
[
i
].
board_type
==
-
1
)
...
...
@@ -475,6 +476,24 @@ static int mxser_get_PCI_conf(struct pci_dev *pdev, int board_type, struct mxser
return
(
0
);
}
static
struct
tty_operations
mxser_ops
=
{
.
open
=
mxser_open
,
.
close
=
mxser_close
,
.
write
=
mxser_write
,
.
put_char
=
mxser_put_char
,
.
flush_chars
=
mxser_flush_chars
,
.
write_room
=
mxser_write_room
,
.
chars_in_buffer
=
mxser_chars_in_buffer
,
.
flush_buffer
=
mxser_flush_buffer
,
.
ioctl
=
mxser_ioctl
,
.
throttle
=
mxser_throttle
,
.
unthrottle
=
mxser_unthrottle
,
.
set_termios
=
mxser_set_termios
,
.
stop
=
mxser_stop
,
.
start
=
mxser_start
,
.
hangup
=
mxser_hangup
,
};
static
int
__init
mxser_module_init
(
void
)
{
int
i
,
m
,
retval
,
b
;
...
...
@@ -482,39 +501,24 @@ static int __init mxser_module_init(void)
int
ret1
,
ret2
;
struct
mxser_hwconf
hwconf
;
mxvar_sdriver
=
alloc_tty_driver
(
MXSER_PORTS
+
1
);
if
(
!
mxvar_sdriver
)
return
-
ENOMEM
;
printk
(
"MOXA Smartio family driver version %s
\n
"
,
MXSER_VERSION
);
/* Initialize the tty_driver structure */
memset
(
&
mxvar_sdriver
,
0
,
sizeof
(
struct
tty_driver
));
mxvar_sdriver
.
magic
=
TTY_DRIVER_MAGIC
;
mxvar_sdriver
.
owner
=
THIS_MODULE
;
mxvar_sdriver
.
name
=
"ttyM"
;
mxvar_sdriver
.
major
=
ttymajor
;
mxvar_sdriver
.
minor_start
=
0
;
mxvar_sdriver
.
num
=
MXSER_PORTS
+
1
;
mxvar_sdriver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
mxvar_sdriver
.
subtype
=
SERIAL_TYPE_NORMAL
;
mxvar_sdriver
.
init_termios
=
tty_std_termios
;
mxvar_sdriver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
mxvar_sdriver
.
flags
=
TTY_DRIVER_REAL_RAW
;
mxvar_sdriver
.
open
=
mxser_open
;
mxvar_sdriver
.
close
=
mxser_close
;
mxvar_sdriver
.
write
=
mxser_write
;
mxvar_sdriver
.
put_char
=
mxser_put_char
;
mxvar_sdriver
.
flush_chars
=
mxser_flush_chars
;
mxvar_sdriver
.
write_room
=
mxser_write_room
;
mxvar_sdriver
.
chars_in_buffer
=
mxser_chars_in_buffer
;
mxvar_sdriver
.
flush_buffer
=
mxser_flush_buffer
;
mxvar_sdriver
.
ioctl
=
mxser_ioctl
;
mxvar_sdriver
.
throttle
=
mxser_throttle
;
mxvar_sdriver
.
unthrottle
=
mxser_unthrottle
;
mxvar_sdriver
.
set_termios
=
mxser_set_termios
;
mxvar_sdriver
.
stop
=
mxser_stop
;
mxvar_sdriver
.
start
=
mxser_start
;
mxvar_sdriver
.
hangup
=
mxser_hangup
;
mxvar_sdriver
->
owner
=
THIS_MODULE
;
mxvar_sdriver
->
name
=
"ttyM"
;
mxvar_sdriver
->
major
=
ttymajor
;
mxvar_sdriver
->
minor_start
=
0
;
mxvar_sdriver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
mxvar_sdriver
->
subtype
=
SERIAL_TYPE_NORMAL
;
mxvar_sdriver
->
init_termios
=
tty_std_termios
;
mxvar_sdriver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
mxvar_sdriver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
mxvar_sdriver
,
&
mxser_ops
);
printk
(
"Tty devices major number = %d
\n
"
,
ttymajor
);
mxvar_diagflag
=
0
;
...
...
@@ -640,9 +644,10 @@ static int __init mxser_module_init(void)
}
if
(
!
tty_register_driver
(
&
mxvar_sdriver
))
if
(
!
tty_register_driver
(
mxvar_sdriver
))
return
0
;
put_tty_driver
(
mxvar_sdriver
);
printk
(
"Couldn't install MOXA Smartio family driver !
\n
"
);
for
(
i
=
0
;
i
<
MXSER_BOARDS
;
i
++
)
{
...
...
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