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
850a46e6
Commit
850a46e6
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/usb/serial/usb-serial.c converted to dynamic allocation
parent
c4ac40f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
23 deletions
+26
-23
drivers/usb/serial/bus.c
drivers/usb/serial/bus.c
+2
-2
drivers/usb/serial/usb-serial.c
drivers/usb/serial/usb-serial.c
+23
-20
drivers/usb/serial/usb-serial.h
drivers/usb/serial/usb-serial.h
+1
-1
No files found.
drivers/usb/serial/bus.c
View file @
850a46e6
...
...
@@ -76,7 +76,7 @@ static int usb_serial_device_probe (struct device *dev)
}
minor
=
port
->
number
;
tty_register_device
(
&
usb_serial_tty_driver
,
minor
,
dev
);
tty_register_device
(
usb_serial_tty_driver
,
minor
,
dev
);
dev_info
(
&
port
->
serial
->
dev
->
dev
,
"%s converter now attached to ttyUSB%d (or usb/tts/%d for devfs)
\n
"
,
driver
->
name
,
minor
,
minor
);
...
...
@@ -109,7 +109,7 @@ static int usb_serial_device_remove (struct device *dev)
}
exit:
minor
=
port
->
number
;
tty_unregister_device
(
&
usb_serial_tty_driver
,
minor
);
tty_unregister_device
(
usb_serial_tty_driver
,
minor
);
dev_info
(
dev
,
"%s converter now disconnected from ttyUSB%d
\n
"
,
driver
->
name
,
minor
);
...
...
drivers/usb/serial/usb-serial.c
View file @
850a46e6
...
...
@@ -1295,20 +1295,7 @@ void usb_serial_disconnect(struct usb_interface *interface)
dev_info
(
dev
,
"device disconnected
\n
"
);
}
struct
tty_driver
usb_serial_tty_driver
=
{
.
magic
=
TTY_DRIVER_MAGIC
,
.
owner
=
THIS_MODULE
,
.
driver_name
=
"usbserial"
,
.
devfs_name
=
"usb/tts/"
,
.
name
=
"ttyUSB"
,
.
major
=
SERIAL_TTY_MAJOR
,
.
minor_start
=
0
,
.
num
=
SERIAL_TTY_MINORS
,
.
type
=
TTY_DRIVER_TYPE_SERIAL
,
.
subtype
=
SERIAL_TYPE_NORMAL
,
.
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
,
static
struct
tty_operations
serial_ops
=
{
.
open
=
serial_open
,
.
close
=
serial_close
,
.
write
=
serial_write
,
...
...
@@ -1324,12 +1311,17 @@ struct tty_driver usb_serial_tty_driver = {
.
tiocmset
=
serial_tiocmset
,
};
struct
tty_driver
*
usb_serial_tty_driver
;
static
int
__init
usb_serial_init
(
void
)
{
int
i
;
int
result
=
0
;
usb_serial_tty_driver
=
alloc_tty_driver
(
SERIAL_TTY_MINORS
);
if
(
!
usb_serial_tty_driver
)
return
-
ENOMEM
;
/* Initialize our global data */
for
(
i
=
0
;
i
<
SERIAL_TTY_MINORS
;
++
i
)
{
serial_table
[
i
]
=
NULL
;
...
...
@@ -1344,10 +1336,19 @@ static int __init usb_serial_init(void)
goto
exit
;
}
/* register the tty driver */
usb_serial_tty_driver
.
init_termios
=
tty_std_termios
;
usb_serial_tty_driver
.
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
result
=
tty_register_driver
(
&
usb_serial_tty_driver
);
usb_serial_tty_driver
->
owner
=
THIS_MODULE
;
usb_serial_tty_driver
->
driver_name
=
"usbserial"
;
usb_serial_tty_driver
->
devfs_name
=
"usb/tts/"
;
usb_serial_tty_driver
->
name
=
"ttyUSB"
;
usb_serial_tty_driver
->
major
=
SERIAL_TTY_MAJOR
;
usb_serial_tty_driver
->
minor_start
=
0
;
usb_serial_tty_driver
->
type
=
TTY_DRIVER_TYPE_SERIAL
;
usb_serial_tty_driver
->
subtype
=
SERIAL_TYPE_NORMAL
;
usb_serial_tty_driver
->
flags
=
TTY_DRIVER_REAL_RAW
|
TTY_DRIVER_NO_DEVFS
;
usb_serial_tty_driver
->
init_termios
=
tty_std_termios
;
usb_serial_tty_driver
->
init_termios
.
c_cflag
=
B9600
|
CS8
|
CREAD
|
HUPCL
|
CLOCAL
;
tty_set_operations
(
usb_serial_tty_driver
,
&
serial_ops
);
result
=
tty_register_driver
(
usb_serial_tty_driver
);
if
(
result
)
{
err
(
"%s - tty_register_driver failed"
,
__FUNCTION__
);
goto
exit_generic
;
...
...
@@ -1365,13 +1366,14 @@ static int __init usb_serial_init(void)
return
result
;
exit_tty:
tty_unregister_driver
(
&
usb_serial_tty_driver
);
tty_unregister_driver
(
usb_serial_tty_driver
);
exit_generic:
usb_serial_generic_deregister
();
exit:
err
(
"%s - returning with error %d"
,
__FUNCTION__
,
result
);
put_tty_driver
(
usb_serial_tty_driver
);
return
result
;
}
...
...
@@ -1383,7 +1385,8 @@ static void __exit usb_serial_exit(void)
usb_serial_generic_deregister
();
usb_deregister
(
&
usb_serial_driver
);
tty_unregister_driver
(
&
usb_serial_tty_driver
);
tty_unregister_driver
(
usb_serial_tty_driver
);
put_tty_driver
(
usb_serial_tty_driver
);
bus_unregister
(
&
usb_serial_bus_type
);
}
...
...
drivers/usb/serial/usb-serial.h
View file @
850a46e6
...
...
@@ -297,7 +297,7 @@ extern void usb_serial_bus_deregister (struct usb_serial_device_type *device);
extern
struct
usb_serial_device_type
usb_serial_generic_device
;
extern
struct
bus_type
usb_serial_bus_type
;
extern
struct
tty_driver
usb_serial_tty_driver
;
extern
struct
tty_driver
*
usb_serial_tty_driver
;
/* Inline functions to check the sanity of a pointer that is passed to us */
static
inline
int
serial_paranoia_check
(
struct
usb_serial
*
serial
,
const
char
*
function
)
...
...
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