diff options
author | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2006-01-27 17:18:29 -0500 |
commit | 292dd876ee765c478b27c93cc51e93a558ed58bf (patch) | |
tree | 5b740e93253295baee2a9c414a6c66d03d44a9ef /drivers/usb/gadget/serial.c | |
parent | d4ec6c7cc9a15a7a529719bc3b84f46812f9842e (diff) | |
parent | 9fdb62af92c741addbea15545f214a6e89460865 (diff) |
Pull release into acpica branch
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r-- | drivers/usb/gadget/serial.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 65e084a2c87e..ba9acd531024 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c @@ -374,9 +374,6 @@ static struct usb_gadget_driver gs_gadget_driver = { .disconnect = gs_disconnect, .driver = { .name = GS_SHORT_NAME, - /* .shutdown = ... */ - /* .suspend = ... */ - /* .resume = ... */ }, }; @@ -1271,6 +1268,7 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) unsigned int len; struct gs_port *port; int ret; + struct tty_struct *tty; /* TEMPORARY -- only port 0 is supported right now */ port = dev->dev_port[0]; @@ -1290,7 +1288,10 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) goto exit; } - if (port->port_tty == NULL) { + + tty = port->port_tty; + + if (tty == NULL) { printk(KERN_ERR "gs_recv_packet: port=%d, NULL tty pointer\n", port->port_num); ret = -EIO; @@ -1304,20 +1305,13 @@ static int gs_recv_packet(struct gs_dev *dev, char *packet, unsigned int size) goto exit; } - len = (unsigned int)(TTY_FLIPBUF_SIZE - port->port_tty->flip.count); - if (len < size) - size = len; - - if (size > 0) { - memcpy(port->port_tty->flip.char_buf_ptr, packet, size); - port->port_tty->flip.char_buf_ptr += size; - port->port_tty->flip.count += size; + len = tty_buffer_request_room(tty, size); + if (len > 0) { + tty_insert_flip_string(tty, packet, len); tty_flip_buffer_push(port->port_tty); wake_up_interruptible(&port->port_tty->read_wait); } - ret = 0; - exit: spin_unlock(&port->port_lock); return ret; |