aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/if_usb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/if_usb.c')
-rw-r--r--drivers/net/wireless/libertas/if_usb.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index de7a2e2babe6..b544fcdcd0e7 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -141,10 +141,10 @@ static int if_usb_probe(struct usb_interface *intf,
141 141
142 lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" 142 lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
143 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", 143 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
144 udev->descriptor.bcdUSB, 144 le16_to_cpu(udev->descriptor.bcdUSB),
145 udev->descriptor.bDeviceClass, 145 udev->descriptor.bDeviceClass,
146 udev->descriptor.bDeviceSubClass, 146 udev->descriptor.bDeviceSubClass,
147 udev->descriptor.bDeviceProtocol); 147 udev->descriptor.bDeviceProtocol);
148 148
149 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { 149 for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) {
150 endpoint = &iface_desc->endpoint[i].desc; 150 endpoint = &iface_desc->endpoint[i].desc;
@@ -153,10 +153,8 @@ static int if_usb_probe(struct usb_interface *intf,
153 USB_ENDPOINT_XFER_BULK)) { 153 USB_ENDPOINT_XFER_BULK)) {
154 /* we found a bulk in endpoint */ 154 /* we found a bulk in endpoint */
155 lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n", 155 lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
156 endpoint->wMaxPacketSize); 156 le16_to_cpu(endpoint->wMaxPacketSize));
157 if (! 157 if (!(cardp->rx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
158 (cardp->rx_urb =
159 usb_alloc_urb(0, GFP_KERNEL))) {
160 lbs_deb_usbd(&udev->dev, 158 lbs_deb_usbd(&udev->dev,
161 "Rx URB allocation failed\n"); 159 "Rx URB allocation failed\n");
162 goto dealloc; 160 goto dealloc;
@@ -164,7 +162,7 @@ static int if_usb_probe(struct usb_interface *intf,
164 cardp->rx_urb_recall = 0; 162 cardp->rx_urb_recall = 0;
165 163
166 cardp->bulk_in_size = 164 cardp->bulk_in_size =
167 endpoint->wMaxPacketSize; 165 le16_to_cpu(endpoint->wMaxPacketSize);
168 cardp->bulk_in_endpointAddr = 166 cardp->bulk_in_endpointAddr =
169 (endpoint-> 167 (endpoint->
170 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 168 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
@@ -178,19 +176,17 @@ static int if_usb_probe(struct usb_interface *intf,
178 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 176 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
179 USB_ENDPOINT_XFER_BULK)) { 177 USB_ENDPOINT_XFER_BULK)) {
180 /* We found bulk out endpoint */ 178 /* We found bulk out endpoint */
181 if (! 179 if (!(cardp->tx_urb = usb_alloc_urb(0, GFP_KERNEL))) {
182 (cardp->tx_urb =
183 usb_alloc_urb(0, GFP_KERNEL))) {
184 lbs_deb_usbd(&udev->dev, 180 lbs_deb_usbd(&udev->dev,
185 "Tx URB allocation failed\n"); 181 "Tx URB allocation failed\n");
186 goto dealloc; 182 goto dealloc;
187 } 183 }
188 184
189 cardp->bulk_out_size = 185 cardp->bulk_out_size =
190 endpoint->wMaxPacketSize; 186 le16_to_cpu(endpoint->wMaxPacketSize);
191 lbs_deb_usbd(&udev->dev, 187 lbs_deb_usbd(&udev->dev,
192 "Bulk out size is %d\n", 188 "Bulk out size is %d\n",
193 endpoint->wMaxPacketSize); 189 le16_to_cpu(endpoint->wMaxPacketSize));
194 cardp->bulk_out_endpointAddr = 190 cardp->bulk_out_endpointAddr =
195 endpoint->bEndpointAddress; 191 endpoint->bEndpointAddress;
196 lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n", 192 lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
@@ -313,7 +309,7 @@ static int if_prog_firmware(wlan_private * priv)
313 309
314 /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */ 310 /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
315 memcpy(fwdata->data, &firmware[cardp->totalbytes], 311 memcpy(fwdata->data, &firmware[cardp->totalbytes],
316 fwdata->fwheader.datalength); 312 le32_to_cpu(fwdata->fwheader.datalength));
317 313
318 /* 314 /*
319 lbs_deb_usbd(&cardp->udev->dev, 315 lbs_deb_usbd(&cardp->udev->dev,
@@ -322,13 +318,13 @@ static int if_prog_firmware(wlan_private * priv)
322 318
323 cardp->fwseqnum = cardp->fwseqnum + 1; 319 cardp->fwseqnum = cardp->fwseqnum + 1;
324 320
325 fwdata->seqnum = cardp->fwseqnum; 321 fwdata->seqnum = cpu_to_le32(cardp->fwseqnum);
326 cardp->lastseqnum = fwdata->seqnum; 322 cardp->lastseqnum = cardp->fwseqnum;
327 cardp->totalbytes += fwdata->fwheader.datalength; 323 cardp->totalbytes += le32_to_cpu(fwdata->fwheader.datalength);
328 324
329 if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { 325 if (fwheader->dnldcmd == cpu_to_le32(FW_HAS_DATA_TO_RECV)) {
330 /* 326 /*
331 lbs_deb_usbd(&cardp->udev->dev, "There is data to follow\n"); 327 lbs_deb_usbd(&cardp->udev->dev, "There are data to follow\n");
332 lbs_deb_usbd(&cardp->udev->dev, 328 lbs_deb_usbd(&cardp->udev->dev,
333 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, 329 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
334 cardp->totalbytes); 330 cardp->totalbytes);
@@ -486,7 +482,7 @@ static void if_usb_receive_fwload(struct urb *urb)
486 if (cardp->bootcmdresp == 0) { 482 if (cardp->bootcmdresp == 0) {
487 memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET, 483 memcpy (&bootcmdresp, skb->data + IPFIELD_ALIGN_OFFSET,
488 sizeof(bootcmdresp)); 484 sizeof(bootcmdresp));
489 if (cardp->udev->descriptor.bcdDevice < 0x3106) { 485 if (le16_to_cpu(cardp->udev->descriptor.bcdDevice) < 0x3106) {
490 kfree_skb(skb); 486 kfree_skb(skb);
491 if_usb_submit_rx_urb_fwload(priv); 487 if_usb_submit_rx_urb_fwload(priv);
492 cardp->bootcmdresp = 1; 488 cardp->bootcmdresp = 1;
@@ -494,10 +490,10 @@ static void if_usb_receive_fwload(struct urb *urb)
494 "Received valid boot command response\n"); 490 "Received valid boot command response\n");
495 return; 491 return;
496 } 492 }
497 if (bootcmdresp.u32magicnumber != BOOT_CMD_MAGIC_NUMBER) { 493 if (bootcmdresp.u32magicnumber != cpu_to_le32(BOOT_CMD_MAGIC_NUMBER)) {
498 lbs_pr_info( 494 lbs_pr_info(
499 "boot cmd response wrong magic number (0x%x)\n", 495 "boot cmd response wrong magic number (0x%x)\n",
500 bootcmdresp.u32magicnumber); 496 le32_to_cpu(bootcmdresp.u32magicnumber));
501 } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) { 497 } else if (bootcmdresp.u8cmd_tag != BOOT_CMD_FW_BY_USB) {
502 lbs_pr_info( 498 lbs_pr_info(
503 "boot cmd response cmd_tag error (%d)\n", 499 "boot cmd response cmd_tag error (%d)\n",
@@ -672,7 +668,7 @@ static void if_usb_receive(struct urb *urb)
672 case CMD_TYPE_INDICATION: 668 case CMD_TYPE_INDICATION:
673 /* Event cause handling */ 669 /* Event cause handling */
674 spin_lock(&priv->adapter->driver_lock); 670 spin_lock(&priv->adapter->driver_lock);
675 cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); 671 cardp->usb_event_cause = le32_to_cpu(*(__le32 *) (recvbuff + MESSAGE_HEADER_LEN));
676 lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n", 672 lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
677 cardp->usb_event_cause); 673 cardp->usb_event_cause);
678 if (cardp->usb_event_cause & 0xffff0000) { 674 if (cardp->usb_event_cause & 0xffff0000) {
@@ -680,7 +676,7 @@ static void if_usb_receive(struct urb *urb)
680 spin_unlock(&priv->adapter->driver_lock); 676 spin_unlock(&priv->adapter->driver_lock);
681 break; 677 break;
682 } 678 }
683 cardp->usb_event_cause = le32_to_cpu(cardp->usb_event_cause) << 3; 679 cardp->usb_event_cause <<= 3;
684 cardp->usb_int_cause |= his_cardevent; 680 cardp->usb_int_cause |= his_cardevent;
685 kfree_skb(skb); 681 kfree_skb(skb);
686 libertas_interrupt(priv->dev); 682 libertas_interrupt(priv->dev);