aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-06 02:23:37 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-06 02:23:37 -0400
commite12fe68ce34d60c04bb1ddb1d3cc5c3022388fe4 (patch)
tree83c0e192ccaa4752c80b6131a7d0aa8272b5d0d0 /drivers/net/usb
parent7329f0d58de01878d9ce4f0be7a76e136f223eef (diff)
parent712ae51afd55b20c04c5383d02ba5d10233313b1 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/kalmia.c42
-rw-r--r--drivers/net/usb/zaurus.c10
2 files changed, 25 insertions, 27 deletions
diff --git a/drivers/net/usb/kalmia.c b/drivers/net/usb/kalmia.c
index d965fb1e013e..a9b6c63d54e4 100644
--- a/drivers/net/usb/kalmia.c
+++ b/drivers/net/usb/kalmia.c
@@ -100,34 +100,42 @@ kalmia_send_init_packet(struct usbnet *dev, u8 *init_msg, u8 init_msg_len,
100static int 100static int
101kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr) 101kalmia_init_and_get_ethernet_addr(struct usbnet *dev, u8 *ethernet_addr)
102{ 102{
103 char init_msg_1[] = 103 const static char init_msg_1[] =
104 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 104 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00,
105 0x00, 0x00 }; 105 0x00, 0x00 };
106 char init_msg_2[] = 106 const static char init_msg_2[] =
107 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4, 107 { 0x57, 0x50, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf4,
108 0x00, 0x00 }; 108 0x00, 0x00 };
109 char receive_buf[28]; 109 const static int buflen = 28;
110 char *usb_buf;
110 int status; 111 int status;
111 112
112 status = kalmia_send_init_packet(dev, init_msg_1, sizeof(init_msg_1) 113 usb_buf = kmalloc(buflen, GFP_DMA | GFP_KERNEL);
113 / sizeof(init_msg_1[0]), receive_buf, 24); 114 if (!usb_buf)
115 return -ENOMEM;
116
117 memcpy(usb_buf, init_msg_1, 12);
118 status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_1)
119 / sizeof(init_msg_1[0]), usb_buf, 24);
114 if (status != 0) 120 if (status != 0)
115 return status; 121 return status;
116 122
117 status = kalmia_send_init_packet(dev, init_msg_2, sizeof(init_msg_2) 123 memcpy(usb_buf, init_msg_2, 12);
118 / sizeof(init_msg_2[0]), receive_buf, 28); 124 status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_2)
125 / sizeof(init_msg_2[0]), usb_buf, 28);
119 if (status != 0) 126 if (status != 0)
120 return status; 127 return status;
121 128
122 memcpy(ethernet_addr, receive_buf + 10, ETH_ALEN); 129 memcpy(ethernet_addr, usb_buf + 10, ETH_ALEN);
123 130
131 kfree(usb_buf);
124 return status; 132 return status;
125} 133}
126 134
127static int 135static int
128kalmia_bind(struct usbnet *dev, struct usb_interface *intf) 136kalmia_bind(struct usbnet *dev, struct usb_interface *intf)
129{ 137{
130 u8 status; 138 int status;
131 u8 ethernet_addr[ETH_ALEN]; 139 u8 ethernet_addr[ETH_ALEN];
132 140
133 /* Don't bind to AT command interface */ 141 /* Don't bind to AT command interface */
@@ -190,7 +198,8 @@ kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
190 dev_kfree_skb_any(skb); 198 dev_kfree_skb_any(skb);
191 skb = skb2; 199 skb = skb2;
192 200
193 done: header_start = skb_push(skb, KALMIA_HEADER_LENGTH); 201done:
202 header_start = skb_push(skb, KALMIA_HEADER_LENGTH);
194 ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12]; 203 ether_type_1 = header_start[KALMIA_HEADER_LENGTH + 12];
195 ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13]; 204 ether_type_2 = header_start[KALMIA_HEADER_LENGTH + 13];
196 205
@@ -201,9 +210,8 @@ kalmia_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags)
201 header_start[0] = 0x57; 210 header_start[0] = 0x57;
202 header_start[1] = 0x44; 211 header_start[1] = 0x44;
203 content_len = skb->len - KALMIA_HEADER_LENGTH; 212 content_len = skb->len - KALMIA_HEADER_LENGTH;
204 header_start[2] = (content_len & 0xff); /* low byte */
205 header_start[3] = (content_len >> 8); /* high byte */
206 213
214 put_unaligned_le16(content_len, &header_start[2]);
207 header_start[4] = ether_type_1; 215 header_start[4] = ether_type_1;
208 header_start[5] = ether_type_2; 216 header_start[5] = ether_type_2;
209 217
@@ -231,13 +239,13 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
231 * Our task here is to strip off framing, leaving skb with one 239 * Our task here is to strip off framing, leaving skb with one
232 * data frame for the usbnet framework code to process. 240 * data frame for the usbnet framework code to process.
233 */ 241 */
234 const u8 HEADER_END_OF_USB_PACKET[] = 242 const static u8 HEADER_END_OF_USB_PACKET[] =
235 { 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 }; 243 { 0x57, 0x5a, 0x00, 0x00, 0x08, 0x00 };
236 const u8 EXPECTED_UNKNOWN_HEADER_1[] = 244 const static u8 EXPECTED_UNKNOWN_HEADER_1[] =
237 { 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 }; 245 { 0x57, 0x43, 0x1e, 0x00, 0x15, 0x02 };
238 const u8 EXPECTED_UNKNOWN_HEADER_2[] = 246 const static u8 EXPECTED_UNKNOWN_HEADER_2[] =
239 { 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 }; 247 { 0x57, 0x50, 0x0e, 0x00, 0x00, 0x00 };
240 u8 i = 0; 248 int i = 0;
241 249
242 /* incomplete header? */ 250 /* incomplete header? */
243 if (skb->len < KALMIA_HEADER_LENGTH) 251 if (skb->len < KALMIA_HEADER_LENGTH)
@@ -285,7 +293,7 @@ kalmia_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
285 293
286 /* subtract start header and end header */ 294 /* subtract start header and end header */
287 usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH); 295 usb_packet_length = skb->len - (2 * KALMIA_HEADER_LENGTH);
288 ether_packet_length = header_start[2] + (header_start[3] << 8); 296 ether_packet_length = get_unaligned_le16(&header_start[2]);
289 skb_pull(skb, KALMIA_HEADER_LENGTH); 297 skb_pull(skb, KALMIA_HEADER_LENGTH);
290 298
291 /* Some small packets misses end marker */ 299 /* Some small packets misses end marker */
diff --git a/drivers/net/usb/zaurus.c b/drivers/net/usb/zaurus.c
index 241756e0e86f..1a2234c20514 100644
--- a/drivers/net/usb/zaurus.c
+++ b/drivers/net/usb/zaurus.c
@@ -331,17 +331,7 @@ static const struct usb_device_id products [] = {
331 ZAURUS_MASTER_INTERFACE, 331 ZAURUS_MASTER_INTERFACE,
332 .driver_info = ZAURUS_PXA_INFO, 332 .driver_info = ZAURUS_PXA_INFO,
333}, 333},
334
335
336/* At least some of the newest PXA units have very different lies about
337 * their standards support: they claim to be cell phones offering
338 * direct access to their radios! (No, they don't conform to CDC MDLM.)
339 */
340{ 334{
341 USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MDLM,
342 USB_CDC_PROTO_NONE),
343 .driver_info = (unsigned long) &bogus_mdlm_info,
344}, {
345 /* Motorola MOTOMAGX phones */ 335 /* Motorola MOTOMAGX phones */
346 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM, 336 USB_DEVICE_AND_INTERFACE_INFO(0x22b8, 0x6425, USB_CLASS_COMM,
347 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE), 337 USB_CDC_SUBCLASS_MDLM, USB_CDC_PROTO_NONE),