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
a285b1ea
Commit
a285b1ea
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/moxa.c converted to dynamic allocation
parent
59e89646
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
34 deletions
+39
-34
drivers/char/moxa.c
drivers/char/moxa.c
+39
-34
No files found.
drivers/char/moxa.c
View file @
a285b1ea
...
@@ -206,7 +206,7 @@ MODULE_PARM(verbose, "i");
...
@@ -206,7 +206,7 @@ MODULE_PARM(verbose, "i");
#endif //MODULE
#endif //MODULE
static
struct
tty_driver
moxaDriver
;
static
struct
tty_driver
*
moxaDriver
;
static
struct
moxa_str
moxaChannels
[
MAX_PORTS
];
static
struct
moxa_str
moxaChannels
[
MAX_PORTS
];
static
unsigned
char
*
moxaXmitBuff
;
static
unsigned
char
*
moxaXmitBuff
;
static
int
moxaTimer_on
;
static
int
moxaTimer_on
;
...
@@ -308,14 +308,33 @@ void cleanup_module(void)
...
@@ -308,14 +308,33 @@ void cleanup_module(void)
if
(
moxaEmptyTimer_on
[
i
])
if
(
moxaEmptyTimer_on
[
i
])
del_timer
(
&
moxaEmptyTimer
[
i
]);
del_timer
(
&
moxaEmptyTimer
[
i
]);
if
(
tty_unregister_driver
(
&
moxaDriver
))
if
(
tty_unregister_driver
(
moxaDriver
))
printk
(
"Couldn't unregister MOXA Intellio family serial driver
\n
"
);
printk
(
"Couldn't unregister MOXA Intellio family serial driver
\n
"
);
put_tty_driver
(
moxaDriver
);
if
(
verbose
)
if
(
verbose
)
printk
(
"Done
\n
"
);
printk
(
"Done
\n
"
);
}
}
#endif
#endif
static
struct
tty_operations
moxa_ops
=
{
.
open
=
moxa_open
,
.
close
=
moxa_close
,
.
write
=
moxa_write
,
.
write_room
=
moxa_write_room
,
.
flush_buffer
=
moxa_flush_buffer
,
.
chars_in_buffer
=
moxa_chars_in_buffer
,
.
flush_chars
=
moxa_flush_chars
,
.
put_char
=
moxa_put_char
,
.
ioctl
=
moxa_ioctl
,
.
throttle
=
moxa_throttle
,
.
unthrottle
=
moxa_unthrottle
,
.
set_termios
=
moxa_set_termios
,
.
stop
=
moxa_stop
,
.
start
=
moxa_start
,
.
hangup
=
moxa_hangup
,
};
int
moxa_init
(
void
)
int
moxa_init
(
void
)
{
{
int
i
,
n
,
numBoards
;
int
i
,
n
,
numBoards
;
...
@@ -323,39 +342,24 @@ int moxa_init(void)
...
@@ -323,39 +342,24 @@ int moxa_init(void)
int
ret1
,
ret2
;
int
ret1
,
ret2
;
printk
(
KERN_INFO
"MOXA Intellio family driver version %s
\n
"
,
MOXA_VERSION
);
printk
(
KERN_INFO
"MOXA Intellio family driver version %s
\n
"
,
MOXA_VERSION
);
moxaDriver
=
alloc_tty_driver
(
MAX_PORTS
+
1
);
if
(
!
moxaDriver
)
return
-
ENOMEM
;
init_MUTEX
(
&
moxaBuffSem
);
init_MUTEX
(
&
moxaBuffSem
);
memset
(
&
moxaDriver
,
0
,
sizeof
(
struct
tty_driver
));
moxaDriver
->
owner
=
THIS_MODULE
;
moxaDriver
.
magic
=
TTY_DRIVER_MAGIC
;
moxaDriver
->
name
=
"ttya"
;
moxaDriver
.
owner
=
THIS_MODULE
;
moxaDriver
->
major
=
ttymajor
;
moxaDriver
.
name
=
"ttya"
;
moxaDriver
->
minor_start
=
0
;
moxaDriver
.
major
=
ttymajor
;
moxaDriver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
moxaDriver
.
minor_start
=
0
;
moxaDriver
->
subtype
=
SERIAL_TYPE_NORMAL
;
moxaDriver
.
num
=
MAX_PORTS
+
1
;
moxaDriver
->
init_termios
=
tty_std_termios
;
moxaDriver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
moxaDriver
->
init_termios
.
c_iflag
=
0
;
moxaDriver
.
subtype
=
SERIAL_TYPE_NORMAL
;
moxaDriver
->
init_termios
.
c_oflag
=
0
;
moxaDriver
.
init_termios
=
tty_std_termios
;
moxaDriver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
CLOCAL
|
HUPCL
;
moxaDriver
.
init_termios
.
c_iflag
=
0
;
moxaDriver
->
init_termios
.
c_lflag
=
0
;
moxaDriver
.
init_termios
.
c_oflag
=
0
;
moxaDriver
->
flags
=
TTY_DRIVER_REAL_RAW
;
moxaDriver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
CLOCAL
|
HUPCL
;
tty_set_operations
(
moxaDriver
,
&
moxa_ops
);
moxaDriver
.
init_termios
.
c_lflag
=
0
;
moxaDriver
.
flags
=
TTY_DRIVER_REAL_RAW
;
moxaDriver
.
open
=
moxa_open
;
moxaDriver
.
close
=
moxa_close
;
moxaDriver
.
write
=
moxa_write
;
moxaDriver
.
write_room
=
moxa_write_room
;
moxaDriver
.
flush_buffer
=
moxa_flush_buffer
;
moxaDriver
.
chars_in_buffer
=
moxa_chars_in_buffer
;
moxaDriver
.
flush_chars
=
moxa_flush_chars
;
moxaDriver
.
put_char
=
moxa_put_char
;
moxaDriver
.
ioctl
=
moxa_ioctl
;
moxaDriver
.
throttle
=
moxa_throttle
;
moxaDriver
.
unthrottle
=
moxa_unthrottle
;
moxaDriver
.
set_termios
=
moxa_set_termios
;
moxaDriver
.
stop
=
moxa_stop
;
moxaDriver
.
start
=
moxa_start
;
moxaDriver
.
hangup
=
moxa_hangup
;
moxaXmitBuff
=
0
;
moxaXmitBuff
=
0
;
...
@@ -384,8 +388,9 @@ int moxa_init(void)
...
@@ -384,8 +388,9 @@ int moxa_init(void)
MoxaDriverInit
();
MoxaDriverInit
();
printk
(
"Tty devices major number = %d
\n
"
,
ttymajor
);
printk
(
"Tty devices major number = %d
\n
"
,
ttymajor
);
if
(
tty_register_driver
(
&
moxaDriver
))
{
if
(
tty_register_driver
(
moxaDriver
))
{
printk
(
KERN_ERR
"Couldn't install MOXA Smartio family driver !
\n
"
);
printk
(
KERN_ERR
"Couldn't install MOXA Smartio family driver !
\n
"
);
put_tty_driver
(
moxaDriver
);
return
-
1
;
return
-
1
;
}
}
for
(
i
=
0
;
i
<
MAX_PORTS
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_PORTS
;
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