patch-2.4.12 linux/drivers/usb/serial/pl2303.c
Next file: linux/drivers/usb/serial/usb-serial.h
Previous file: linux/drivers/usb/serial/omninet.c
Back to the patch index
Back to the overall index
- Lines: 75
- Date:
Wed Oct 10 23:42:47 2001
- Orig file:
v2.4.11/linux/drivers/usb/serial/pl2303.c
- Orig date:
Tue Oct 9 17:06:53 2001
diff -u --recursive --new-file v2.4.11/linux/drivers/usb/serial/pl2303.c linux/drivers/usb/serial/pl2303.c
@@ -434,40 +434,53 @@
static void pl2303_close (struct usb_serial_port *port, struct file *filp)
{
+ struct usb_serial *serial;
struct pl2303_private *priv;
unsigned int c_cflag;
int result;
if (port_paranoia_check (port, __FUNCTION__))
return;
-
+ serial = get_usb_serial (port, __FUNCTION__);
+ if (!serial)
+ return;
+
dbg (__FUNCTION__ " - port %d", port->number);
down (&port->sem);
--port->open_count;
if (port->open_count <= 0) {
- c_cflag = port->tty->termios->c_cflag;
- if (c_cflag & HUPCL) {
- /* drop DTR and RTS */
- priv = port->private;
- priv->line_control = 0;
- set_control_lines (port->serial->dev, priv->line_control);
+ if (serial->dev) {
+ c_cflag = port->tty->termios->c_cflag;
+ if (c_cflag & HUPCL) {
+ /* drop DTR and RTS */
+ priv = port->private;
+ priv->line_control = 0;
+ set_control_lines (port->serial->dev,
+ priv->line_control);
+ }
+
+ /* shutdown our urbs */
+ dbg (__FUNCTION__ " - shutting down urbs");
+ result = usb_unlink_urb (port->write_urb);
+ if (result)
+ dbg (__FUNCTION__ " - usb_unlink_urb "
+ "(write_urb) failed with reason: %d",
+ result);
+
+ result = usb_unlink_urb (port->read_urb);
+ if (result)
+ dbg (__FUNCTION__ " - usb_unlink_urb "
+ "(read_urb) failed with reason: %d",
+ result);
+
+ result = usb_unlink_urb (port->interrupt_in_urb);
+ if (result)
+ dbg (__FUNCTION__ " - usb_unlink_urb "
+ "(interrupt_in_urb) failed with reason: %d",
+ result);
}
-
- /* shutdown our urbs */
- dbg (__FUNCTION__ " - shutting down urbs");
- result = usb_unlink_urb (port->write_urb);
- if (result)
- dbg (__FUNCTION__ " - usb_unlink_urb (write_urb) failed with reason: %d", result);
-
- result = usb_unlink_urb (port->read_urb);
- if (result)
- dbg (__FUNCTION__ " - usb_unlink_urb (read_urb) failed with reason: %d", result);
-
- result = usb_unlink_urb (port->interrupt_in_urb);
- if (result)
- dbg (__FUNCTION__ " - usb_unlink_urb (interrupt_in_urb) failed with reason: %d", result);
port->active = 0;
port->open_count = 0;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)