Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364861
b: refs/heads/master
c: a6c042f
h: refs/heads/master
i:
  364859: 39bd94d
v: v3
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Apr 17, 2013
1 parent d4e04d4 commit 2ac43ed
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 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: d91641b161594672242b3c5d8656ad3b2ef58f34
refs/heads/master: a6c042f95031afbeb0b0fb77643bc9211a3f2e2e
25 changes: 18 additions & 7 deletions trunk/drivers/usb/serial/omninet.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,26 @@ static void omninet_close(struct usb_serial_port *port)
#define OMNINET_BULKOUTSIZE 64
#define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN)

static void omninet_process_read_urb(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
const struct omninet_header *hdr = urb->transfer_buffer;
const unsigned char *data;
size_t data_len;

if (urb->actual_length <= OMNINET_HEADERLEN || !hdr->oh_len)
return;

data = (char *)urb->transfer_buffer + OMNINET_HEADERLEN;
data_len = min_t(size_t, urb->actual_length - OMNINET_HEADERLEN,
hdr->oh_len);
tty_insert_flip_string(&port->port, data, data_len);
tty_flip_buffer_push(&port->port);
}

static void omninet_read_bulk_callback(struct urb *urb)
{
struct usb_serial_port *port = urb->context;
unsigned char *data = urb->transfer_buffer;
struct omninet_header *header = (struct omninet_header *) &data[0];
int status = urb->status;
int result;

Expand All @@ -172,11 +187,7 @@ static void omninet_read_bulk_callback(struct urb *urb)
return;
}

if (urb->actual_length && header->oh_len) {
tty_insert_flip_string(&port->port, data + OMNINET_HEADERLEN,
header->oh_len);
tty_flip_buffer_push(&port->port);
}
omninet_process_read_urb(urb);

/* Continue trying to always read */
result = usb_submit_urb(urb, GFP_ATOMIC);
Expand Down

0 comments on commit 2ac43ed

Please sign in to comment.