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
a7c4bba3
Commit
a7c4bba3
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/ser_a2232.c converted to dynamic allocation
parent
f50308a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
32 deletions
+36
-32
drivers/char/ser_a2232.c
drivers/char/ser_a2232.c
+36
-32
No files found.
drivers/char/ser_a2232.c
View file @
a7c4bba3
...
@@ -171,7 +171,7 @@ static void *a2232_driver_ID = &a2232_driver_ID; // Some memory address WE own.
...
@@ -171,7 +171,7 @@ static void *a2232_driver_ID = &a2232_driver_ID; // Some memory address WE own.
static
struct
a2232_port
a2232_ports
[
MAX_A2232_BOARDS
*
NUMLINES
];
static
struct
a2232_port
a2232_ports
[
MAX_A2232_BOARDS
*
NUMLINES
];
/* TTY driver structs */
/* TTY driver structs */
static
struct
tty_driver
a2232_driver
;
static
struct
tty_driver
*
a2232_driver
;
/* nr of cards completely (all ports) and correctly configured */
/* nr of cards completely (all ports) and correctly configured */
static
int
nr_a2232
;
static
int
nr_a2232
;
...
@@ -675,43 +675,46 @@ static void a2232_init_portstructs(void)
...
@@ -675,43 +675,46 @@ static void a2232_init_portstructs(void)
}
}
}
}
static
struct
tty_operations
a2232_ops
=
{
.
open
=
a2232_open
,
.
close
=
gs_close
,
.
write
=
gs_write
,
.
put_char
=
gs_put_char
,
.
flush_chars
=
gs_flush_chars
,
.
write_room
=
gs_write_room
,
.
chars_in_buffer
=
gs_chars_in_buffer
,
.
flush_buffer
=
gs_flush_buffer
,
.
ioctl
=
a2232_ioctl
,
.
throttle
=
a2232_throttle
,
.
unthrottle
=
a2232_unthrottle
,
.
set_termios
=
gs_set_termios
,
.
stop
=
gs_stop
,
.
start
=
gs_start
,
.
hangup
=
gs_hangup
,
};
static
int
a2232_init_drivers
(
void
)
static
int
a2232_init_drivers
(
void
)
{
{
int
error
;
int
error
;
memset
(
&
a2232_driver
,
0
,
sizeof
(
a2232_driver
)
);
a2232_driver
=
alloc_tty_driver
(
NUMLINES
*
nr_a2232
);
a2232_driver
.
magic
=
TTY_DRIVER_MAGIC
;
if
(
!
a2232_driver
)
a2232_driver
.
owner
=
THIS_MODULE
;
return
-
ENOMEM
;
a2232_driver
.
driver_name
=
"commodore_a2232"
;
a2232_driver
->
owner
=
THIS_MODULE
;
a2232_driver
.
name
=
"ttyY
"
;
a2232_driver
->
driver_name
=
"commodore_a2232
"
;
a2232_driver
.
major
=
A2232_NORMAL_MAJOR
;
a2232_driver
->
name
=
"ttyY"
;
a2232_driver
.
num
=
NUMLINES
*
nr_a2232
;
a2232_driver
->
major
=
A2232_NORMAL_MAJOR
;
a2232_driver
.
type
=
TTY_DRIVER_TYPE_SERIAL
;
a2232_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
a2232_driver
.
subtype
=
SERIAL_TTY_NORMAL
;
a2232_driver
->
subtype
=
SERIAL_TTY_NORMAL
;
a2232_driver
.
init_termios
=
tty_std_termios
;
a2232_driver
->
init_termios
=
tty_std_termios
;
a2232_driver
.
init_termios
.
c_cflag
=
a2232_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
a2232_driver
.
flags
=
TTY_DRIVER_REAL_RAW
;
a2232_driver
->
flags
=
TTY_DRIVER_REAL_RAW
;
tty_set_operations
(
a2232_driver
,
&
a2232_ops
);
a2232_driver
.
open
=
a2232_open
;
if
((
error
=
tty_register_driver
(
a2232_driver
)))
{
a2232_driver
.
close
=
gs_close
;
a2232_driver
.
write
=
gs_write
;
a2232_driver
.
put_char
=
gs_put_char
;
a2232_driver
.
flush_chars
=
gs_flush_chars
;
a2232_driver
.
write_room
=
gs_write_room
;
a2232_driver
.
chars_in_buffer
=
gs_chars_in_buffer
;
a2232_driver
.
flush_buffer
=
gs_flush_buffer
;
a2232_driver
.
ioctl
=
a2232_ioctl
;
a2232_driver
.
throttle
=
a2232_throttle
;
a2232_driver
.
unthrottle
=
a2232_unthrottle
;
a2232_driver
.
set_termios
=
gs_set_termios
;
a2232_driver
.
stop
=
gs_stop
;
a2232_driver
.
start
=
gs_start
;
a2232_driver
.
hangup
=
gs_hangup
;
if
((
error
=
tty_register_driver
(
&
a2232_driver
)))
{
printk
(
KERN_ERR
"A2232: Couldn't register A2232 driver, error = %d
\n
"
,
printk
(
KERN_ERR
"A2232: Couldn't register A2232 driver, error = %d
\n
"
,
error
);
error
);
put_tty_driver
(
a2232_driver
);
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -824,7 +827,8 @@ void cleanup_module(void)
...
@@ -824,7 +827,8 @@ void cleanup_module(void)
zorro_release_device
(
zd_a2232
[
i
]);
zorro_release_device
(
zd_a2232
[
i
]);
}
}
tty_unregister_driver
(
&
a2232_driver
);
tty_unregister_driver
(
a2232_driver
);
put_tty_driver
(
a2232_driver
);
free_irq
(
IRQ_AMIGA_VERTB
,
a2232_driver_ID
);
free_irq
(
IRQ_AMIGA_VERTB
,
a2232_driver_ID
);
}
}
#endif
#endif
...
...
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