Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163875
b: refs/heads/master
c: ff8324d
h: refs/heads/master
i:
  163873: c79627f
  163871: 89c2d07
v: v3
  • Loading branch information
Alan Stern authored and Live-CD User committed Sep 19, 2009
1 parent 4c7610c commit 78bd271
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 74556123e034c8337b69a3ebac2f3a5fc0a97032
refs/heads/master: ff8324df1187b7280e507c976777df76c73a1ef1
21 changes: 17 additions & 4 deletions trunk/drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
struct usb_serial_port *port;
int retval = -ENODEV;

dbg("%s", __func__);

serial = usb_serial_get_by_index(idx);
if (!serial)
return retval;
Expand Down Expand Up @@ -250,11 +252,11 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
int retval = 0;
int first = 0;

dbg("%s", __func__);

port = tty->driver_data;
serial = port->serial;

dbg("%s - port %d", __func__, port->number);

if (mutex_lock_interruptible(&port->mutex))
return -ERESTARTSYS;

Expand Down Expand Up @@ -315,6 +317,12 @@ static void serial_down(struct usb_serial_port *port)
if (port->console)
return;

/* Don't call the close method if the hardware hasn't been
* initialized.
*/
if (!test_and_clear_bit(ASYNCB_INITIALIZED, &port->port.flags))
return;

mutex_lock(&port->mutex);
serial = port->serial;
owner = serial->type->driver.owner;
Expand All @@ -328,10 +336,11 @@ static void serial_down(struct usb_serial_port *port)
static void serial_hangup(struct tty_struct *tty)
{
struct usb_serial_port *port = tty->driver_data;

dbg("%s - port %d", __func__, port->number);

serial_down(port);
tty_port_hangup(&port->port);
/* We must not free port yet - the USB serial layer depends on it's
continued existence */
}

static void serial_close(struct tty_struct *tty, struct file *filp)
Expand All @@ -340,6 +349,8 @@ static void serial_close(struct tty_struct *tty, struct file *filp)

dbg("%s - port %d", __func__, port->number);

if (tty_hung_up_p(filp))
return;
if (tty_port_close_start(&port->port, tty, filp) == 0)
return;
serial_down(port);
Expand Down Expand Up @@ -368,6 +379,8 @@ static void serial_release(struct tty_struct *tty)
if (port->console)
return;

dbg("%s - port %d", __func__, port->number);

/* Standard shutdown processing */
tty_shutdown(tty);

Expand Down

0 comments on commit 78bd271

Please sign in to comment.