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
e1127c36
Commit
e1127c36
authored
Mar 21, 2002
by
Greg Kroah-Hartman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
USB serial drivers
changes due to open_count being handled by the usb-serial core code.
parent
9fb1cce0
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
732 additions
and
987 deletions
+732
-987
drivers/usb/serial/belkin_sa.c
drivers/usb/serial/belkin_sa.c
+20
-32
drivers/usb/serial/cyberjack.c
drivers/usb/serial/cyberjack.c
+23
-36
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/digi_acceleport.c
+0
-32
drivers/usb/serial/empeg.c
drivers/usb/serial/empeg.c
+21
-43
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.c
+55
-75
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/io_edgeport.c
+132
-147
drivers/usb/serial/ipaq.c
drivers/usb/serial/ipaq.c
+82
-101
drivers/usb/serial/ir-usb.c
drivers/usb/serial/ir-usb.c
+37
-46
drivers/usb/serial/keyspan.c
drivers/usb/serial/keyspan.c
+9
-21
drivers/usb/serial/keyspan_pda.c
drivers/usb/serial/keyspan_pda.c
+42
-57
drivers/usb/serial/kl5kusb105.c
drivers/usb/serial/kl5kusb105.c
+86
-98
drivers/usb/serial/mct_u232.c
drivers/usb/serial/mct_u232.c
+48
-61
drivers/usb/serial/omninet.c
drivers/usb/serial/omninet.c
+25
-39
drivers/usb/serial/pl2303.c
drivers/usb/serial/pl2303.c
+72
-84
drivers/usb/serial/visor.c
drivers/usb/serial/visor.c
+37
-50
drivers/usb/serial/whiteheat.c
drivers/usb/serial/whiteheat.c
+43
-65
No files found.
drivers/usb/serial/belkin_sa.c
View file @
e1127c36
...
...
@@ -191,9 +191,6 @@ static void belkin_sa_shutdown (struct usb_serial *serial)
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
belkin_sa_close
(
&
serial
->
port
[
i
],
NULL
);
}
/* My special items, the standard routines free my urbs */
if
(
serial
->
port
[
i
].
private
)
kfree
(
serial
->
port
[
i
].
private
);
...
...
@@ -207,9 +204,6 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/*Start reading from the device*/
/* TODO: Look at possibility of submitting mulitple URBs to device to
* enhance buffering. Win trace shows 16 initial read URBs.
...
...
@@ -225,7 +219,6 @@ static int belkin_sa_open (struct usb_serial_port *port, struct file *filp)
retval
=
usb_submit_urb
(
port
->
interrupt_in_urb
,
GFP_KERNEL
);
if
(
retval
)
err
(
" usb_submit_urb(read int) failed"
);
}
exit:
return
retval
;
...
...
@@ -245,17 +238,12 @@ static void belkin_sa_close (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* shutdown our bulk reads and writes */
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
usb_unlink_urb
(
port
->
interrupt_in_urb
);
}
port
->
open_count
=
0
;
}
}
/* belkin_sa_close */
...
...
drivers/usb/serial/cyberjack.c
View file @
e1127c36
...
...
@@ -130,11 +130,7 @@ static void cyberjack_shutdown (struct usb_serial *serial)
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
cyberjack_close
(
&
serial
->
port
[
i
],
NULL
);
}
/* My special items, the standard routines free my urbs */
if
(
serial
->
port
[
i
].
private
)
kfree
(
serial
->
port
[
i
].
private
);
...
...
@@ -151,9 +147,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* force low_latency on so that our tty_push actually forces
* the data through, otherwise it is scheduled, and with high
* data rates (like with OHCI) data can get lost.
...
...
@@ -175,7 +168,6 @@ static int cyberjack_open (struct usb_serial_port *port, struct file *filp)
if
(
result
)
err
(
" usb_submit_urb(read int) failed"
);
dbg
(
__FUNCTION__
" - usb_submit_urb(int urb)"
);
}
return
result
;
}
...
...
@@ -184,17 +176,12 @@ static void cyberjack_close (struct usb_serial_port *port, struct file *filp)
{
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
port
->
serial
->
dev
)
{
/* shutdown any bulk reads that might be going on */
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
usb_unlink_urb
(
port
->
interrupt_in_urb
);
}
port
->
open_count
=
0
;
}
}
static
int
cyberjack_write
(
struct
usb_serial_port
*
port
,
int
from_user
,
const
unsigned
char
*
buf
,
int
count
)
...
...
drivers/usb/serial/digi_acceleport.c
View file @
e1127c36
...
...
@@ -1490,28 +1490,17 @@ dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_cou
return
(
-
EAGAIN
);
}
/* inc module use count before sleeping to wait for closes */
++
port
->
open_count
;
/* wait for a close in progress to finish */
while
(
priv
->
dp_in_close
)
{
cond_wait_interruptible_timeout_irqrestore
(
&
priv
->
dp_close_wait
,
DIGI_RETRY_TIMEOUT
,
&
priv
->
dp_port_lock
,
flags
);
if
(
signal_pending
(
current
)
)
{
--
port
->
open_count
;
return
(
-
EINTR
);
}
spin_lock_irqsave
(
&
priv
->
dp_port_lock
,
flags
);
}
/* if port is already open, just return */
/* be sure exactly one open proceeds */
if
(
port
->
open_count
!=
1
)
{
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
return
(
0
);
}
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
/* read modem signals automatically whenever they change */
...
...
@@ -1557,14 +1546,6 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
/* do cleanup only after final close on this port */
spin_lock_irqsave
(
&
priv
->
dp_port_lock
,
flags
);
if
(
port
->
open_count
>
1
)
{
--
port
->
open_count
;
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
return
;
}
else
if
(
port
->
open_count
<=
0
)
{
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
return
;
}
priv
->
dp_in_close
=
1
;
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
...
...
@@ -1637,7 +1618,6 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
spin_lock_irqsave
(
&
priv
->
dp_port_lock
,
flags
);
priv
->
dp_write_urb_in_use
=
0
;
priv
->
dp_in_close
=
0
;
--
port
->
open_count
;
wake_up_interruptible
(
&
priv
->
dp_close_wait
);
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
...
...
@@ -1765,8 +1745,6 @@ static void digi_shutdown( struct usb_serial *serial )
{
int
i
;
struct
digi_port
*
priv
;
unsigned
long
flags
;
dbg
(
"digi_shutdown: TOP, in_interrupt()=%d"
,
in_interrupt
()
);
...
...
@@ -1777,16 +1755,6 @@ dbg( "digi_shutdown: TOP, in_interrupt()=%d", in_interrupt() );
usb_unlink_urb
(
serial
->
port
[
i
].
write_urb
);
}
/* dec module use count */
for
(
i
=
0
;
i
<
serial
->
type
->
num_ports
;
i
++
)
{
priv
=
serial
->
port
[
i
].
private
;
spin_lock_irqsave
(
&
priv
->
dp_port_lock
,
flags
);
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
--
serial
->
port
[
i
].
open_count
;
}
spin_unlock_irqrestore
(
&
priv
->
dp_port_lock
,
flags
);
}
/* free the private data structures for all ports */
/* number of regular ports + 1 for the out-of-band port */
for
(
i
=
0
;
i
<
serial
->
type
->
num_ports
+
1
;
i
++
)
...
...
drivers/usb/serial/empeg.c
View file @
e1127c36
...
...
@@ -157,10 +157,6 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* Force default termio settings */
empeg_set_termios
(
port
,
NULL
)
;
...
...
@@ -185,8 +181,6 @@ static int empeg_open (struct usb_serial_port *port, struct file *filp)
if
(
result
)
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
result
);
}
return
result
;
}
...
...
@@ -204,16 +198,10 @@ static void empeg_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* shutdown our bulk read */
usb_unlink_urb
(
port
->
read_urb
);
}
port
->
open_count
=
0
;
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
}
...
...
@@ -491,17 +479,7 @@ static int empeg_startup (struct usb_serial *serial)
static
void
empeg_shutdown
(
struct
usb_serial
*
serial
)
{
int
i
;
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
empeg_close
(
&
serial
->
port
[
i
],
NULL
);
}
}
}
...
...
drivers/usb/serial/ftdi_sio.c
View file @
e1127c36
...
...
@@ -294,14 +294,8 @@ static int ftdi_8U232AM_startup (struct usb_serial *serial)
static
void
ftdi_sio_shutdown
(
struct
usb_serial
*
serial
)
{
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
while
(
serial
->
port
[
0
].
open_count
>
0
)
{
ftdi_sio_close
(
&
serial
->
port
[
0
],
NULL
);
}
if
(
serial
->
port
[
0
].
private
){
kfree
(
serial
->
port
[
0
].
private
);
serial
->
port
[
0
].
private
=
NULL
;
...
...
@@ -319,9 +313,6 @@ static int ftdi_sio_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
){
/* This will push the characters through immediately rather
than queue a task to deliver them */
port
->
tty
->
low_latency
=
1
;
...
...
@@ -357,7 +348,6 @@ static int ftdi_sio_open (struct usb_serial_port *port, struct file *filp)
result
=
usb_submit_urb
(
port
->
read_urb
,
GFP_KERNEL
);
if
(
result
)
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
result
);
}
return
result
;
}
/* ftdi_sio_open */
...
...
@@ -371,9 +361,6 @@ static void ftdi_sio_close (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
if
(
c_cflag
&
HUPCL
){
/* Disable flow control */
...
...
@@ -400,13 +387,6 @@ static void ftdi_sio_close (struct usb_serial_port *port, struct file *filp)
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
}
port
->
open_count
=
0
;
}
else
{
/* Send a HUP if necessary */
if
(
!
(
port
->
tty
->
termios
->
c_cflag
&
CLOCAL
)){
tty_hangup
(
port
->
tty
);
}
}
}
/* ftdi_sio_close */
...
...
drivers/usb/serial/io_edgeport.c
View file @
e1127c36
...
...
@@ -987,9 +987,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
if
(
edge_port
==
NULL
)
return
-
ENODEV
;
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* force low_latency on so that our tty_push actually forces the data through,
otherwise it is scheduled, and with high data rates (like with OHCI) data
can get lost. */
...
...
@@ -1000,7 +997,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
serial
=
port
->
serial
;
edge_serial
=
(
struct
edgeport_serial
*
)
serial
->
private
;
if
(
edge_serial
==
NULL
)
{
port
->
open_count
=
0
;
return
-
ENODEV
;
}
if
(
edge_serial
->
interrupt_in_buffer
==
NULL
)
{
...
...
@@ -1062,7 +1058,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
if
(
response
<
0
)
{
err
(
__FUNCTION__
" - error sending open port command"
);
edge_port
->
openPending
=
FALSE
;
port
->
open_count
=
0
;
return
-
ENODEV
;
}
...
...
@@ -1076,7 +1071,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
/* open timed out */
dbg
(
__FUNCTION__
" - open timedout"
);
edge_port
->
openPending
=
FALSE
;
port
->
open_count
=
0
;
return
-
ENODEV
;
}
...
...
@@ -1103,7 +1097,6 @@ static int edge_open (struct usb_serial_port *port, struct file * filp)
}
dbg
(
__FUNCTION__
"(%d) - Initialize TX fifo to %d bytes"
,
port
->
number
,
edge_port
->
maxTxCredits
);
}
dbg
(
__FUNCTION__
" exited"
);
...
...
@@ -1234,9 +1227,6 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
if
((
edge_serial
==
NULL
)
||
(
edge_port
==
NULL
))
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
// block until tx is empty
block_until_tx_empty
(
edge_port
);
...
...
@@ -1279,8 +1269,6 @@ static void edge_close (struct usb_serial_port *port, struct file * filp)
if
(
edge_port
->
txfifo
.
fifo
)
{
kfree
(
edge_port
->
txfifo
.
fifo
);
}
port
->
open_count
=
0
;
}
dbg
(
__FUNCTION__
" exited"
);
}
...
...
@@ -3027,9 +3015,6 @@ static void edge_shutdown (struct usb_serial *serial)
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
edge_close
(
&
serial
->
port
[
i
],
NULL
);
}
kfree
(
serial
->
port
[
i
].
private
);
serial
->
port
[
i
].
private
=
NULL
;
}
...
...
drivers/usb/serial/ipaq.c
View file @
e1127c36
...
...
@@ -123,9 +123,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
bytes_in
=
0
;
bytes_out
=
0
;
priv
=
(
struct
ipaq_private
*
)
kmalloc
(
sizeof
(
struct
ipaq_private
),
GFP_KERNEL
);
...
...
@@ -210,7 +207,6 @@ static int ipaq_open(struct usb_serial_port *port, struct file *filp)
if
(
result
<
0
)
{
err
(
__FUNCTION__
" - failed doing control urb, error %d"
,
result
);
}
}
return
result
;
...
...
@@ -237,10 +233,6 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
/*
* shut down bulk read and write
*/
...
...
@@ -250,9 +242,7 @@ static void ipaq_close(struct usb_serial_port *port, struct file *filp)
ipaq_destroy_lists
(
port
);
kfree
(
priv
);
port
->
private
=
NULL
;
port
->
open_count
=
0
;
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
}
...
...
@@ -507,16 +497,7 @@ static int ipaq_startup(struct usb_serial *serial)
static
void
ipaq_shutdown
(
struct
usb_serial
*
serial
)
{
int
i
;
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
ipaq_close
(
&
serial
->
port
[
i
],
NULL
);
}
}
}
static
int
__init
ipaq_init
(
void
)
...
...
drivers/usb/serial/ir-usb.c
View file @
e1127c36
...
...
@@ -283,9 +283,6 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
dbg
(
"%s - port %d"
,
__FUNCTION__
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
if
(
buffer_size
)
{
/* override the default buffer sizes */
buffer
=
kmalloc
(
buffer_size
,
GFP_KERNEL
);
...
...
@@ -321,7 +318,7 @@ static int ir_open (struct usb_serial_port *port, struct file *filp)
result
=
usb_submit_urb
(
port
->
read_urb
,
GFP_KERNEL
);
if
(
result
)
err
(
"%s - failed submitting read urb, error %d"
,
__FUNCTION__
,
result
);
}
return
result
;
}
...
...
@@ -338,16 +335,10 @@ static void ir_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* shutdown our bulk read */
usb_unlink_urb
(
port
->
read_urb
);
}
port
->
open_count
=
0
;
}
}
static
int
ir_write
(
struct
usb_serial_port
*
port
,
int
from_user
,
const
unsigned
char
*
buf
,
int
count
)
...
...
drivers/usb/serial/keyspan.c
View file @
e1127c36
...
...
@@ -852,7 +852,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
struct
keyspan_serial_private
*
s_priv
;
struct
usb_serial
*
serial
=
port
->
serial
;
const
struct
keyspan_device_details
*
d_details
;
int
i
,
already_active
,
err
;
int
i
,
err
;
struct
urb
*
urb
;
s_priv
=
(
struct
keyspan_serial_private
*
)(
serial
->
private
);
...
...
@@ -861,12 +861,6 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
dbg
(
"keyspan_open called for port%d.
\n
"
,
port
->
number
);
already_active
=
port
->
open_count
;
++
port
->
open_count
;
if
(
already_active
)
return
0
;
p_priv
=
(
struct
keyspan_port_private
*
)(
port
->
private
);
/* Set some sane defaults */
...
...
@@ -924,7 +918,6 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
p_priv
->
out_flip
=
0
;
p_priv
->
in_flip
=
0
;
if
(
--
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* Stop reading/writing urbs */
stop_urb
(
p_priv
->
inack_urb
);
...
...
@@ -934,9 +927,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
stop_urb
(
p_priv
->
out_urbs
[
i
]);
}
}
port
->
open_count
=
0
;
port
->
tty
=
0
;
}
}
...
...
@@ -1762,9 +1753,6 @@ static void keyspan_shutdown (struct usb_serial *serial)
/* Now free per port private data */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
i
++
)
{
port
=
&
serial
->
port
[
i
];
while
(
port
->
open_count
>
0
)
{
--
port
->
open_count
;
}
kfree
(
port
->
private
);
}
}
...
...
drivers/usb/serial/keyspan_pda.c
View file @
e1127c36
...
...
@@ -662,9 +662,6 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp)
int
rc
=
0
;
struct
keyspan_pda_private
*
priv
;
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* find out how much room is in the Tx ring */
rc
=
usb_control_msg
(
serial
->
dev
,
usb_rcvctrlpipe
(
serial
->
dev
,
0
),
6
,
/* write_room */
...
...
@@ -703,11 +700,7 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp)
goto
error
;
}
}
return
rc
;
error:
--
port
->
open_count
;
return
rc
;
}
...
...
@@ -716,9 +709,6 @@ static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp)
{
struct
usb_serial
*
serial
=
port
->
serial
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* the normal serial device seems to always shut off DTR and RTS now */
if
(
port
->
tty
->
termios
->
c_cflag
&
HUPCL
)
...
...
@@ -728,8 +718,6 @@ static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp)
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
interrupt_in_urb
);
}
port
->
open_count
=
0
;
}
}
...
...
@@ -805,9 +793,6 @@ static void keyspan_pda_shutdown (struct usb_serial *serial)
{
dbg
(
__FUNCTION__
);
while
(
serial
->
port
[
0
].
open_count
>
0
)
{
keyspan_pda_close
(
&
serial
->
port
[
0
],
NULL
);
}
kfree
(
serial
->
port
[
0
].
private
);
}
...
...
drivers/usb/serial/kl5kusb105.c
View file @
e1127c36
...
...
@@ -317,9 +317,6 @@ static void klsi_105_shutdown (struct usb_serial *serial)
struct
klsi_105_private
*
priv
=
(
struct
klsi_105_private
*
)
serial
->
port
[
i
].
private
;
unsigned
long
flags
;
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
klsi_105_close
(
&
serial
->
port
[
i
],
NULL
);
}
if
(
priv
)
{
/* kill our write urb pool */
...
...
@@ -355,16 +352,12 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp)
struct
usb_serial
*
serial
=
port
->
serial
;
struct
klsi_105_private
*
priv
=
(
struct
klsi_105_private
*
)
port
->
private
;
int
retval
=
0
;
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
int
rc
;
int
i
;
unsigned
long
line_state
;
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
/* force low_latency on so that our tty_push actually forces
* the data through
* port->tty->low_latency = 1; */
...
...
@@ -432,7 +425,6 @@ static int klsi_105_open (struct usb_serial_port *port, struct file *filp)
retval
=
0
;
}
else
retval
=
rc
;
}
exit:
return
retval
;
...
...
@@ -444,6 +436,7 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
struct
usb_serial
*
serial
;
struct
klsi_105_private
*
priv
=
(
struct
klsi_105_private
*
)
port
->
private
;
int
rc
;
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
serial
=
get_usb_serial
(
port
,
__FUNCTION__
);
...
...
@@ -451,11 +444,8 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
/* send READ_OFF */
int
rc
=
usb_control_msg
(
serial
->
dev
,
rc
=
usb_control_msg
(
serial
->
dev
,
usb_sndctrlpipe
(
serial
->
dev
,
0
),
KL5KUSB105A_SIO_CONFIGURE
,
USB_TYPE_VENDOR
|
USB_DIR_OUT
,
...
...
@@ -473,9 +463,7 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
/* FIXME */
/* wgg - do I need this? I think so. */
usb_unlink_urb
(
port
->
interrupt_in_urb
);
port
->
open_count
=
0
;
info
(
"kl5kusb105 port stats: %ld bytes in, %ld bytes out"
,
priv
->
bytes_in
,
priv
->
bytes_out
);
}
}
/* klsi_105_close */
...
...
drivers/usb/serial/mct_u232.c
View file @
e1127c36
...
...
@@ -324,9 +324,6 @@ static void mct_u232_shutdown (struct usb_serial *serial)
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
mct_u232_close
(
&
serial
->
port
[
i
],
NULL
);
}
/* My special items, the standard routines free my urbs */
if
(
serial
->
port
[
i
].
private
)
kfree
(
serial
->
port
[
i
].
private
);
...
...
@@ -341,9 +338,6 @@ static int mct_u232_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* Compensate for a hardware bug: although the Sitecom U232-P25
* device reports a maximum output packet size of 32 bytes,
* it seems to be able to accept only 16 bytes (and that's what
...
...
@@ -393,8 +387,6 @@ static int mct_u232_open (struct usb_serial_port *port, struct file *filp)
if
(
retval
)
err
(
" usb_submit_urb(read int) failed"
);
}
exit:
return
0
;
}
/* mct_u232_open */
...
...
@@ -404,17 +396,12 @@ static void mct_u232_close (struct usb_serial_port *port, struct file *filp)
{
dbg
(
__FUNCTION__
" port %d"
,
port
->
number
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
port
->
serial
->
dev
)
{
/* shutdown our urbs */
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
usb_unlink_urb
(
port
->
interrupt_in_urb
);
}
port
->
open_count
=
0
;
}
}
/* mct_u232_close */
...
...
drivers/usb/serial/omninet.c
View file @
e1127c36
...
...
@@ -157,13 +157,9 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
if
(
!
serial
)
return
-
ENODEV
;
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
od
=
kmalloc
(
sizeof
(
struct
omninet_data
),
GFP_KERNEL
);
if
(
!
od
)
{
err
(
__FUNCTION__
"- kmalloc(%Zd) failed."
,
sizeof
(
struct
omninet_data
));
port
->
open_count
=
0
;
return
-
ENOMEM
;
}
...
...
@@ -179,7 +175,6 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp)
result
=
usb_submit_urb
(
port
->
read_urb
,
GFP_KERNEL
);
if
(
result
)
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
result
);
}
return
result
;
}
...
...
@@ -199,20 +194,15 @@ static void omninet_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
wport
=
&
serial
->
port
[
1
];
usb_unlink_urb
(
wport
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
}
port
->
open_count
=
0
;
od
=
(
struct
omninet_data
*
)
port
->
private
;
if
(
od
)
kfree
(
od
);
}
}
...
...
@@ -377,10 +367,6 @@ static void omninet_write_bulk_callback (struct urb *urb)
static
void
omninet_shutdown
(
struct
usb_serial
*
serial
)
{
dbg
(
__FUNCTION__
);
while
(
serial
->
port
[
0
].
open_count
>
0
)
{
omninet_close
(
&
serial
->
port
[
0
],
NULL
);
}
}
...
...
drivers/usb/serial/pl2303.c
View file @
e1127c36
...
...
@@ -367,9 +367,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
#define FISH(a,b,c,d) \
result=usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev,0), \
b, a, c, d, buf, 1, 100); \
...
...
@@ -417,7 +414,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
pl2303_close
(
port
,
NULL
);
return
-
EPROTO
;
}
}
return
0
;
}
...
...
@@ -437,8 +433,6 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
c_cflag
=
port
->
tty
->
termios
->
c_cflag
;
if
(
c_cflag
&
HUPCL
)
{
...
...
@@ -469,8 +463,6 @@ static void pl2303_close (struct usb_serial_port *port, struct file *filp)
"(interrupt_in_urb) failed with reason: %d"
,
result
);
}
port
->
open_count
=
0
;
}
}
static
int
set_modem_info
(
struct
usb_serial_port
*
port
,
unsigned
int
cmd
,
unsigned
int
*
value
)
...
...
@@ -577,12 +569,8 @@ static void pl2303_shutdown (struct usb_serial *serial)
dbg
(
__FUNCTION__
);
/* stop everything on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
pl2303_close
(
&
serial
->
port
[
i
],
NULL
);
kfree
(
serial
->
port
[
i
].
private
);
}
}
...
...
drivers/usb/serial/visor.c
View file @
e1127c36
...
...
@@ -268,19 +268,19 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
if
(
!
port
->
read_urb
)
{
/* this is needed for some brain dead Sony devices */
err
(
"Device lied about number of ports, please use a lower one."
);
return
-
ENODEV
;
}
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
bytes_in
=
0
;
bytes_out
=
0
;
/* force low_latency on so that our tty_push actually forces the data through,
otherwise it is scheduled, and with high data rates (like with OHCI) data
can get lost. */
/*
* Force low_latency on so that our tty_push actually forces the data
* through, otherwise it is scheduled, and with high data rates (like
* with OHCI) data can get lost.
*/
port
->
tty
->
low_latency
=
1
;
/* Start reading from the device */
...
...
@@ -293,7 +293,6 @@ static int visor_open (struct usb_serial_port *port, struct file *filp)
result
=
usb_submit_urb
(
port
->
read_urb
,
GFP_KERNEL
);
if
(
result
)
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
result
);
}
return
result
;
}
...
...
@@ -313,9 +312,6 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
if
(
!
serial
)
return
;
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
if
(
serial
->
dev
)
{
/* only send a shutdown message if the
* device is still here */
...
...
@@ -334,8 +330,6 @@ static void visor_close (struct usb_serial_port *port, struct file * filp)
/* shutdown our bulk read */
usb_unlink_urb
(
port
->
read_urb
);
}
port
->
open_count
=
0
;
}
/* Uncomment the following line if you want to see some statistics in your syslog */
/* info ("Bytes In = %d Bytes Out = %d", bytes_in, bytes_out); */
}
...
...
@@ -655,16 +649,9 @@ static int clie_3_5_startup (struct usb_serial *serial)
static
void
visor_shutdown
(
struct
usb_serial
*
serial
)
{
int
i
;
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
serial
->
port
[
i
].
open_count
=
0
;
}
static
int
visor_ioctl
(
struct
usb_serial_port
*
port
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
dbg
(
__FUNCTION__
" - port %d, cmd 0x%.4x"
,
port
->
number
,
cmd
);
...
...
drivers/usb/serial/whiteheat.c
View file @
e1127c36
...
...
@@ -306,9 +306,6 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
++
port
->
open_count
;
if
(
port
->
open_count
==
1
)
{
/* set up some stuff for our command port */
command_port
=
&
port
->
serial
->
port
[
COMMAND_PORT
];
if
(
command_port
->
private
==
NULL
)
{
...
...
@@ -316,7 +313,7 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
if
(
info
==
NULL
)
{
err
(
__FUNCTION__
" - out of memory"
);
retval
=
-
ENOMEM
;
goto
error_
exit
;
goto
exit
;
}
init_waitqueue_head
(
&
info
->
wait_command
);
...
...
@@ -328,7 +325,7 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
retval
=
usb_submit_urb
(
command_port
->
read_urb
,
GFP_KERNEL
);
if
(
retval
)
{
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
retval
);
goto
error_
exit
;
goto
exit
;
}
}
...
...
@@ -337,7 +334,7 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
retval
=
usb_submit_urb
(
port
->
read_urb
,
GFP_KERNEL
);
if
(
retval
)
{
err
(
__FUNCTION__
" - failed submitting read urb, error %d"
,
retval
);
goto
error_
exit
;
goto
exit
;
}
/* send an open port command */
...
...
@@ -345,19 +342,13 @@ static int whiteheat_open (struct usb_serial_port *port, struct file *filp)
open_command
.
port
=
port
->
number
-
port
->
serial
->
minor
+
1
;
retval
=
whiteheat_send_cmd
(
port
->
serial
,
WHITEHEAT_OPEN
,
(
__u8
*
)
&
open_command
,
sizeof
(
open_command
));
if
(
retval
)
goto
error_
exit
;
goto
exit
;
/* Need to do device specific setup here (control lines, baud rate, etc.) */
/* FIXME!!! */
}
dbg
(
__FUNCTION__
" - exit"
);
return
retval
;
error_exit:
--
port
->
open_count
;
dbg
(
__FUNCTION__
" - error_exit"
);
exit:
dbg
(
__FUNCTION__
" - exit, retval = %d"
,
retval
);
return
retval
;
}
...
...
@@ -368,9 +359,6 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
dbg
(
__FUNCTION__
" - port %d"
,
port
->
number
);
--
port
->
open_count
;
if
(
port
->
open_count
<=
0
)
{
/* send a close command to the port */
/* firmware uses 1 based port numbering */
close_command
.
port
=
port
->
number
-
port
->
serial
->
minor
+
1
;
...
...
@@ -382,8 +370,6 @@ static void whiteheat_close(struct usb_serial_port *port, struct file * filp)
/* shutdown our bulk reads and writes */
usb_unlink_urb
(
port
->
write_urb
);
usb_unlink_urb
(
port
->
read_urb
);
port
->
open_count
=
0
;
}
}
...
...
@@ -642,17 +628,9 @@ static int whiteheat_real_startup (struct usb_serial *serial)
static
void
whiteheat_real_shutdown
(
struct
usb_serial
*
serial
)
{
struct
usb_serial_port
*
command_port
;
int
i
;
dbg
(
__FUNCTION__
);
/* stop reads and writes on all ports */
for
(
i
=
0
;
i
<
serial
->
num_ports
;
++
i
)
{
while
(
serial
->
port
[
i
].
open_count
>
0
)
{
whiteheat_close
(
&
serial
->
port
[
i
],
NULL
);
}
}
/* free up our private data for our command port */
command_port
=
&
serial
->
port
[
COMMAND_PORT
];
if
(
command_port
->
private
!=
NULL
)
{
...
...
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