# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.629 -> 1.630 # drivers/usb/serial/omninet.c 1.12 -> 1.13 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 02/08/29 greg@kroah.com 1.630 # USB: omninet update due to usbserial core changes. # -------------------------------------------- # diff -Nru a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c --- a/drivers/usb/serial/omninet.c Thu Aug 29 13:54:28 2002 +++ b/drivers/usb/serial/omninet.c Thu Aug 29 13:54:28 2002 @@ -37,18 +37,15 @@ #include #include -#include -#include #include -#include #include #include -#include #include #include #include #include #include +#include #include #ifdef CONFIG_USB_SERIAL_DEBUG @@ -88,22 +85,20 @@ static struct usb_serial_device_type zyxel_omninet_device = { - name: "ZyXEL - omni.net lcd plus usb", - id_table: id_table, - needs_interrupt_in: MUST_HAVE, - needs_bulk_in: MUST_HAVE, - needs_bulk_out: MUST_HAVE, - num_interrupt_in: 1, - num_bulk_in: 1, - num_bulk_out: 2, - num_ports: 1, - open: omninet_open, - close: omninet_close, - write: omninet_write, - write_room: omninet_write_room, - read_bulk_callback: omninet_read_bulk_callback, - write_bulk_callback: omninet_write_bulk_callback, - shutdown: omninet_shutdown, + .owner = THIS_MODULE, + .name = "ZyXEL - omni.net lcd plus usb", + .id_table = id_table, + .num_interrupt_in = 1, + .num_bulk_in = 1, + .num_bulk_out = 2, + .num_ports = 1, + .open = omninet_open, + .close = omninet_close, + .write = omninet_write, + .write_room = omninet_write_room, + .read_bulk_callback = omninet_read_bulk_callback, + .write_bulk_callback = omninet_write_bulk_callback, + .shutdown = omninet_shutdown, }; @@ -159,39 +154,24 @@ if (!serial) return -ENODEV; - down (&port->sem); - - MOD_INC_USE_COUNT; - ++port->open_count; - - if (!port->active) { - port->active = 1; - - od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); - if( !od ) { - err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); - --port->open_count; - port->active = 0; - up (&port->sem); - MOD_DEC_USE_COUNT; - return -ENOMEM; - } - - port->private = od; - wport = &serial->port[1]; - wport->tty = port->tty; - - /* Start reading from the device */ - FILL_BULK_URB(port->read_urb, serial->dev, - usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), - port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, - omninet_read_bulk_callback, port); - result = usb_submit_urb(port->read_urb); - if (result) - err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); + if( !od ) { + err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); + return -ENOMEM; } - up (&port->sem); + port->private = od; + wport = &serial->port[1]; + wport->tty = port->tty; + + /* Start reading from the device */ + FILL_BULK_URB(port->read_urb, serial->dev, + usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), + port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, + omninet_read_bulk_callback, port); + result = usb_submit_urb(port->read_urb); + if (result) + err("%s - failed submitting read urb, error %d", __FUNCTION__, result); return result; } @@ -211,26 +191,15 @@ if (!serial) return; - down (&port->sem); - - --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->active = 0; - port->open_count = 0; - od = (struct omninet_data *)port->private; - if (od) - kfree(od); + if (serial->dev) { + wport = &serial->port[1]; + usb_unlink_urb (wport->write_urb); + usb_unlink_urb (port->read_urb); } - up (&port->sem); - MOD_DEC_USE_COUNT; + od = (struct omninet_data *)port->private; + if (od) + kfree(od); } @@ -395,10 +364,6 @@ static void omninet_shutdown (struct usb_serial *serial) { dbg ("%s", __FUNCTION__); - - while (serial->port[0].open_count > 0) { - omninet_close (&serial->port[0], NULL); - } }