diff options
author | Johan Hovold <jhovold@gmail.com> | 2013-04-16 12:01:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-17 13:05:34 -0400 |
commit | d91641b161594672242b3c5d8656ad3b2ef58f34 (patch) | |
tree | eb6d1f4edb5879cd9cef3ca34073053cad25f157 | |
parent | b42abbcde44a0a58e7dbaa4e3f0adc4cf5b74684 (diff) |
USB: omninet: clean up protocol defines
Remove redundant data-offset define, which was really just the header
length.
Add payload-size define and use the bulk-out size define for the actual
bulk-out size.
Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/omninet.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index ec16b92d52b3..9dcaa7727de5 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -154,9 +154,9 @@ static void omninet_close(struct usb_serial_port *port) | |||
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | #define OMNINET_DATAOFFSET 0x04 | 157 | #define OMNINET_HEADERLEN 4 |
158 | #define OMNINET_HEADERLEN sizeof(struct omninet_header) | 158 | #define OMNINET_BULKOUTSIZE 64 |
159 | #define OMNINET_BULKOUTSIZE (64 - OMNINET_HEADERLEN) | 159 | #define OMNINET_PAYLOADSIZE (OMNINET_BULKOUTSIZE - OMNINET_HEADERLEN) |
160 | 160 | ||
161 | static void omninet_read_bulk_callback(struct urb *urb) | 161 | static void omninet_read_bulk_callback(struct urb *urb) |
162 | { | 162 | { |
@@ -173,7 +173,7 @@ static void omninet_read_bulk_callback(struct urb *urb) | |||
173 | } | 173 | } |
174 | 174 | ||
175 | if (urb->actual_length && header->oh_len) { | 175 | if (urb->actual_length && header->oh_len) { |
176 | tty_insert_flip_string(&port->port, data + OMNINET_DATAOFFSET, | 176 | tty_insert_flip_string(&port->port, data + OMNINET_HEADERLEN, |
177 | header->oh_len); | 177 | header->oh_len); |
178 | tty_flip_buffer_push(&port->port); | 178 | tty_flip_buffer_push(&port->port); |
179 | } | 179 | } |
@@ -208,9 +208,9 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
208 | return 0; | 208 | return 0; |
209 | } | 209 | } |
210 | 210 | ||
211 | count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count; | 211 | count = (count > OMNINET_PAYLOADSIZE) ? OMNINET_PAYLOADSIZE : count; |
212 | 212 | ||
213 | memcpy(wport->write_urb->transfer_buffer + OMNINET_DATAOFFSET, | 213 | memcpy(wport->write_urb->transfer_buffer + OMNINET_HEADERLEN, |
214 | buf, count); | 214 | buf, count); |
215 | 215 | ||
216 | usb_serial_debug_data(&port->dev, __func__, count, | 216 | usb_serial_debug_data(&port->dev, __func__, count, |
@@ -222,7 +222,7 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
222 | header->oh_pad = 0x00; | 222 | header->oh_pad = 0x00; |
223 | 223 | ||
224 | /* send the data out the bulk port, always 64 bytes */ | 224 | /* send the data out the bulk port, always 64 bytes */ |
225 | wport->write_urb->transfer_buffer_length = 64; | 225 | wport->write_urb->transfer_buffer_length = OMNINET_BULKOUTSIZE; |
226 | 226 | ||
227 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); | 227 | result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); |
228 | if (result) { | 228 | if (result) { |