Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 82271
b: refs/heads/master
c: a1cd7e9
h: refs/heads/master
i:
  82269: 2b9e7a6
  82267: cc25a6b
  82263: 3ce6037
  82255: 7876933
  82239: 4431a57
v: v3
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Feb 1, 2008
1 parent dc8fea3 commit fc78c06
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 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: 828d55c58cba6b652fd30e00c3d940cb7c523e3c
refs/heads/master: a1cd7e99b343543af2be4c8c5755e26f6bfd725a
33 changes: 18 additions & 15 deletions trunk/drivers/usb/serial/mos7720.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,22 +564,25 @@ static void mos7720_close(struct usb_serial_port *port, struct file *filp)
}

/* While closing port, shutdown all bulk read, write *
* and interrupt read if they exists */
if (serial->dev) {
dbg("Shutdown bulk write");
usb_kill_urb(port->write_urb);
dbg("Shutdown bulk read");
usb_kill_urb(port->read_urb);
* and interrupt read if they exists, otherwise nop */
dbg("Shutdown bulk write");
usb_kill_urb(port->write_urb);
dbg("Shutdown bulk read");
usb_kill_urb(port->read_urb);

mutex_lock(&serial->disc_mutex);
/* these commands must not be issued if the device has
* been disconnected */
if (!serial->disconnected) {
data = 0x00;
send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
0x04, &data);

data = 0x00;
send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
0x01, &data);
}

data = 0x00;
send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
0x04, &data);

data = 0x00;
send_mos_cmd(serial, MOS_WRITE, port->number - port->serial->minor,
0x01, &data);

mutex_unlock(&serial->disc_mutex);
mos7720_port->open = 0;

dbg("Leaving %s", __FUNCTION__);
Expand Down
28 changes: 14 additions & 14 deletions trunk/drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ static struct usb_serial * create_serial (struct usb_device *dev,
serial->type = driver;
serial->interface = interface;
kref_init(&serial->kref);
mutex_init(&serial->disc_mutex);

return serial;
}
Expand Down Expand Up @@ -1089,20 +1090,22 @@ void usb_serial_disconnect(struct usb_interface *interface)
usb_serial_console_disconnect(serial);
dbg ("%s", __FUNCTION__);

mutex_lock(&serial->disc_mutex);
usb_set_intfdata (interface, NULL);
if (serial) {
for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i];
if (port) {
if (port->tty)
tty_hangup(port->tty);
kill_traffic(port);
}
/* must set a flag, to signal subdrivers */
serial->disconnected = 1;
for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i];
if (port) {
if (port->tty)
tty_hangup(port->tty);
kill_traffic(port);
}
/* let the last holder of this object
* cause it to be cleaned up */
usb_serial_put(serial);
}
/* let the last holder of this object
* cause it to be cleaned up */
mutex_unlock(&serial->disc_mutex);
usb_serial_put(serial);
dev_info(dev, "device disconnected\n");
}

Expand All @@ -1112,9 +1115,6 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
struct usb_serial_port *port;
int i, r = 0;

if (!serial) /* device has been disconnected */
return 0;

for (i = 0; i < serial->num_ports; ++i) {
port = serial->port[i];
if (port)
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/usb/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ struct usb_serial {
struct usb_device * dev;
struct usb_serial_driver * type;
struct usb_interface * interface;
unsigned char disconnected;
unsigned char minor;
unsigned char num_ports;
unsigned char num_port_pointers;
Expand All @@ -138,6 +139,7 @@ struct usb_serial {
char num_bulk_out;
struct usb_serial_port * port[MAX_NUM_PORTS];
struct kref kref;
struct mutex disc_mutex;
void * private;
};
#define to_usb_serial(d) container_of(d, struct usb_serial, kref)
Expand Down

0 comments on commit fc78c06

Please sign in to comment.