diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 14:19:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-27 14:19:17 -0700 |
commit | 50f732ee63b91eb08a29974b36bd63e1150bb642 (patch) | |
tree | fdfc63411a34ffbe26a3b0a997aaeff742a0301b /drivers/usb/serial/omninet.c | |
parent | aa5bc2b58e3344da57f26b62e99e13e91c9e0a94 (diff) | |
parent | a7205b30106a2d4ee268132644cdb292da2d9b41 (diff) | |
download | linux-50f732ee63b91eb08a29974b36bd63e1150bb642.tar.bz2 |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (78 commits)
USB: update MAINAINERS and CREDITS for Freescale USB driver
USB: update gadget files for fsl_usb2_udc driver
USB: add Freescale high-speed USB SOC device controller driver
USB: quirk for broken suspend of IT8152F/G
USB: iowarrior.c: timeouts too small in usb_control_msg calls
USB: dell device id for option.c
USB: Remove Huawei unusual_devs entry
USB: CP2101 New Device IDs
USB: add picdem device to ldusb
usbfs micro optimitation
USB: remove ancient/broken CRIS hcd
usb ethernet gadget, workaround network stack API glitch
USB: add "busnum" attribute for USB devices
USB: cxacru: ADSL state management
usbatm: Detect usb device shutdown and ignore failed urbs
USB: Remove duplicate define of OHCI_QUIRK_ZFMICRO
USB: BandRich BandLuxe HSDPA Data Card Driver
USB gadget rndis: fix struct rndis_packet_msg_type unaligned bug
USB Elan FTDI: check for driver registration status
USB: sierra: add more checks on shutdown
...
Diffstat (limited to 'drivers/usb/serial/omninet.c')
-rw-r--r-- | drivers/usb/serial/omninet.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 0216ac12a27d..4adfab988e86 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c @@ -69,6 +69,7 @@ static void omninet_write_bulk_callback (struct urb *urb); static int omninet_write (struct usb_serial_port *port, const unsigned char *buf, int count); static int omninet_write_room (struct usb_serial_port *port); static void omninet_shutdown (struct usb_serial *serial); +static int omninet_attach (struct usb_serial *serial); static struct usb_device_id id_table [] = { { USB_DEVICE(ZYXEL_VENDOR_ID, ZYXEL_OMNINET_ID) }, @@ -99,6 +100,7 @@ static struct usb_serial_driver zyxel_omninet_device = { .num_bulk_in = 1, .num_bulk_out = 2, .num_ports = 1, + .attach = omninet_attach, .open = omninet_open, .close = omninet_close, .write = omninet_write, @@ -145,22 +147,30 @@ struct omninet_data __u8 od_outseq; // Sequence number for bulk_out URBs }; +static int omninet_attach (struct usb_serial *serial) +{ + struct omninet_data *od; + struct usb_serial_port *port = serial->port[0]; + + od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); + if( !od ) { + err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); + return -ENOMEM; + } + usb_set_serial_port_data(port, od); + return 0; +} + static int omninet_open (struct usb_serial_port *port, struct file *filp) { struct usb_serial *serial = port->serial; struct usb_serial_port *wport; - struct omninet_data *od; + struct omninet_data *od = usb_get_serial_port_data(port); int result = 0; dbg("%s - port %d", __FUNCTION__, port->number); od = kmalloc( sizeof(struct omninet_data), GFP_KERNEL ); - if( !od ) { - err("%s- kmalloc(%Zd) failed.", __FUNCTION__, sizeof(struct omninet_data)); - return -ENOMEM; - } - - usb_set_serial_port_data(port, od); wport = serial->port[1]; wport->tty = port->tty; @@ -170,24 +180,17 @@ static int omninet_open (struct usb_serial_port *port, struct file *filp) port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, omninet_read_bulk_callback, port); result = usb_submit_urb(port->read_urb, GFP_KERNEL); - if (result) + if (result) { err("%s - failed submitting read urb, error %d", __FUNCTION__, result); + } return result; } static void omninet_close (struct usb_serial_port *port, struct file * filp) { - struct usb_serial *serial = port->serial; - struct usb_serial_port *wport; - dbg("%s - port %d", __FUNCTION__, port->number); - - wport = serial->port[1]; - usb_kill_urb(wport->write_urb); usb_kill_urb(port->read_urb); - - kfree(usb_get_serial_port_data(port)); } @@ -326,7 +329,12 @@ static void omninet_write_bulk_callback (struct urb *urb) static void omninet_shutdown (struct usb_serial *serial) { + struct usb_serial_port *wport = serial->port[1]; + struct usb_serial_port *port = serial->port[0]; dbg ("%s", __FUNCTION__); + + usb_kill_urb(wport->write_urb); + kfree(usb_get_serial_port_data(port)); } |