diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2008-04-28 02:00:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 13:03:31 -0400 |
commit | fd05e720099e8eeddb378305d1a41c1445344b91 (patch) | |
tree | d617918be290b47b35822bc3cf21c8f01dde5dd2 /drivers/usb/serial | |
parent | 01d7b369887b6feb7c9ce2b20988fafe3f70841c (diff) |
drivers/usb annotations and fixes
* endianness annotations
* endianness fixes
* missing get_unaligned/put_unaligned
It's pretty much all over the place, changes to different files are independent.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Serial-parts-Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/aircable.c | 4 | ||||
-rw-r--r-- | drivers/usb/serial/cypress_m8.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/kl5kusb105.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/oti6858.c | 13 | ||||
-rw-r--r-- | drivers/usb/serial/spcp8x5.c | 13 |
7 files changed, 21 insertions, 18 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c index a238817762ad..9b1bb347dc2d 100644 --- a/drivers/usb/serial/aircable.c +++ b/drivers/usb/serial/aircable.c | |||
@@ -209,7 +209,7 @@ static void aircable_send(struct usb_serial_port *port) | |||
209 | int count, result; | 209 | int count, result; |
210 | struct aircable_private *priv = usb_get_serial_port_data(port); | 210 | struct aircable_private *priv = usb_get_serial_port_data(port); |
211 | unsigned char* buf; | 211 | unsigned char* buf; |
212 | u16 *dbuf; | 212 | __le16 *dbuf; |
213 | dbg("%s - port %d", __func__, port->number); | 213 | dbg("%s - port %d", __func__, port->number); |
214 | if (port->write_urb_busy) | 214 | if (port->write_urb_busy) |
215 | return; | 215 | return; |
@@ -227,7 +227,7 @@ static void aircable_send(struct usb_serial_port *port) | |||
227 | 227 | ||
228 | buf[0] = TX_HEADER_0; | 228 | buf[0] = TX_HEADER_0; |
229 | buf[1] = TX_HEADER_1; | 229 | buf[1] = TX_HEADER_1; |
230 | dbuf = (u16 *)&buf[2]; | 230 | dbuf = (__le16 *)&buf[2]; |
231 | *dbuf = cpu_to_le16((u16)count); | 231 | *dbuf = cpu_to_le16((u16)count); |
232 | serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); | 232 | serial_buf_get(priv->tx_buf,buf + HCI_HEADER_LENGTH, MAX_HCI_FRAMESIZE); |
233 | 233 | ||
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 32121794808d..0230d3c0888a 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -541,7 +541,7 @@ static int cypress_earthmate_startup (struct usb_serial *serial) | |||
541 | /* All Earthmate devices use the separated-count packet | 541 | /* All Earthmate devices use the separated-count packet |
542 | format! Idiotic. */ | 542 | format! Idiotic. */ |
543 | priv->pkt_fmt = packet_format_1; | 543 | priv->pkt_fmt = packet_format_1; |
544 | if (serial->dev->descriptor.idProduct != PRODUCT_ID_EARTHMATEUSB) { | 544 | if (serial->dev->descriptor.idProduct != cpu_to_le16(PRODUCT_ID_EARTHMATEUSB)) { |
545 | /* The old original USB Earthmate seemed able to | 545 | /* The old original USB Earthmate seemed able to |
546 | handle GET_CONFIG requests; everything they've | 546 | handle GET_CONFIG requests; everything they've |
547 | produced since that time crashes if this command is | 547 | produced since that time crashes if this command is |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 23f51a41093e..c7329f43d9c9 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -1104,7 +1104,7 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial) | |||
1104 | struct usb_endpoint_descriptor *ep_desc = &ep->desc; | 1104 | struct usb_endpoint_descriptor *ep_desc = &ep->desc; |
1105 | 1105 | ||
1106 | if (ep->enabled && ep_desc->wMaxPacketSize == 0) { | 1106 | if (ep->enabled && ep_desc->wMaxPacketSize == 0) { |
1107 | ep_desc->wMaxPacketSize = 0x40; | 1107 | ep_desc->wMaxPacketSize = cpu_to_le16(0x40); |
1108 | info("Fixing invalid wMaxPacketSize on read pipe"); | 1108 | info("Fixing invalid wMaxPacketSize on read pipe"); |
1109 | } | 1109 | } |
1110 | 1110 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index ce2e487f3240..06b52f4098f1 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2993,7 +2993,7 @@ static int edge_startup (struct usb_serial *serial) | |||
2993 | usb_fill_bulk_urb(edge_serial->read_urb, dev, | 2993 | usb_fill_bulk_urb(edge_serial->read_urb, dev, |
2994 | usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), | 2994 | usb_rcvbulkpipe(dev, endpoint->bEndpointAddress), |
2995 | edge_serial->bulk_in_buffer, | 2995 | edge_serial->bulk_in_buffer, |
2996 | endpoint->wMaxPacketSize, | 2996 | le16_to_cpu(endpoint->wMaxPacketSize), |
2997 | edge_bulk_in_callback, | 2997 | edge_bulk_in_callback, |
2998 | edge_serial); | 2998 | edge_serial); |
2999 | bulk_in_found = true; | 2999 | bulk_in_found = true; |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index b395ac759888..f328948d74e3 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/tty_flip.h> | 54 | #include <linux/tty_flip.h> |
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <asm/uaccess.h> | 56 | #include <asm/uaccess.h> |
57 | #include <asm/unaligned.h> | ||
57 | #include <linux/usb.h> | 58 | #include <linux/usb.h> |
58 | #include <linux/usb/serial.h> | 59 | #include <linux/usb/serial.h> |
59 | #include "kl5kusb105.h" | 60 | #include "kl5kusb105.h" |
@@ -235,7 +236,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port, | |||
235 | if (rc < 0) | 236 | if (rc < 0) |
236 | err("Reading line status failed (error = %d)", rc); | 237 | err("Reading line status failed (error = %d)", rc); |
237 | else { | 238 | else { |
238 | status = le16_to_cpu(*(u16 *)status_buf); | 239 | status = le16_to_cpu(get_unaligned((__le16 *)status_buf)); |
239 | 240 | ||
240 | info("%s - read status %x %x", __func__, | 241 | info("%s - read status %x %x", __func__, |
241 | status_buf[0], status_buf[1]); | 242 | status_buf[0], status_buf[1]); |
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c index d92bb6501c84..a9625c180dc3 100644 --- a/drivers/usb/serial/oti6858.c +++ b/drivers/usb/serial/oti6858.c | |||
@@ -98,7 +98,7 @@ struct oti6858_buf { | |||
98 | 98 | ||
99 | /* format of the control packet */ | 99 | /* format of the control packet */ |
100 | struct oti6858_control_pkt { | 100 | struct oti6858_control_pkt { |
101 | u16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */ | 101 | __le16 divisor; /* baud rate = 96000000 / (16 * divisor), LE */ |
102 | #define OTI6858_MAX_BAUD_RATE 3000000 | 102 | #define OTI6858_MAX_BAUD_RATE 3000000 |
103 | u8 frame_fmt; | 103 | u8 frame_fmt; |
104 | #define FMT_STOP_BITS_MASK 0xc0 | 104 | #define FMT_STOP_BITS_MASK 0xc0 |
@@ -211,7 +211,7 @@ struct oti6858_private { | |||
211 | struct delayed_work delayed_write_work; | 211 | struct delayed_work delayed_write_work; |
212 | 212 | ||
213 | struct { | 213 | struct { |
214 | u16 divisor; | 214 | __le16 divisor; |
215 | u8 frame_fmt; | 215 | u8 frame_fmt; |
216 | u8 control; | 216 | u8 control; |
217 | } pending_setup; | 217 | } pending_setup; |
@@ -450,7 +450,7 @@ static void oti6858_set_termios(struct usb_serial_port *port, | |||
450 | unsigned long flags; | 450 | unsigned long flags; |
451 | unsigned int cflag; | 451 | unsigned int cflag; |
452 | u8 frame_fmt, control; | 452 | u8 frame_fmt, control; |
453 | u16 divisor; | 453 | __le16 divisor; |
454 | int br; | 454 | int br; |
455 | 455 | ||
456 | dbg("%s(port = %d)", __func__, port->number); | 456 | dbg("%s(port = %d)", __func__, port->number); |
@@ -505,11 +505,12 @@ static void oti6858_set_termios(struct usb_serial_port *port, | |||
505 | divisor = 0; | 505 | divisor = 0; |
506 | } else { | 506 | } else { |
507 | int real_br; | 507 | int real_br; |
508 | int new_divisor; | ||
508 | br = min(br, OTI6858_MAX_BAUD_RATE); | 509 | br = min(br, OTI6858_MAX_BAUD_RATE); |
509 | 510 | ||
510 | divisor = (96000000 + 8 * br) / (16 * br); | 511 | new_divisor = (96000000 + 8 * br) / (16 * br); |
511 | real_br = 96000000 / (16 * divisor); | 512 | real_br = 96000000 / (16 * new_divisor); |
512 | divisor = cpu_to_le16(divisor); | 513 | divisor = cpu_to_le16(new_divisor); |
513 | tty_encode_baud_rate(port->tty, real_br, real_br); | 514 | tty_encode_baud_rate(port->tty, real_br, real_br); |
514 | } | 515 | } |
515 | 516 | ||
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c index 2282d620186e..55b2570b8b8b 100644 --- a/drivers/usb/serial/spcp8x5.c +++ b/drivers/usb/serial/spcp8x5.c | |||
@@ -310,17 +310,18 @@ static int spcp8x5_startup(struct usb_serial *serial) | |||
310 | struct spcp8x5_private *priv; | 310 | struct spcp8x5_private *priv; |
311 | int i; | 311 | int i; |
312 | enum spcp8x5_type type = SPCP825_007_TYPE; | 312 | enum spcp8x5_type type = SPCP825_007_TYPE; |
313 | u16 product = le16_to_cpu(serial->dev->descriptor.idProduct); | ||
313 | 314 | ||
314 | if (serial->dev->descriptor.idProduct == 0x0201) | 315 | if (product == 0x0201) |
315 | type = SPCP825_007_TYPE; | 316 | type = SPCP825_007_TYPE; |
316 | else if (serial->dev->descriptor.idProduct == 0x0231) | 317 | else if (product == 0x0231) |
317 | type = SPCP835_TYPE; | 318 | type = SPCP835_TYPE; |
318 | else if (serial->dev->descriptor.idProduct == 0x0235) | 319 | else if (product == 0x0235) |
319 | type = SPCP825_008_TYPE; | 320 | type = SPCP825_008_TYPE; |
320 | else if (serial->dev->descriptor.idProduct == 0x0204) | 321 | else if (product == 0x0204) |
321 | type = SPCP825_INTERMATIC_TYPE; | 322 | type = SPCP825_INTERMATIC_TYPE; |
322 | else if (serial->dev->descriptor.idProduct == 0x0471 && | 323 | else if (product == 0x0471 && |
323 | serial->dev->descriptor.idVendor == 0x081e) | 324 | serial->dev->descriptor.idVendor == cpu_to_le16(0x081e)) |
324 | type = SPCP825_PHILIP_TYPE; | 325 | type = SPCP825_PHILIP_TYPE; |
325 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); | 326 | dev_dbg(&serial->dev->dev, "device type = %d\n", (int)type); |
326 | 327 | ||