aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-23 16:05:46 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-23 16:05:46 -0500
commit2634d064c16cc897bc850a109bbea781b50d1ad5 (patch)
tree89021349a41791a53eacb96839440a84b9388f4a
parentc63f702068a445f682d7590c5fadfc266785a071 (diff)
parentbdcba1511b98f2e728b3a910b8771a0d3fce5bf3 (diff)
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: MACB: clear transmit buffers properly on transmit underrun 3c359 endianness annotations and fixes fec_mpc52xx: write in C... 3c574 and 3c589 endianness fixes (.24?) rrunner: use offsetof() instead of homegrown insanity r8169 endianness dl2k endianness fixes (.24 fodder?) yellowfin: annotations and fixes (.24 fodder?) asix fixes cycx: annotations and fixes (.24 fodder?) typhoon: trivial endianness annotations typhoon: memory corruptor on big-endian if TSO is enabled typhoon: missed rx overruns on big-endian typhoon: set_settings broken on big-endian typhoon: missing le32_to_cpu() in get_drvinfo typhoon: endianness bug in tx/rx byte counters ipw2200: prevent alloc of unspecified size on stack iwlwifi: fix possible priv->mutex deadlock during suspend p54: add Kconfig description rtl8187: Add USB ID for Sitecom WL-168 v1 001
-rw-r--r--drivers/net/dl2k.c51
-rw-r--r--drivers/net/dl2k.h6
-rw-r--r--drivers/net/fec_mpc52xx.c5
-rw-r--r--drivers/net/macb.c25
-rw-r--r--drivers/net/pcmcia/3c574_cs.c10
-rw-r--r--drivers/net/pcmcia/3c589_cs.c9
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/rrunner.c49
-rw-r--r--drivers/net/rrunner.h2
-rw-r--r--drivers/net/tokenring/3c359.c90
-rw-r--r--drivers/net/tokenring/3c359.h38
-rw-r--r--drivers/net/typhoon.c45
-rw-r--r--drivers/net/typhoon.h15
-rw-r--r--drivers/net/usb/asix.c235
-rw-r--r--drivers/net/wan/cycx_x25.c12
-rw-r--r--drivers/net/wireless/Kconfig51
-rw-r--r--drivers/net/wireless/ipw2200.c13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c18
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c18
-rw-r--r--drivers/net/wireless/rtl8187_dev.c2
-rw-r--r--drivers/net/yellowfin.c25
21 files changed, 387 insertions, 336 deletions
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 5066beb2e7bc..47cce9cad30f 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -332,7 +332,7 @@ parse_eeprom (struct net_device *dev)
332#endif 332#endif
333 /* Read eeprom */ 333 /* Read eeprom */
334 for (i = 0; i < 128; i++) { 334 for (i = 0; i < 128; i++) {
335 ((u16 *) sromdata)[i] = le16_to_cpu (read_eeprom (ioaddr, i)); 335 ((__le16 *) sromdata)[i] = cpu_to_le16(read_eeprom (ioaddr, i));
336 } 336 }
337#ifdef MEM_MAPPING 337#ifdef MEM_MAPPING
338 ioaddr = dev->base_addr; 338 ioaddr = dev->base_addr;
@@ -516,7 +516,7 @@ rio_timer (unsigned long data)
516 PCI_DMA_FROMDEVICE)); 516 PCI_DMA_FROMDEVICE));
517 } 517 }
518 np->rx_ring[entry].fraginfo |= 518 np->rx_ring[entry].fraginfo |=
519 cpu_to_le64 (np->rx_buf_sz) << 48; 519 cpu_to_le64((u64)np->rx_buf_sz << 48);
520 np->rx_ring[entry].status = 0; 520 np->rx_ring[entry].status = 0;
521 } /* end for */ 521 } /* end for */
522 } /* end if */ 522 } /* end if */
@@ -584,11 +584,11 @@ alloc_list (struct net_device *dev)
584 cpu_to_le64 ( pci_map_single ( 584 cpu_to_le64 ( pci_map_single (
585 np->pdev, skb->data, np->rx_buf_sz, 585 np->pdev, skb->data, np->rx_buf_sz,
586 PCI_DMA_FROMDEVICE)); 586 PCI_DMA_FROMDEVICE));
587 np->rx_ring[i].fraginfo |= cpu_to_le64 (np->rx_buf_sz) << 48; 587 np->rx_ring[i].fraginfo |= cpu_to_le64((u64)np->rx_buf_sz << 48);
588 } 588 }
589 589
590 /* Set RFDListPtr */ 590 /* Set RFDListPtr */
591 writel (cpu_to_le32 (np->rx_ring_dma), dev->base_addr + RFDListPtr0); 591 writel (np->rx_ring_dma, dev->base_addr + RFDListPtr0);
592 writel (0, dev->base_addr + RFDListPtr1); 592 writel (0, dev->base_addr + RFDListPtr1);
593 593
594 return; 594 return;
@@ -620,15 +620,14 @@ start_xmit (struct sk_buff *skb, struct net_device *dev)
620 } 620 }
621#endif 621#endif
622 if (np->vlan) { 622 if (np->vlan) {
623 tfc_vlan_tag = 623 tfc_vlan_tag = VLANTagInsert |
624 cpu_to_le64 (VLANTagInsert) | 624 ((u64)np->vlan << 32) |
625 (cpu_to_le64 (np->vlan) << 32) | 625 ((u64)skb->priority << 45);
626 (cpu_to_le64 (skb->priority) << 45);
627 } 626 }
628 txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, 627 txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data,
629 skb->len, 628 skb->len,
630 PCI_DMA_TODEVICE)); 629 PCI_DMA_TODEVICE));
631 txdesc->fraginfo |= cpu_to_le64 (skb->len) << 48; 630 txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48);
632 631
633 /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode 632 /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode
634 * Work around: Always use 1 descriptor in 10Mbps mode */ 633 * Work around: Always use 1 descriptor in 10Mbps mode */
@@ -708,6 +707,11 @@ rio_interrupt (int irq, void *dev_instance)
708 return IRQ_RETVAL(handled); 707 return IRQ_RETVAL(handled);
709} 708}
710 709
710static inline dma_addr_t desc_to_dma(struct netdev_desc *desc)
711{
712 return le64_to_cpu(desc->fraginfo) & DMA_48BIT_MASK;
713}
714
711static void 715static void
712rio_free_tx (struct net_device *dev, int irq) 716rio_free_tx (struct net_device *dev, int irq)
713{ 717{
@@ -725,11 +729,11 @@ rio_free_tx (struct net_device *dev, int irq)
725 while (entry != np->cur_tx) { 729 while (entry != np->cur_tx) {
726 struct sk_buff *skb; 730 struct sk_buff *skb;
727 731
728 if (!(np->tx_ring[entry].status & TFDDone)) 732 if (!(np->tx_ring[entry].status & cpu_to_le64(TFDDone)))
729 break; 733 break;
730 skb = np->tx_skbuff[entry]; 734 skb = np->tx_skbuff[entry];
731 pci_unmap_single (np->pdev, 735 pci_unmap_single (np->pdev,
732 np->tx_ring[entry].fraginfo & DMA_48BIT_MASK, 736 desc_to_dma(&np->tx_ring[entry]),
733 skb->len, PCI_DMA_TODEVICE); 737 skb->len, PCI_DMA_TODEVICE);
734 if (irq) 738 if (irq)
735 dev_kfree_skb_irq (skb); 739 dev_kfree_skb_irq (skb);
@@ -831,13 +835,14 @@ receive_packet (struct net_device *dev)
831 int pkt_len; 835 int pkt_len;
832 u64 frame_status; 836 u64 frame_status;
833 837
834 if (!(desc->status & RFDDone) || 838 if (!(desc->status & cpu_to_le64(RFDDone)) ||
835 !(desc->status & FrameStart) || !(desc->status & FrameEnd)) 839 !(desc->status & cpu_to_le64(FrameStart)) ||
840 !(desc->status & cpu_to_le64(FrameEnd)))
836 break; 841 break;
837 842
838 /* Chip omits the CRC. */ 843 /* Chip omits the CRC. */
839 pkt_len = le64_to_cpu (desc->status & 0xffff); 844 frame_status = le64_to_cpu(desc->status);
840 frame_status = le64_to_cpu (desc->status); 845 pkt_len = frame_status & 0xffff;
841 if (--cnt < 0) 846 if (--cnt < 0)
842 break; 847 break;
843 /* Update rx error statistics, drop packet. */ 848 /* Update rx error statistics, drop packet. */
@@ -857,15 +862,14 @@ receive_packet (struct net_device *dev)
857 /* Small skbuffs for short packets */ 862 /* Small skbuffs for short packets */
858 if (pkt_len > copy_thresh) { 863 if (pkt_len > copy_thresh) {
859 pci_unmap_single (np->pdev, 864 pci_unmap_single (np->pdev,
860 desc->fraginfo & DMA_48BIT_MASK, 865 desc_to_dma(desc),
861 np->rx_buf_sz, 866 np->rx_buf_sz,
862 PCI_DMA_FROMDEVICE); 867 PCI_DMA_FROMDEVICE);
863 skb_put (skb = np->rx_skbuff[entry], pkt_len); 868 skb_put (skb = np->rx_skbuff[entry], pkt_len);
864 np->rx_skbuff[entry] = NULL; 869 np->rx_skbuff[entry] = NULL;
865 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) { 870 } else if ((skb = dev_alloc_skb (pkt_len + 2)) != NULL) {
866 pci_dma_sync_single_for_cpu(np->pdev, 871 pci_dma_sync_single_for_cpu(np->pdev,
867 desc->fraginfo & 872 desc_to_dma(desc),
868 DMA_48BIT_MASK,
869 np->rx_buf_sz, 873 np->rx_buf_sz,
870 PCI_DMA_FROMDEVICE); 874 PCI_DMA_FROMDEVICE);
871 /* 16 byte align the IP header */ 875 /* 16 byte align the IP header */
@@ -875,8 +879,7 @@ receive_packet (struct net_device *dev)
875 pkt_len); 879 pkt_len);
876 skb_put (skb, pkt_len); 880 skb_put (skb, pkt_len);
877 pci_dma_sync_single_for_device(np->pdev, 881 pci_dma_sync_single_for_device(np->pdev,
878 desc->fraginfo & 882 desc_to_dma(desc),
879 DMA_48BIT_MASK,
880 np->rx_buf_sz, 883 np->rx_buf_sz,
881 PCI_DMA_FROMDEVICE); 884 PCI_DMA_FROMDEVICE);
882 } 885 }
@@ -919,7 +922,7 @@ receive_packet (struct net_device *dev)
919 PCI_DMA_FROMDEVICE)); 922 PCI_DMA_FROMDEVICE));
920 } 923 }
921 np->rx_ring[entry].fraginfo |= 924 np->rx_ring[entry].fraginfo |=
922 cpu_to_le64 (np->rx_buf_sz) << 48; 925 cpu_to_le64((u64)np->rx_buf_sz << 48);
923 np->rx_ring[entry].status = 0; 926 np->rx_ring[entry].status = 0;
924 entry = (entry + 1) % RX_RING_SIZE; 927 entry = (entry + 1) % RX_RING_SIZE;
925 } 928 }
@@ -1121,7 +1124,7 @@ set_multicast (struct net_device *dev)
1121 1124
1122 hash_table[0] = hash_table[1] = 0; 1125 hash_table[0] = hash_table[1] = 0;
1123 /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */ 1126 /* RxFlowcontrol DA: 01-80-C2-00-00-01. Hash index=0x39 */
1124 hash_table[1] |= cpu_to_le32(0x02000000); 1127 hash_table[1] |= 0x02000000;
1125 if (dev->flags & IFF_PROMISC) { 1128 if (dev->flags & IFF_PROMISC) {
1126 /* Receive all frames promiscuously. */ 1129 /* Receive all frames promiscuously. */
1127 rx_mode = ReceiveAllFrames; 1130 rx_mode = ReceiveAllFrames;
@@ -1762,7 +1765,7 @@ rio_close (struct net_device *dev)
1762 skb = np->rx_skbuff[i]; 1765 skb = np->rx_skbuff[i];
1763 if (skb) { 1766 if (skb) {
1764 pci_unmap_single(np->pdev, 1767 pci_unmap_single(np->pdev,
1765 np->rx_ring[i].fraginfo & DMA_48BIT_MASK, 1768 desc_to_dma(&np->rx_ring[i]),
1766 skb->len, PCI_DMA_FROMDEVICE); 1769 skb->len, PCI_DMA_FROMDEVICE);
1767 dev_kfree_skb (skb); 1770 dev_kfree_skb (skb);
1768 np->rx_skbuff[i] = NULL; 1771 np->rx_skbuff[i] = NULL;
@@ -1772,7 +1775,7 @@ rio_close (struct net_device *dev)
1772 skb = np->tx_skbuff[i]; 1775 skb = np->tx_skbuff[i];
1773 if (skb) { 1776 if (skb) {
1774 pci_unmap_single(np->pdev, 1777 pci_unmap_single(np->pdev,
1775 np->tx_ring[i].fraginfo & DMA_48BIT_MASK, 1778 desc_to_dma(&np->tx_ring[i]),
1776 skb->len, PCI_DMA_TODEVICE); 1779 skb->len, PCI_DMA_TODEVICE);
1777 dev_kfree_skb (skb); 1780 dev_kfree_skb (skb);
1778 np->tx_skbuff[i] = NULL; 1781 np->tx_skbuff[i] = NULL;
diff --git a/drivers/net/dl2k.h b/drivers/net/dl2k.h
index 5b801775f42d..014b77ce96df 100644
--- a/drivers/net/dl2k.h
+++ b/drivers/net/dl2k.h
@@ -633,9 +633,9 @@ struct mii_data {
633 633
634/* The Rx and Tx buffer descriptors. */ 634/* The Rx and Tx buffer descriptors. */
635struct netdev_desc { 635struct netdev_desc {
636 u64 next_desc; 636 __le64 next_desc;
637 u64 status; 637 __le64 status;
638 u64 fraginfo; 638 __le64 fraginfo;
639}; 639};
640 640
641#define PRIV_ALIGN 15 /* Required alignment mask */ 641#define PRIV_ALIGN 15 /* Required alignment mask */
diff --git a/drivers/net/fec_mpc52xx.c b/drivers/net/fec_mpc52xx.c
index 79f7eade4773..f91ee700e605 100644
--- a/drivers/net/fec_mpc52xx.c
+++ b/drivers/net/fec_mpc52xx.c
@@ -568,8 +568,9 @@ static void mpc52xx_fec_reset_stats(struct net_device *dev)
568 struct mpc52xx_fec __iomem *fec = priv->fec; 568 struct mpc52xx_fec __iomem *fec = priv->fec;
569 569
570 out_be32(&fec->mib_control, FEC_MIB_DISABLE); 570 out_be32(&fec->mib_control, FEC_MIB_DISABLE);
571 memset_io(&fec->rmon_t_drop, 0, (__force u32)&fec->reserved10 - 571 memset_io(&fec->rmon_t_drop, 0,
572 (__force u32)&fec->rmon_t_drop); 572 offsetof(struct mpc52xx_fec, reserved10) -
573 offsetof(struct mpc52xx_fec, rmon_t_drop));
573 out_be32(&fec->mib_control, 0); 574 out_be32(&fec->mib_control, 0);
574 575
575 memset(&dev->stats, 0, sizeof(dev->stats)); 576 memset(&dev->stats, 0, sizeof(dev->stats));
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 047ea7be4850..e10528ed9081 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -307,8 +307,31 @@ static void macb_tx(struct macb *bp)
307 (unsigned long)status); 307 (unsigned long)status);
308 308
309 if (status & MACB_BIT(UND)) { 309 if (status & MACB_BIT(UND)) {
310 int i;
310 printk(KERN_ERR "%s: TX underrun, resetting buffers\n", 311 printk(KERN_ERR "%s: TX underrun, resetting buffers\n",
311 bp->dev->name); 312 bp->dev->name);
313
314 head = bp->tx_head;
315
316 /*Mark all the buffer as used to avoid sending a lost buffer*/
317 for (i = 0; i < TX_RING_SIZE; i++)
318 bp->tx_ring[i].ctrl = MACB_BIT(TX_USED);
319
320 /* free transmit buffer in upper layer*/
321 for (tail = bp->tx_tail; tail != head; tail = NEXT_TX(tail)) {
322 struct ring_info *rp = &bp->tx_skb[tail];
323 struct sk_buff *skb = rp->skb;
324
325 BUG_ON(skb == NULL);
326
327 rmb();
328
329 dma_unmap_single(&bp->pdev->dev, rp->mapping, skb->len,
330 DMA_TO_DEVICE);
331 rp->skb = NULL;
332 dev_kfree_skb_irq(skb);
333 }
334
312 bp->tx_head = bp->tx_tail = 0; 335 bp->tx_head = bp->tx_tail = 0;
313 } 336 }
314 337
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index ad134a61302a..288177716a49 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -337,15 +337,15 @@ static int tc574_config(struct pcmcia_device *link)
337 struct net_device *dev = link->priv; 337 struct net_device *dev = link->priv;
338 struct el3_private *lp = netdev_priv(dev); 338 struct el3_private *lp = netdev_priv(dev);
339 tuple_t tuple; 339 tuple_t tuple;
340 unsigned short buf[32]; 340 __le16 buf[32];
341 int last_fn, last_ret, i, j; 341 int last_fn, last_ret, i, j;
342 kio_addr_t ioaddr; 342 kio_addr_t ioaddr;
343 u16 *phys_addr; 343 __be16 *phys_addr;
344 char *cardname; 344 char *cardname;
345 union wn3_config config; 345 union wn3_config config;
346 DECLARE_MAC_BUF(mac); 346 DECLARE_MAC_BUF(mac);
347 347
348 phys_addr = (u16 *)dev->dev_addr; 348 phys_addr = (__be16 *)dev->dev_addr;
349 349
350 DEBUG(0, "3c574_config(0x%p)\n", link); 350 DEBUG(0, "3c574_config(0x%p)\n", link);
351 351
@@ -378,12 +378,12 @@ static int tc574_config(struct pcmcia_device *link)
378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 378 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
379 pcmcia_get_tuple_data(link, &tuple); 379 pcmcia_get_tuple_data(link, &tuple);
380 for (i = 0; i < 3; i++) 380 for (i = 0; i < 3; i++)
381 phys_addr[i] = htons(buf[i]); 381 phys_addr[i] = htons(le16_to_cpu(buf[i]));
382 } else { 382 } else {
383 EL3WINDOW(0); 383 EL3WINDOW(0);
384 for (i = 0; i < 3; i++) 384 for (i = 0; i < 3; i++)
385 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10)); 385 phys_addr[i] = htons(read_eeprom(ioaddr, i + 10));
386 if (phys_addr[0] == 0x6060) { 386 if (phys_addr[0] == htons(0x6060)) {
387 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx" 387 printk(KERN_NOTICE "3c574_cs: IO port conflict at 0x%03lx"
388 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 388 "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
389 goto failed; 389 goto failed;
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index a98fe07cce70..e862d14ece79 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -251,7 +251,8 @@ static int tc589_config(struct pcmcia_device *link)
251 struct net_device *dev = link->priv; 251 struct net_device *dev = link->priv;
252 struct el3_private *lp = netdev_priv(dev); 252 struct el3_private *lp = netdev_priv(dev);
253 tuple_t tuple; 253 tuple_t tuple;
254 u16 buf[32], *phys_addr; 254 __le16 buf[32];
255 __be16 *phys_addr;
255 int last_fn, last_ret, i, j, multi = 0, fifo; 256 int last_fn, last_ret, i, j, multi = 0, fifo;
256 kio_addr_t ioaddr; 257 kio_addr_t ioaddr;
257 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 258 char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
@@ -259,7 +260,7 @@ static int tc589_config(struct pcmcia_device *link)
259 260
260 DEBUG(0, "3c589_config(0x%p)\n", link); 261 DEBUG(0, "3c589_config(0x%p)\n", link);
261 262
262 phys_addr = (u16 *)dev->dev_addr; 263 phys_addr = (__be16 *)dev->dev_addr;
263 tuple.Attributes = 0; 264 tuple.Attributes = 0;
264 tuple.TupleData = (cisdata_t *)buf; 265 tuple.TupleData = (cisdata_t *)buf;
265 tuple.TupleDataMax = sizeof(buf); 266 tuple.TupleDataMax = sizeof(buf);
@@ -298,11 +299,11 @@ static int tc589_config(struct pcmcia_device *link)
298 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { 299 if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) {
299 pcmcia_get_tuple_data(link, &tuple); 300 pcmcia_get_tuple_data(link, &tuple);
300 for (i = 0; i < 3; i++) 301 for (i = 0; i < 3; i++)
301 phys_addr[i] = htons(buf[i]); 302 phys_addr[i] = htons(le16_to_cpu(buf[i]));
302 } else { 303 } else {
303 for (i = 0; i < 3; i++) 304 for (i = 0; i < 3; i++)
304 phys_addr[i] = htons(read_eeprom(ioaddr, i)); 305 phys_addr[i] = htons(read_eeprom(ioaddr, i));
305 if (phys_addr[0] == 0x6060) { 306 if (phys_addr[0] == htons(0x6060)) {
306 printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx" 307 printk(KERN_ERR "3c589_cs: IO port conflict at 0x%03lx"
307 "-0x%03lx\n", dev->base_addr, dev->base_addr+15); 308 "-0x%03lx\n", dev->base_addr, dev->base_addr+15);
308 goto failed; 309 goto failed;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 1f647b9ce352..5863190894cc 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2211,7 +2211,7 @@ out:
2211 2211
2212static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc) 2212static inline void rtl8169_make_unusable_by_asic(struct RxDesc *desc)
2213{ 2213{
2214 desc->addr = 0x0badbadbadbadbadull; 2214 desc->addr = cpu_to_le64(0x0badbadbadbadbadull);
2215 desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask); 2215 desc->opts1 &= ~cpu_to_le32(DescOwn | RsvdMask);
2216} 2216}
2217 2217
@@ -2835,7 +2835,7 @@ static int rtl8169_rx_interrupt(struct net_device *dev,
2835 } 2835 }
2836 2836
2837 /* Work around for AMD plateform. */ 2837 /* Work around for AMD plateform. */
2838 if ((desc->opts2 & 0xfffe000) && 2838 if ((desc->opts2 & cpu_to_le32(0xfffe000)) &&
2839 (tp->mac_version == RTL_GIGA_MAC_VER_05)) { 2839 (tp->mac_version == RTL_GIGA_MAC_VER_05)) {
2840 desc->opts2 = 0; 2840 desc->opts2 = 0;
2841 cur_rx++; 2841 cur_rx++;
diff --git a/drivers/net/rrunner.c b/drivers/net/rrunner.c
index 73a7e6529ee0..55a590ab1e17 100644
--- a/drivers/net/rrunner.c
+++ b/drivers/net/rrunner.c
@@ -294,7 +294,6 @@ static int rr_reset(struct net_device *dev)
294{ 294{
295 struct rr_private *rrpriv; 295 struct rr_private *rrpriv;
296 struct rr_regs __iomem *regs; 296 struct rr_regs __iomem *regs;
297 struct eeprom *hw = NULL;
298 u32 start_pc; 297 u32 start_pc;
299 int i; 298 int i;
300 299
@@ -381,7 +380,8 @@ static int rr_reset(struct net_device *dev)
381 writel(RBURST_64|WBURST_64, &regs->PciState); 380 writel(RBURST_64|WBURST_64, &regs->PciState);
382 wmb(); 381 wmb();
383 382
384 start_pc = rr_read_eeprom_word(rrpriv, &hw->rncd_info.FwStart); 383 start_pc = rr_read_eeprom_word(rrpriv,
384 offsetof(struct eeprom, rncd_info.FwStart));
385 385
386#if (DEBUG > 1) 386#if (DEBUG > 1)
387 printk("%s: Executing firmware at address 0x%06x\n", 387 printk("%s: Executing firmware at address 0x%06x\n",
@@ -438,12 +438,12 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
438 * it to our CPU byte-order. 438 * it to our CPU byte-order.
439 */ 439 */
440static u32 rr_read_eeprom_word(struct rr_private *rrpriv, 440static u32 rr_read_eeprom_word(struct rr_private *rrpriv,
441 void * offset) 441 size_t offset)
442{ 442{
443 u32 word; 443 __be32 word;
444 444
445 if ((rr_read_eeprom(rrpriv, (unsigned long)offset, 445 if ((rr_read_eeprom(rrpriv, offset,
446 (char *)&word, 4) == 4)) 446 (unsigned char *)&word, 4) == 4))
447 return be32_to_cpu(word); 447 return be32_to_cpu(word);
448 return 0; 448 return 0;
449} 449}
@@ -510,7 +510,6 @@ static int __devinit rr_init(struct net_device *dev)
510{ 510{
511 struct rr_private *rrpriv; 511 struct rr_private *rrpriv;
512 struct rr_regs __iomem *regs; 512 struct rr_regs __iomem *regs;
513 struct eeprom *hw = NULL;
514 u32 sram_size, rev; 513 u32 sram_size, rev;
515 DECLARE_MAC_BUF(mac); 514 DECLARE_MAC_BUF(mac);
516 515
@@ -545,14 +544,14 @@ static int __devinit rr_init(struct net_device *dev)
545 * other method I've seen. -VAL 544 * other method I've seen. -VAL
546 */ 545 */
547 546
548 *(u16 *)(dev->dev_addr) = 547 *(__be16 *)(dev->dev_addr) =
549 htons(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA)); 548 htons(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA)));
550 *(u32 *)(dev->dev_addr+2) = 549 *(__be32 *)(dev->dev_addr+2) =
551 htonl(rr_read_eeprom_word(rrpriv, &hw->manf.BoardULA[4])); 550 htonl(rr_read_eeprom_word(rrpriv, offsetof(struct eeprom, manf.BoardULA[4])));
552 551
553 printk(" MAC: %s\n", print_mac(mac, dev->dev_addr)); 552 printk(" MAC: %s\n", print_mac(mac, dev->dev_addr));
554 553
555 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 554 sram_size = rr_read_eeprom_word(rrpriv, 8);
556 printk(" SRAM size 0x%06x\n", sram_size); 555 printk(" SRAM size 0x%06x\n", sram_size);
557 556
558 return 0; 557 return 0;
@@ -1477,11 +1476,10 @@ static int rr_load_firmware(struct net_device *dev)
1477{ 1476{
1478 struct rr_private *rrpriv; 1477 struct rr_private *rrpriv;
1479 struct rr_regs __iomem *regs; 1478 struct rr_regs __iomem *regs;
1480 unsigned long eptr, segptr; 1479 size_t eptr, segptr;
1481 int i, j; 1480 int i, j;
1482 u32 localctrl, sptr, len, tmp; 1481 u32 localctrl, sptr, len, tmp;
1483 u32 p2len, p2size, nr_seg, revision, io, sram_size; 1482 u32 p2len, p2size, nr_seg, revision, io, sram_size;
1484 struct eeprom *hw = NULL;
1485 1483
1486 rrpriv = netdev_priv(dev); 1484 rrpriv = netdev_priv(dev);
1487 regs = rrpriv->regs; 1485 regs = rrpriv->regs;
@@ -1509,7 +1507,7 @@ static int rr_load_firmware(struct net_device *dev)
1509 */ 1507 */
1510 io = readl(&regs->ExtIo); 1508 io = readl(&regs->ExtIo);
1511 writel(0, &regs->ExtIo); 1509 writel(0, &regs->ExtIo);
1512 sram_size = rr_read_eeprom_word(rrpriv, (void *)8); 1510 sram_size = rr_read_eeprom_word(rrpriv, 8);
1513 1511
1514 for (i = 200; i < sram_size / 4; i++){ 1512 for (i = 200; i < sram_size / 4; i++){
1515 writel(i * 4, &regs->WinBase); 1513 writel(i * 4, &regs->WinBase);
@@ -1520,13 +1518,13 @@ static int rr_load_firmware(struct net_device *dev)
1520 writel(io, &regs->ExtIo); 1518 writel(io, &regs->ExtIo);
1521 mb(); 1519 mb();
1522 1520
1523 eptr = (unsigned long)rr_read_eeprom_word(rrpriv, 1521 eptr = rr_read_eeprom_word(rrpriv,
1524 &hw->rncd_info.AddrRunCodeSegs); 1522 offsetof(struct eeprom, rncd_info.AddrRunCodeSegs));
1525 eptr = ((eptr & 0x1fffff) >> 3); 1523 eptr = ((eptr & 0x1fffff) >> 3);
1526 1524
1527 p2len = rr_read_eeprom_word(rrpriv, (void *)(0x83*4)); 1525 p2len = rr_read_eeprom_word(rrpriv, 0x83*4);
1528 p2len = (p2len << 2); 1526 p2len = (p2len << 2);
1529 p2size = rr_read_eeprom_word(rrpriv, (void *)(0x84*4)); 1527 p2size = rr_read_eeprom_word(rrpriv, 0x84*4);
1530 p2size = ((p2size & 0x1fffff) >> 3); 1528 p2size = ((p2size & 0x1fffff) >> 3);
1531 1529
1532 if ((eptr < p2size) || (eptr > (p2size + p2len))){ 1530 if ((eptr < p2size) || (eptr > (p2size + p2len))){
@@ -1534,7 +1532,8 @@ static int rr_load_firmware(struct net_device *dev)
1534 goto out; 1532 goto out;
1535 } 1533 }
1536 1534
1537 revision = rr_read_eeprom_word(rrpriv, &hw->manf.HeaderFmt); 1535 revision = rr_read_eeprom_word(rrpriv,
1536 offsetof(struct eeprom, manf.HeaderFmt));
1538 1537
1539 if (revision != 1){ 1538 if (revision != 1){
1540 printk("%s: invalid firmware format (%i)\n", 1539 printk("%s: invalid firmware format (%i)\n",
@@ -1542,18 +1541,18 @@ static int rr_load_firmware(struct net_device *dev)
1542 goto out; 1541 goto out;
1543 } 1542 }
1544 1543
1545 nr_seg = rr_read_eeprom_word(rrpriv, (void *)eptr); 1544 nr_seg = rr_read_eeprom_word(rrpriv, eptr);
1546 eptr +=4; 1545 eptr +=4;
1547#if (DEBUG > 1) 1546#if (DEBUG > 1)
1548 printk("%s: nr_seg %i\n", dev->name, nr_seg); 1547 printk("%s: nr_seg %i\n", dev->name, nr_seg);
1549#endif 1548#endif
1550 1549
1551 for (i = 0; i < nr_seg; i++){ 1550 for (i = 0; i < nr_seg; i++){
1552 sptr = rr_read_eeprom_word(rrpriv, (void *)eptr); 1551 sptr = rr_read_eeprom_word(rrpriv, eptr);
1553 eptr += 4; 1552 eptr += 4;
1554 len = rr_read_eeprom_word(rrpriv, (void *)eptr); 1553 len = rr_read_eeprom_word(rrpriv, eptr);
1555 eptr += 4; 1554 eptr += 4;
1556 segptr = (unsigned long)rr_read_eeprom_word(rrpriv, (void *)eptr); 1555 segptr = rr_read_eeprom_word(rrpriv, eptr);
1557 segptr = ((segptr & 0x1fffff) >> 3); 1556 segptr = ((segptr & 0x1fffff) >> 3);
1558 eptr += 4; 1557 eptr += 4;
1559#if (DEBUG > 1) 1558#if (DEBUG > 1)
@@ -1561,7 +1560,7 @@ static int rr_load_firmware(struct net_device *dev)
1561 dev->name, i, sptr, len, segptr); 1560 dev->name, i, sptr, len, segptr);
1562#endif 1561#endif
1563 for (j = 0; j < len; j++){ 1562 for (j = 0; j < len; j++){
1564 tmp = rr_read_eeprom_word(rrpriv, (void *)segptr); 1563 tmp = rr_read_eeprom_word(rrpriv, segptr);
1565 writel(sptr, &regs->WinBase); 1564 writel(sptr, &regs->WinBase);
1566 mb(); 1565 mb();
1567 writel(tmp, &regs->WinData); 1566 writel(tmp, &regs->WinData);
diff --git a/drivers/net/rrunner.h b/drivers/net/rrunner.h
index 6a79825bc8cf..6173f11218df 100644
--- a/drivers/net/rrunner.h
+++ b/drivers/net/rrunner.h
@@ -838,7 +838,7 @@ static unsigned int rr_read_eeprom(struct rr_private *rrpriv,
838 unsigned long offset, 838 unsigned long offset,
839 unsigned char *buf, 839 unsigned char *buf,
840 unsigned long length); 840 unsigned long length);
841static u32 rr_read_eeprom_word(struct rr_private *rrpriv, void * offset); 841static u32 rr_read_eeprom_word(struct rr_private *rrpriv, size_t offset);
842static int rr_load_firmware(struct net_device *dev); 842static int rr_load_firmware(struct net_device *dev);
843static inline void rr_raz_tx(struct rr_private *, struct net_device *); 843static inline void rr_raz_tx(struct rr_private *, struct net_device *);
844static inline void rr_raz_rx(struct rr_private *, struct net_device *); 844static inline void rr_raz_rx(struct rr_private *, struct net_device *);
diff --git a/drivers/net/tokenring/3c359.c b/drivers/net/tokenring/3c359.c
index 5d31519a6c67..44a06f8b588f 100644
--- a/drivers/net/tokenring/3c359.c
+++ b/drivers/net/tokenring/3c359.c
@@ -570,7 +570,7 @@ static int xl_open(struct net_device *dev)
570 struct xl_private *xl_priv=netdev_priv(dev); 570 struct xl_private *xl_priv=netdev_priv(dev);
571 u8 __iomem *xl_mmio = xl_priv->xl_mmio ; 571 u8 __iomem *xl_mmio = xl_priv->xl_mmio ;
572 u8 i ; 572 u8 i ;
573 u16 hwaddr[3] ; /* Should be u8[6] but we get word return values */ 573 __le16 hwaddr[3] ; /* Should be u8[6] but we get word return values */
574 int open_err ; 574 int open_err ;
575 575
576 u16 switchsettings, switchsettings_eeprom ; 576 u16 switchsettings, switchsettings_eeprom ;
@@ -580,15 +580,12 @@ static int xl_open(struct net_device *dev)
580 } 580 }
581 581
582 /* 582 /*
583 * Read the information from the EEPROM that we need. I know we 583 * Read the information from the EEPROM that we need.
584 * should use ntohs, but the word gets stored reversed in the 16
585 * bit field anyway and it all works its self out when we memcpy
586 * it into dev->dev_addr.
587 */ 584 */
588 585
589 hwaddr[0] = xl_ee_read(dev,0x10) ; 586 hwaddr[0] = cpu_to_le16(xl_ee_read(dev,0x10));
590 hwaddr[1] = xl_ee_read(dev,0x11) ; 587 hwaddr[1] = cpu_to_le16(xl_ee_read(dev,0x11));
591 hwaddr[2] = xl_ee_read(dev,0x12) ; 588 hwaddr[2] = cpu_to_le16(xl_ee_read(dev,0x12));
592 589
593 /* Ring speed */ 590 /* Ring speed */
594 591
@@ -665,8 +662,8 @@ static int xl_open(struct net_device *dev)
665 break ; 662 break ;
666 663
667 skb->dev = dev ; 664 skb->dev = dev ;
668 xl_priv->xl_rx_ring[i].upfragaddr = pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 665 xl_priv->xl_rx_ring[i].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
669 xl_priv->xl_rx_ring[i].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG; 666 xl_priv->xl_rx_ring[i].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
670 xl_priv->rx_ring_skb[i] = skb ; 667 xl_priv->rx_ring_skb[i] = skb ;
671 } 668 }
672 669
@@ -680,7 +677,7 @@ static int xl_open(struct net_device *dev)
680 xl_priv->rx_ring_tail = 0 ; 677 xl_priv->rx_ring_tail = 0 ;
681 xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ; 678 xl_priv->rx_ring_dma_addr = pci_map_single(xl_priv->pdev,xl_priv->xl_rx_ring, sizeof(struct xl_rx_desc) * XL_RX_RING_SIZE, PCI_DMA_TODEVICE) ;
682 for (i=0;i<(xl_priv->rx_ring_no-1);i++) { 679 for (i=0;i<(xl_priv->rx_ring_no-1);i++) {
683 xl_priv->xl_rx_ring[i].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)) ; 680 xl_priv->xl_rx_ring[i].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * (i+1)));
684 } 681 }
685 xl_priv->xl_rx_ring[i].upnextptr = 0 ; 682 xl_priv->xl_rx_ring[i].upnextptr = 0 ;
686 683
@@ -698,7 +695,7 @@ static int xl_open(struct net_device *dev)
698 * Setup the first dummy DPD entry for polling to start working. 695 * Setup the first dummy DPD entry for polling to start working.
699 */ 696 */
700 697
701 xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY ; 698 xl_priv->xl_tx_ring[0].framestartheader = TXDPDEMPTY;
702 xl_priv->xl_tx_ring[0].buffer = 0 ; 699 xl_priv->xl_tx_ring[0].buffer = 0 ;
703 xl_priv->xl_tx_ring[0].buffer_length = 0 ; 700 xl_priv->xl_tx_ring[0].buffer_length = 0 ;
704 xl_priv->xl_tx_ring[0].dnnextptr = 0 ; 701 xl_priv->xl_tx_ring[0].dnnextptr = 0 ;
@@ -811,17 +808,17 @@ static int xl_open_hw(struct net_device *dev)
811 return open_err ; 808 return open_err ;
812 } else { 809 } else {
813 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 810 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 8, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
814 xl_priv->asb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 811 xl_priv->asb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
815 printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ; 812 printk(KERN_INFO "%s: Adapter Opened Details: ",dev->name) ;
816 printk("ASB: %04x",xl_priv->asb ) ; 813 printk("ASB: %04x",xl_priv->asb ) ;
817 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 814 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 10, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
818 printk(", SRB: %04x",ntohs(readw(xl_mmio + MMIO_MACDATA)) ) ; 815 printk(", SRB: %04x",swab16(readw(xl_mmio + MMIO_MACDATA)) ) ;
819 816
820 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 817 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 12, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
821 xl_priv->arb = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 818 xl_priv->arb = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
822 printk(", ARB: %04x \n",xl_priv->arb ) ; 819 printk(", ARB: %04x \n",xl_priv->arb ) ;
823 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 820 writel( (MEM_WORD_READ | 0xD0000 | xl_priv->srb) + 14, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
824 vsoff = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 821 vsoff = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
825 822
826 /* 823 /*
827 * Interesting, sending the individual characters directly to printk was causing klogd to use 824 * Interesting, sending the individual characters directly to printk was causing klogd to use
@@ -873,16 +870,15 @@ static int xl_open_hw(struct net_device *dev)
873static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */ 870static void adv_rx_ring(struct net_device *dev) /* Advance rx_ring, cut down on bloat in xl_rx */
874{ 871{
875 struct xl_private *xl_priv=netdev_priv(dev); 872 struct xl_private *xl_priv=netdev_priv(dev);
876 int prev_ring_loc ; 873 int n = xl_priv->rx_ring_tail;
877 874 int prev_ring_loc;
878 prev_ring_loc = (xl_priv->rx_ring_tail + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1); 875
879 xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * xl_priv->rx_ring_tail) ; 876 prev_ring_loc = (n + XL_RX_RING_SIZE - 1) & (XL_RX_RING_SIZE - 1);
880 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus = 0 ; 877 xl_priv->xl_rx_ring[prev_ring_loc].upnextptr = cpu_to_le32(xl_priv->rx_ring_dma_addr + (sizeof (struct xl_rx_desc) * n));
881 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upnextptr = 0 ; 878 xl_priv->xl_rx_ring[n].framestatus = 0;
882 xl_priv->rx_ring_tail++ ; 879 xl_priv->xl_rx_ring[n].upnextptr = 0;
883 xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1) ; 880 xl_priv->rx_ring_tail++;
884 881 xl_priv->rx_ring_tail &= (XL_RX_RING_SIZE-1);
885 return ;
886} 882}
887 883
888static void xl_rx(struct net_device *dev) 884static void xl_rx(struct net_device *dev)
@@ -914,7 +910,7 @@ static void xl_rx(struct net_device *dev)
914 temp_ring_loc &= (XL_RX_RING_SIZE-1) ; 910 temp_ring_loc &= (XL_RX_RING_SIZE-1) ;
915 } 911 }
916 912
917 frame_length = xl_priv->xl_rx_ring[temp_ring_loc].framestatus & 0x7FFF ; 913 frame_length = le32_to_cpu(xl_priv->xl_rx_ring[temp_ring_loc].framestatus) & 0x7FFF;
918 914
919 skb = dev_alloc_skb(frame_length) ; 915 skb = dev_alloc_skb(frame_length) ;
920 916
@@ -931,29 +927,29 @@ static void xl_rx(struct net_device *dev)
931 } 927 }
932 928
933 while (xl_priv->rx_ring_tail != temp_ring_loc) { 929 while (xl_priv->rx_ring_tail != temp_ring_loc) {
934 copy_len = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen & 0x7FFF ; 930 copy_len = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen) & 0x7FFF;
935 frame_length -= copy_len ; 931 frame_length -= copy_len ;
936 pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 932 pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
937 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], 933 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
938 skb_put(skb, copy_len), 934 skb_put(skb, copy_len),
939 copy_len); 935 copy_len);
940 pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 936 pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
941 adv_rx_ring(dev) ; 937 adv_rx_ring(dev) ;
942 } 938 }
943 939
944 /* Now we have found the last fragment */ 940 /* Now we have found the last fragment */
945 pci_dma_sync_single_for_cpu(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 941 pci_dma_sync_single_for_cpu(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
946 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail], 942 skb_copy_from_linear_data(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail],
947 skb_put(skb,copy_len), frame_length); 943 skb_put(skb,copy_len), frame_length);
948/* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */ 944/* memcpy(skb_put(skb,frame_length), bus_to_virt(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), frame_length) ; */
949 pci_dma_sync_single_for_device(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 945 pci_dma_sync_single_for_device(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE);
950 adv_rx_ring(dev) ; 946 adv_rx_ring(dev) ;
951 skb->protocol = tr_type_trans(skb,dev) ; 947 skb->protocol = tr_type_trans(skb,dev) ;
952 netif_rx(skb) ; 948 netif_rx(skb) ;
953 949
954 } else { /* Single Descriptor Used, simply swap buffers over, fast path */ 950 } else { /* Single Descriptor Used, simply swap buffers over, fast path */
955 951
956 frame_length = xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus & 0x7FFF ; 952 frame_length = le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].framestatus) & 0x7FFF;
957 953
958 skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ; 954 skb = dev_alloc_skb(xl_priv->pkt_buf_sz) ;
959 955
@@ -966,13 +962,13 @@ static void xl_rx(struct net_device *dev)
966 } 962 }
967 963
968 skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ; 964 skb2 = xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] ;
969 pci_unmap_single(xl_priv->pdev, xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr, xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ; 965 pci_unmap_single(xl_priv->pdev, le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr), xl_priv->pkt_buf_sz,PCI_DMA_FROMDEVICE) ;
970 skb_put(skb2, frame_length) ; 966 skb_put(skb2, frame_length) ;
971 skb2->protocol = tr_type_trans(skb2,dev) ; 967 skb2->protocol = tr_type_trans(skb2,dev) ;
972 968
973 xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ; 969 xl_priv->rx_ring_skb[xl_priv->rx_ring_tail] = skb ;
974 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 970 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr = cpu_to_le32(pci_map_single(xl_priv->pdev,skb->data,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE));
975 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = xl_priv->pkt_buf_sz | RXUPLASTFRAG ; 971 xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfraglen = cpu_to_le32(xl_priv->pkt_buf_sz) | RXUPLASTFRAG;
976 adv_rx_ring(dev) ; 972 adv_rx_ring(dev) ;
977 xl_priv->xl_stats.rx_packets++ ; 973 xl_priv->xl_stats.rx_packets++ ;
978 xl_priv->xl_stats.rx_bytes += frame_length ; 974 xl_priv->xl_stats.rx_bytes += frame_length ;
@@ -1022,7 +1018,7 @@ static void xl_freemem(struct net_device *dev)
1022 1018
1023 for (i=0;i<XL_RX_RING_SIZE;i++) { 1019 for (i=0;i<XL_RX_RING_SIZE;i++) {
1024 dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ; 1020 dev_kfree_skb_irq(xl_priv->rx_ring_skb[xl_priv->rx_ring_tail]) ;
1025 pci_unmap_single(xl_priv->pdev,xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr,xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE) ; 1021 pci_unmap_single(xl_priv->pdev,le32_to_cpu(xl_priv->xl_rx_ring[xl_priv->rx_ring_tail].upfragaddr),xl_priv->pkt_buf_sz, PCI_DMA_FROMDEVICE);
1026 xl_priv->rx_ring_tail++ ; 1022 xl_priv->rx_ring_tail++ ;
1027 xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1; 1023 xl_priv->rx_ring_tail &= XL_RX_RING_SIZE-1;
1028 } 1024 }
@@ -1181,9 +1177,9 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
1181 1177
1182 txd = &(xl_priv->xl_tx_ring[tx_head]) ; 1178 txd = &(xl_priv->xl_tx_ring[tx_head]) ;
1183 txd->dnnextptr = 0 ; 1179 txd->dnnextptr = 0 ;
1184 txd->framestartheader = skb->len | TXDNINDICATE ; 1180 txd->framestartheader = cpu_to_le32(skb->len) | TXDNINDICATE;
1185 txd->buffer = pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE) ; 1181 txd->buffer = cpu_to_le32(pci_map_single(xl_priv->pdev, skb->data, skb->len, PCI_DMA_TODEVICE));
1186 txd->buffer_length = skb->len | TXDNFRAGLAST ; 1182 txd->buffer_length = cpu_to_le32(skb->len) | TXDNFRAGLAST;
1187 xl_priv->tx_ring_skb[tx_head] = skb ; 1183 xl_priv->tx_ring_skb[tx_head] = skb ;
1188 xl_priv->xl_stats.tx_packets++ ; 1184 xl_priv->xl_stats.tx_packets++ ;
1189 xl_priv->xl_stats.tx_bytes += skb->len ; 1185 xl_priv->xl_stats.tx_bytes += skb->len ;
@@ -1199,7 +1195,7 @@ static int xl_xmit(struct sk_buff *skb, struct net_device *dev)
1199 xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ; 1195 xl_priv->tx_ring_head &= (XL_TX_RING_SIZE - 1) ;
1200 xl_priv->free_ring_entries-- ; 1196 xl_priv->free_ring_entries-- ;
1201 1197
1202 xl_priv->xl_tx_ring[tx_prev].dnnextptr = xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head) ; 1198 xl_priv->xl_tx_ring[tx_prev].dnnextptr = cpu_to_le32(xl_priv->tx_ring_dma_addr + (sizeof (struct xl_tx_desc) * tx_head));
1203 1199
1204 /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */ 1200 /* Sneaky, by doing a read on DnListPtr we can force the card to poll on the DnNextPtr */
1205 /* readl(xl_mmio + MMIO_DNLISTPTR) ; */ 1201 /* readl(xl_mmio + MMIO_DNLISTPTR) ; */
@@ -1237,9 +1233,9 @@ static void xl_dn_comp(struct net_device *dev)
1237 1233
1238 while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) { 1234 while (xl_priv->xl_tx_ring[xl_priv->tx_ring_tail].framestartheader & TXDNCOMPLETE ) {
1239 txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ; 1235 txd = &(xl_priv->xl_tx_ring[xl_priv->tx_ring_tail]) ;
1240 pci_unmap_single(xl_priv->pdev,txd->buffer, xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE) ; 1236 pci_unmap_single(xl_priv->pdev, le32_to_cpu(txd->buffer), xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]->len, PCI_DMA_TODEVICE);
1241 txd->framestartheader = 0 ; 1237 txd->framestartheader = 0 ;
1242 txd->buffer = 0xdeadbeef ; 1238 txd->buffer = cpu_to_le32(0xdeadbeef);
1243 txd->buffer_length = 0 ; 1239 txd->buffer_length = 0 ;
1244 dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ; 1240 dev_kfree_skb_irq(xl_priv->tx_ring_skb[xl_priv->tx_ring_tail]) ;
1245 xl_priv->tx_ring_tail++ ; 1241 xl_priv->tx_ring_tail++ ;
@@ -1507,9 +1503,9 @@ static void xl_arb_cmd(struct net_device *dev)
1507 if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */ 1503 if (arb_cmd == RING_STATUS_CHANGE) { /* Ring.Status.Change */
1508 writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1504 writel( ( (MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1509 1505
1510 printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, ntohs(readw(xl_mmio + MMIO_MACDATA) )) ; 1506 printk(KERN_INFO "%s: Ring Status Change: New Status = %04x\n", dev->name, swab16(readw(xl_mmio + MMIO_MACDATA) )) ;
1511 1507
1512 lan_status = ntohs(readw(xl_mmio + MMIO_MACDATA)); 1508 lan_status = swab16(readw(xl_mmio + MMIO_MACDATA));
1513 1509
1514 /* Acknowledge interrupt, this tells nic we are done with the arb */ 1510 /* Acknowledge interrupt, this tells nic we are done with the arb */
1515 writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ; 1511 writel(ACK_INTERRUPT | ARBCACK | LATCH_ACK, xl_mmio + MMIO_COMMAND) ;
@@ -1573,7 +1569,7 @@ static void xl_arb_cmd(struct net_device *dev)
1573 printk(KERN_INFO "Received.Data \n") ; 1569 printk(KERN_INFO "Received.Data \n") ;
1574#endif 1570#endif
1575 writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1571 writel( ((MEM_WORD_READ | 0xD0000 | xl_priv->arb) + 6), xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1576 xl_priv->mac_buffer = ntohs(readw(xl_mmio + MMIO_MACDATA)) ; 1572 xl_priv->mac_buffer = swab16(readw(xl_mmio + MMIO_MACDATA)) ;
1577 1573
1578 /* Now we are going to be really basic here and not do anything 1574 /* Now we are going to be really basic here and not do anything
1579 * with the data at all. The tech docs do not give me enough 1575 * with the data at all. The tech docs do not give me enough
@@ -1634,7 +1630,7 @@ static void xl_asb_cmd(struct net_device *dev)
1634 writeb(0x81, xl_mmio + MMIO_MACDATA) ; 1630 writeb(0x81, xl_mmio + MMIO_MACDATA) ;
1635 1631
1636 writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ; 1632 writel(MEM_WORD_WRITE | 0xd0000 | xl_priv->asb | 6, xl_mmio + MMIO_MAC_ACCESS_CMD) ;
1637 writew(ntohs(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ; 1633 writew(swab16(xl_priv->mac_buffer), xl_mmio + MMIO_MACDATA) ;
1638 1634
1639 xl_wait_misr_flags(dev) ; 1635 xl_wait_misr_flags(dev) ;
1640 1636
diff --git a/drivers/net/tokenring/3c359.h b/drivers/net/tokenring/3c359.h
index 05c860368852..b880cba0f6fd 100644
--- a/drivers/net/tokenring/3c359.h
+++ b/drivers/net/tokenring/3c359.h
@@ -156,19 +156,19 @@
156#define HOSTERRINT (1<<1) 156#define HOSTERRINT (1<<1)
157 157
158/* Receive descriptor bits */ 158/* Receive descriptor bits */
159#define RXOVERRUN (1<<19) 159#define RXOVERRUN cpu_to_le32(1<<19)
160#define RXFC (1<<21) 160#define RXFC cpu_to_le32(1<<21)
161#define RXAR (1<<22) 161#define RXAR cpu_to_le32(1<<22)
162#define RXUPDCOMPLETE (1<<23) 162#define RXUPDCOMPLETE cpu_to_le32(1<<23)
163#define RXUPDFULL (1<<24) 163#define RXUPDFULL cpu_to_le32(1<<24)
164#define RXUPLASTFRAG (1<<31) 164#define RXUPLASTFRAG cpu_to_le32(1<<31)
165 165
166/* Transmit descriptor bits */ 166/* Transmit descriptor bits */
167#define TXDNCOMPLETE (1<<16) 167#define TXDNCOMPLETE cpu_to_le32(1<<16)
168#define TXTXINDICATE (1<<27) 168#define TXTXINDICATE cpu_to_le32(1<<27)
169#define TXDPDEMPTY (1<<29) 169#define TXDPDEMPTY cpu_to_le32(1<<29)
170#define TXDNINDICATE (1<<31) 170#define TXDNINDICATE cpu_to_le32(1<<31)
171#define TXDNFRAGLAST (1<<31) 171#define TXDNFRAGLAST cpu_to_le32(1<<31)
172 172
173/* Interrupts to Acknowledge */ 173/* Interrupts to Acknowledge */
174#define LATCH_ACK 1 174#define LATCH_ACK 1
@@ -232,17 +232,17 @@
232/* 3c359 data structures */ 232/* 3c359 data structures */
233 233
234struct xl_tx_desc { 234struct xl_tx_desc {
235 u32 dnnextptr ; 235 __le32 dnnextptr;
236 u32 framestartheader ; 236 __le32 framestartheader;
237 u32 buffer ; 237 __le32 buffer;
238 u32 buffer_length ; 238 __le32 buffer_length;
239}; 239};
240 240
241struct xl_rx_desc { 241struct xl_rx_desc {
242 u32 upnextptr ; 242 __le32 upnextptr;
243 u32 framestatus ; 243 __le32 framestatus;
244 u32 upfragaddr ; 244 __le32 upfragaddr;
245 u32 upfraglen ; 245 __le32 upfraglen;
246}; 246};
247 247
248struct xl_private { 248struct xl_private {
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 94ac5869bb18..f50cb520dffb 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -813,8 +813,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
813 first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID; 813 first_txd->flags = TYPHOON_TX_DESC | TYPHOON_DESC_VALID;
814 first_txd->numDesc = 0; 814 first_txd->numDesc = 0;
815 first_txd->len = 0; 815 first_txd->len = 0;
816 first_txd->addr = (u64)((unsigned long) skb) & 0xffffffff; 816 first_txd->tx_addr = (u64)((unsigned long) skb);
817 first_txd->addrHi = (u64)((unsigned long) skb) >> 32;
818 first_txd->processFlags = 0; 817 first_txd->processFlags = 0;
819 818
820 if(skb->ip_summed == CHECKSUM_PARTIAL) { 819 if(skb->ip_summed == CHECKSUM_PARTIAL) {
@@ -850,8 +849,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
850 PCI_DMA_TODEVICE); 849 PCI_DMA_TODEVICE);
851 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 850 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
852 txd->len = cpu_to_le16(skb->len); 851 txd->len = cpu_to_le16(skb->len);
853 txd->addr = cpu_to_le32(skb_dma); 852 txd->frag.addr = cpu_to_le32(skb_dma);
854 txd->addrHi = 0; 853 txd->frag.addrHi = 0;
855 first_txd->numDesc++; 854 first_txd->numDesc++;
856 } else { 855 } else {
857 int i, len; 856 int i, len;
@@ -861,8 +860,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
861 PCI_DMA_TODEVICE); 860 PCI_DMA_TODEVICE);
862 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 861 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
863 txd->len = cpu_to_le16(len); 862 txd->len = cpu_to_le16(len);
864 txd->addr = cpu_to_le32(skb_dma); 863 txd->frag.addr = cpu_to_le32(skb_dma);
865 txd->addrHi = 0; 864 txd->frag.addrHi = 0;
866 first_txd->numDesc++; 865 first_txd->numDesc++;
867 866
868 for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 867 for(i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
@@ -880,8 +879,8 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
880 PCI_DMA_TODEVICE); 879 PCI_DMA_TODEVICE);
881 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; 880 txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
882 txd->len = cpu_to_le16(len); 881 txd->len = cpu_to_le16(len);
883 txd->addr = cpu_to_le32(skb_dma); 882 txd->frag.addr = cpu_to_le32(skb_dma);
884 txd->addrHi = 0; 883 txd->frag.addrHi = 0;
885 first_txd->numDesc++; 884 first_txd->numDesc++;
886 } 885 }
887 } 886 }
@@ -977,12 +976,12 @@ typhoon_do_get_stats(struct typhoon *tp)
977 * ethtool_ops->get_{strings,stats}() 976 * ethtool_ops->get_{strings,stats}()
978 */ 977 */
979 stats->tx_packets = le32_to_cpu(s->txPackets); 978 stats->tx_packets = le32_to_cpu(s->txPackets);
980 stats->tx_bytes = le32_to_cpu(s->txBytes); 979 stats->tx_bytes = le64_to_cpu(s->txBytes);
981 stats->tx_errors = le32_to_cpu(s->txCarrierLost); 980 stats->tx_errors = le32_to_cpu(s->txCarrierLost);
982 stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost); 981 stats->tx_carrier_errors = le32_to_cpu(s->txCarrierLost);
983 stats->collisions = le32_to_cpu(s->txMultipleCollisions); 982 stats->collisions = le32_to_cpu(s->txMultipleCollisions);
984 stats->rx_packets = le32_to_cpu(s->rxPacketsGood); 983 stats->rx_packets = le32_to_cpu(s->rxPacketsGood);
985 stats->rx_bytes = le32_to_cpu(s->rxBytesGood); 984 stats->rx_bytes = le64_to_cpu(s->rxBytesGood);
986 stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns); 985 stats->rx_fifo_errors = le32_to_cpu(s->rxFifoOverruns);
987 stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) + 986 stats->rx_errors = le32_to_cpu(s->rxFifoOverruns) +
988 le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors); 987 le32_to_cpu(s->BadSSD) + le32_to_cpu(s->rxCrcErrors);
@@ -1056,7 +1055,7 @@ typhoon_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
1056 if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) { 1055 if(typhoon_issue_command(tp, 1, &xp_cmd, 3, xp_resp) < 0) {
1057 strcpy(info->fw_version, "Unknown runtime"); 1056 strcpy(info->fw_version, "Unknown runtime");
1058 } else { 1057 } else {
1059 u32 sleep_ver = xp_resp[0].parm2; 1058 u32 sleep_ver = le32_to_cpu(xp_resp[0].parm2);
1060 snprintf(info->fw_version, 32, "%02x.%03x.%03x", 1059 snprintf(info->fw_version, 32, "%02x.%03x.%03x",
1061 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff, 1060 sleep_ver >> 24, (sleep_ver >> 12) & 0xfff,
1062 sleep_ver & 0xfff); 1061 sleep_ver & 0xfff);
@@ -1157,7 +1156,7 @@ typhoon_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
1157 } 1156 }
1158 1157
1159 INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT); 1158 INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_XCVR_SELECT);
1160 xp_cmd.parm1 = cpu_to_le16(xcvr); 1159 xp_cmd.parm1 = xcvr;
1161 err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL); 1160 err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
1162 if(err < 0) 1161 if(err < 0)
1163 goto out; 1162 goto out;
@@ -1320,7 +1319,7 @@ typhoon_init_interface(struct typhoon *tp)
1320 tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY; 1319 tp->txLoRing.writeRegister = TYPHOON_REG_TX_LO_READY;
1321 tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY; 1320 tp->txHiRing.writeRegister = TYPHOON_REG_TX_HI_READY;
1322 1321
1323 tp->txlo_dma_addr = iface->txLoAddr; 1322 tp->txlo_dma_addr = le32_to_cpu(iface->txLoAddr);
1324 tp->card_state = Sleeping; 1323 tp->card_state = Sleeping;
1325 smp_wmb(); 1324 smp_wmb();
1326 1325
@@ -1358,7 +1357,7 @@ typhoon_download_firmware(struct typhoon *tp)
1358 u8 *image_data; 1357 u8 *image_data;
1359 void *dpage; 1358 void *dpage;
1360 dma_addr_t dpage_dma; 1359 dma_addr_t dpage_dma;
1361 unsigned int csum; 1360 __sum16 csum;
1362 u32 irqEnabled; 1361 u32 irqEnabled;
1363 u32 irqMasked; 1362 u32 irqMasked;
1364 u32 numSections; 1363 u32 numSections;
@@ -1450,13 +1449,13 @@ typhoon_download_firmware(struct typhoon *tp)
1450 * summing. Fortunately, due to the properties of 1449 * summing. Fortunately, due to the properties of
1451 * the checksum, we can do this once, at the end. 1450 * the checksum, we can do this once, at the end.
1452 */ 1451 */
1453 csum = csum_partial_copy_nocheck(image_data, dpage, 1452 csum = csum_fold(csum_partial_copy_nocheck(image_data,
1454 len, 0); 1453 dpage, len,
1455 csum = csum_fold(csum); 1454 0));
1456 csum = le16_to_cpu(csum);
1457 1455
1458 iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH); 1456 iowrite32(len, ioaddr + TYPHOON_REG_BOOT_LENGTH);
1459 iowrite32(csum, ioaddr + TYPHOON_REG_BOOT_CHECKSUM); 1457 iowrite32(le16_to_cpu((__force __le16)csum),
1458 ioaddr + TYPHOON_REG_BOOT_CHECKSUM);
1460 iowrite32(load_addr, 1459 iowrite32(load_addr,
1461 ioaddr + TYPHOON_REG_BOOT_DEST_ADDR); 1460 ioaddr + TYPHOON_REG_BOOT_DEST_ADDR);
1462 iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI); 1461 iowrite32(0, ioaddr + TYPHOON_REG_BOOT_DATA_HI);
@@ -1551,13 +1550,13 @@ typhoon_clean_tx(struct typhoon *tp, struct transmit_ring *txRing,
1551 if(type == TYPHOON_TX_DESC) { 1550 if(type == TYPHOON_TX_DESC) {
1552 /* This tx_desc describes a packet. 1551 /* This tx_desc describes a packet.
1553 */ 1552 */
1554 unsigned long ptr = tx->addr | ((u64)tx->addrHi << 32); 1553 unsigned long ptr = tx->tx_addr;
1555 struct sk_buff *skb = (struct sk_buff *) ptr; 1554 struct sk_buff *skb = (struct sk_buff *) ptr;
1556 dev_kfree_skb_irq(skb); 1555 dev_kfree_skb_irq(skb);
1557 } else if(type == TYPHOON_FRAG_DESC) { 1556 } else if(type == TYPHOON_FRAG_DESC) {
1558 /* This tx_desc describes a memory mapping. Free it. 1557 /* This tx_desc describes a memory mapping. Free it.
1559 */ 1558 */
1560 skb_dma = (dma_addr_t) le32_to_cpu(tx->addr); 1559 skb_dma = (dma_addr_t) le32_to_cpu(tx->frag.addr);
1561 dma_len = le16_to_cpu(tx->len); 1560 dma_len = le16_to_cpu(tx->len);
1562 pci_unmap_single(tp->pdev, skb_dma, dma_len, 1561 pci_unmap_single(tp->pdev, skb_dma, dma_len,
1563 PCI_DMA_TODEVICE); 1562 PCI_DMA_TODEVICE);
@@ -1596,7 +1595,7 @@ typhoon_recycle_rx_skb(struct typhoon *tp, u32 idx)
1596 struct rx_free *r; 1595 struct rx_free *r;
1597 1596
1598 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == 1597 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
1599 indexes->rxBuffCleared) { 1598 le32_to_cpu(indexes->rxBuffCleared)) {
1600 /* no room in ring, just drop the skb 1599 /* no room in ring, just drop the skb
1601 */ 1600 */
1602 dev_kfree_skb_any(rxb->skb); 1601 dev_kfree_skb_any(rxb->skb);
@@ -1627,7 +1626,7 @@ typhoon_alloc_rx_skb(struct typhoon *tp, u32 idx)
1627 rxb->skb = NULL; 1626 rxb->skb = NULL;
1628 1627
1629 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) == 1628 if((ring->lastWrite + sizeof(*r)) % (RXFREE_ENTRIES * sizeof(*r)) ==
1630 indexes->rxBuffCleared) 1629 le32_to_cpu(indexes->rxBuffCleared))
1631 return -ENOMEM; 1630 return -ENOMEM;
1632 1631
1633 skb = dev_alloc_skb(PKT_BUF_SZ); 1632 skb = dev_alloc_skb(PKT_BUF_SZ);
diff --git a/drivers/net/typhoon.h b/drivers/net/typhoon.h
index 19df20889b82..dd7022ca7354 100644
--- a/drivers/net/typhoon.h
+++ b/drivers/net/typhoon.h
@@ -73,7 +73,7 @@ struct typhoon_indexes {
73 volatile __le32 txLoCleared; 73 volatile __le32 txLoCleared;
74 volatile __le32 txHiCleared; 74 volatile __le32 txHiCleared;
75 volatile __le32 rxLoReady; 75 volatile __le32 rxLoReady;
76 volatile __u32 rxBuffCleared; /* AV: really? */ 76 volatile __le32 rxBuffCleared;
77 volatile __le32 cmdCleared; 77 volatile __le32 cmdCleared;
78 volatile __le32 respReady; 78 volatile __le32 respReady;
79 volatile __le32 rxHiReady; 79 volatile __le32 rxHiReady;
@@ -166,8 +166,13 @@ struct tx_desc {
166#define TYPHOON_DESC_VALID 0x80 166#define TYPHOON_DESC_VALID 0x80
167 u8 numDesc; 167 u8 numDesc;
168 __le16 len; 168 __le16 len;
169 u32 addr; 169 union {
170 u32 addrHi; 170 struct {
171 __le32 addr;
172 __le32 addrHi;
173 } frag;
174 u64 tx_addr; /* opaque for hardware, for TX_DESC */
175 };
171 __le32 processFlags; 176 __le32 processFlags;
172#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001) 177#define TYPHOON_TX_PF_NO_CRC __constant_cpu_to_le32(0x00000001)
173#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002) 178#define TYPHOON_TX_PF_IP_CHKSUM __constant_cpu_to_le32(0x00000002)
@@ -240,8 +245,8 @@ struct rx_desc {
240 u8 flags; 245 u8 flags;
241 u8 numDesc; 246 u8 numDesc;
242 __le16 frameLen; 247 __le16 frameLen;
243 u32 addr; 248 u32 addr; /* opaque, comes from virtAddr */
244 u32 addrHi; 249 u32 addrHi; /* opaque, comes from virtAddrHi */
245 __le32 rxStatus; 250 __le32 rxStatus;
246#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000) 251#define TYPHOON_RX_ERR_INTERNAL __constant_cpu_to_le32(0x00000000)
247#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001) 252#define TYPHOON_RX_ERR_FIFO_UNDERRUN __constant_cpu_to_le32(0x00000001)
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 61daa096de66..1249f444039e 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -172,45 +172,76 @@ struct asix_data {
172}; 172};
173 173
174struct ax88172_int_data { 174struct ax88172_int_data {
175 u16 res1; 175 __le16 res1;
176 u8 link; 176 u8 link;
177 u16 res2; 177 __le16 res2;
178 u8 status; 178 u8 status;
179 u16 res3; 179 __le16 res3;
180} __attribute__ ((packed)); 180} __attribute__ ((packed));
181 181
182static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 182static int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
183 u16 size, void *data) 183 u16 size, void *data)
184{ 184{
185 void *buf;
186 int err = -ENOMEM;
187
185 devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 188 devdbg(dev,"asix_read_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
186 cmd, value, index, size); 189 cmd, value, index, size);
187 return usb_control_msg( 190
191 buf = kmalloc(size, GFP_KERNEL);
192 if (!buf)
193 goto out;
194
195 err = usb_control_msg(
188 dev->udev, 196 dev->udev,
189 usb_rcvctrlpipe(dev->udev, 0), 197 usb_rcvctrlpipe(dev->udev, 0),
190 cmd, 198 cmd,
191 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 199 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
192 value, 200 value,
193 index, 201 index,
194 data, 202 buf,
195 size, 203 size,
196 USB_CTRL_GET_TIMEOUT); 204 USB_CTRL_GET_TIMEOUT);
205 if (err >= 0 && err < size)
206 err = -EINVAL;
207 if (!err)
208 memcpy(data, buf, size);
209 kfree(buf);
210
211out:
212 return err;
197} 213}
198 214
199static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, 215static int asix_write_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index,
200 u16 size, void *data) 216 u16 size, void *data)
201{ 217{
218 void *buf = NULL;
219 int err = -ENOMEM;
220
202 devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d", 221 devdbg(dev,"asix_write_cmd() cmd=0x%02x value=0x%04x index=0x%04x size=%d",
203 cmd, value, index, size); 222 cmd, value, index, size);
204 return usb_control_msg( 223
224 if (data) {
225 buf = kmalloc(size, GFP_KERNEL);
226 if (!buf)
227 goto out;
228 memcpy(buf, data, size);
229 }
230
231 err = usb_control_msg(
205 dev->udev, 232 dev->udev,
206 usb_sndctrlpipe(dev->udev, 0), 233 usb_sndctrlpipe(dev->udev, 0),
207 cmd, 234 cmd,
208 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 235 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
209 value, 236 value,
210 index, 237 index,
211 data, 238 buf,
212 size, 239 size,
213 USB_CTRL_SET_TIMEOUT); 240 USB_CTRL_SET_TIMEOUT);
241 kfree(buf);
242
243out:
244 return err;
214} 245}
215 246
216static void asix_async_cmd_callback(struct urb *urb) 247static void asix_async_cmd_callback(struct urb *urb)
@@ -402,25 +433,19 @@ static inline int asix_set_hw_mii(struct usbnet *dev)
402 433
403static inline int asix_get_phy_addr(struct usbnet *dev) 434static inline int asix_get_phy_addr(struct usbnet *dev)
404{ 435{
405 int ret = 0; 436 u8 buf[2];
406 void *buf; 437 int ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID, 0, 0, 2, buf);
407 438
408 devdbg(dev, "asix_get_phy_addr()"); 439 devdbg(dev, "asix_get_phy_addr()");
409 440
410 buf = kmalloc(2, GFP_KERNEL); 441 if (ret < 0) {
411 if (!buf)
412 goto out1;
413
414 if ((ret = asix_read_cmd(dev, AX_CMD_READ_PHY_ID,
415 0, 0, 2, buf)) < 2) {
416 deverr(dev, "Error reading PHYID register: %02x", ret); 442 deverr(dev, "Error reading PHYID register: %02x", ret);
417 goto out2; 443 goto out;
418 } 444 }
419 devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((u16 *)buf)); 445 devdbg(dev, "asix_get_phy_addr() returning 0x%04x", *((__le16 *)buf));
420 ret = *((u8 *)buf + 1); 446 ret = buf[1];
421out2: 447
422 kfree(buf); 448out:
423out1:
424 return ret; 449 return ret;
425} 450}
426 451
@@ -437,22 +462,15 @@ static int asix_sw_reset(struct usbnet *dev, u8 flags)
437 462
438static u16 asix_read_rx_ctl(struct usbnet *dev) 463static u16 asix_read_rx_ctl(struct usbnet *dev)
439{ 464{
440 u16 ret = 0; 465 __le16 v;
441 void *buf; 466 int ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 0, 0, 2, &v);
442
443 buf = kmalloc(2, GFP_KERNEL);
444 if (!buf)
445 goto out1;
446 467
447 if ((ret = asix_read_cmd(dev, AX_CMD_READ_RX_CTL, 468 if (ret < 0) {
448 0, 0, 2, buf)) < 2) {
449 deverr(dev, "Error reading RX_CTL register: %02x", ret); 469 deverr(dev, "Error reading RX_CTL register: %02x", ret);
450 goto out2; 470 goto out;
451 } 471 }
452 ret = le16_to_cpu(*((u16 *)buf)); 472 ret = le16_to_cpu(v);
453out2: 473out:
454 kfree(buf);
455out1:
456 return ret; 474 return ret;
457} 475}
458 476
@@ -471,22 +489,15 @@ static int asix_write_rx_ctl(struct usbnet *dev, u16 mode)
471 489
472static u16 asix_read_medium_status(struct usbnet *dev) 490static u16 asix_read_medium_status(struct usbnet *dev)
473{ 491{
474 u16 ret = 0; 492 __le16 v;
475 void *buf; 493 int ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS, 0, 0, 2, &v);
476 494
477 buf = kmalloc(2, GFP_KERNEL); 495 if (ret < 0) {
478 if (!buf)
479 goto out1;
480
481 if ((ret = asix_read_cmd(dev, AX_CMD_READ_MEDIUM_STATUS,
482 0, 0, 2, buf)) < 2) {
483 deverr(dev, "Error reading Medium Status register: %02x", ret); 496 deverr(dev, "Error reading Medium Status register: %02x", ret);
484 goto out2; 497 goto out;
485 } 498 }
486 ret = le16_to_cpu(*((u16 *)buf)); 499 ret = le16_to_cpu(v);
487out2: 500out:
488 kfree(buf);
489out1:
490 return ret; 501 return ret;
491} 502}
492 503
@@ -568,31 +579,30 @@ static void asix_set_multicast(struct net_device *net)
568static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc) 579static int asix_mdio_read(struct net_device *netdev, int phy_id, int loc)
569{ 580{
570 struct usbnet *dev = netdev_priv(netdev); 581 struct usbnet *dev = netdev_priv(netdev);
571 u16 res; 582 __le16 res;
572 583
573 mutex_lock(&dev->phy_mutex); 584 mutex_lock(&dev->phy_mutex);
574 asix_set_sw_mii(dev); 585 asix_set_sw_mii(dev);
575 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id, 586 asix_read_cmd(dev, AX_CMD_READ_MII_REG, phy_id,
576 (__u16)loc, 2, (u16 *)&res); 587 (__u16)loc, 2, &res);
577 asix_set_hw_mii(dev); 588 asix_set_hw_mii(dev);
578 mutex_unlock(&dev->phy_mutex); 589 mutex_unlock(&dev->phy_mutex);
579 590
580 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res & 0xffff)); 591 devdbg(dev, "asix_mdio_read() phy_id=0x%02x, loc=0x%02x, returns=0x%04x", phy_id, loc, le16_to_cpu(res));
581 592
582 return le16_to_cpu(res & 0xffff); 593 return le16_to_cpu(res);
583} 594}
584 595
585static void 596static void
586asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val) 597asix_mdio_write(struct net_device *netdev, int phy_id, int loc, int val)
587{ 598{
588 struct usbnet *dev = netdev_priv(netdev); 599 struct usbnet *dev = netdev_priv(netdev);
589 u16 res = cpu_to_le16(val); 600 __le16 res = cpu_to_le16(val);
590 601
591 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val); 602 devdbg(dev, "asix_mdio_write() phy_id=0x%02x, loc=0x%02x, val=0x%04x", phy_id, loc, val);
592 mutex_lock(&dev->phy_mutex); 603 mutex_lock(&dev->phy_mutex);
593 asix_set_sw_mii(dev); 604 asix_set_sw_mii(dev);
594 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, 605 asix_write_cmd(dev, AX_CMD_WRITE_MII_REG, phy_id, (__u16)loc, 2, &res);
595 (__u16)loc, 2, (u16 *)&res);
596 asix_set_hw_mii(dev); 606 asix_set_hw_mii(dev);
597 mutex_unlock(&dev->phy_mutex); 607 mutex_unlock(&dev->phy_mutex);
598} 608}
@@ -644,7 +654,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
644{ 654{
645 struct usbnet *dev = netdev_priv(net); 655 struct usbnet *dev = netdev_priv(net);
646 u8 opt = 0; 656 u8 opt = 0;
647 u8 buf[1];
648 657
649 if (wolinfo->wolopts & WAKE_PHY) 658 if (wolinfo->wolopts & WAKE_PHY)
650 opt |= AX_MONITOR_LINK; 659 opt |= AX_MONITOR_LINK;
@@ -654,7 +663,7 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
654 opt |= AX_MONITOR_MODE; 663 opt |= AX_MONITOR_MODE;
655 664
656 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, 665 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
657 opt, 0, 0, &buf) < 0) 666 opt, 0, 0, NULL) < 0)
658 return -EINVAL; 667 return -EINVAL;
659 668
660 return 0; 669 return 0;
@@ -672,7 +681,7 @@ static int asix_get_eeprom(struct net_device *net,
672 struct ethtool_eeprom *eeprom, u8 *data) 681 struct ethtool_eeprom *eeprom, u8 *data)
673{ 682{
674 struct usbnet *dev = netdev_priv(net); 683 struct usbnet *dev = netdev_priv(net);
675 u16 *ebuf = (u16 *)data; 684 __le16 *ebuf = (__le16 *)data;
676 int i; 685 int i;
677 686
678 /* Crude hack to ensure that we don't overwrite memory 687 /* Crude hack to ensure that we don't overwrite memory
@@ -801,7 +810,7 @@ static int ax88172_link_reset(struct usbnet *dev)
801static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) 810static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
802{ 811{
803 int ret = 0; 812 int ret = 0;
804 void *buf; 813 u8 buf[ETH_ALEN];
805 int i; 814 int i;
806 unsigned long gpio_bits = dev->driver_info->data; 815 unsigned long gpio_bits = dev->driver_info->data;
807 struct asix_data *data = (struct asix_data *)&dev->data; 816 struct asix_data *data = (struct asix_data *)&dev->data;
@@ -810,30 +819,23 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
810 819
811 usbnet_get_endpoints(dev,intf); 820 usbnet_get_endpoints(dev,intf);
812 821
813 buf = kmalloc(ETH_ALEN, GFP_KERNEL);
814 if(!buf) {
815 ret = -ENOMEM;
816 goto out1;
817 }
818
819 /* Toggle the GPIOs in a manufacturer/model specific way */ 822 /* Toggle the GPIOs in a manufacturer/model specific way */
820 for (i = 2; i >= 0; i--) { 823 for (i = 2; i >= 0; i--) {
821 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, 824 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
822 (gpio_bits >> (i * 8)) & 0xff, 0, 0, 825 (gpio_bits >> (i * 8)) & 0xff, 0, 0,
823 buf)) < 0) 826 NULL)) < 0)
824 goto out2; 827 goto out;
825 msleep(5); 828 msleep(5);
826 } 829 }
827 830
828 if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) 831 if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0)
829 goto out2; 832 goto out;
830 833
831 /* Get the MAC address */ 834 /* Get the MAC address */
832 memset(buf, 0, ETH_ALEN);
833 if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 835 if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID,
834 0, 0, 6, buf)) < 0) { 836 0, 0, ETH_ALEN, buf)) < 0) {
835 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 837 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
836 goto out2; 838 goto out;
837 } 839 }
838 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 840 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
839 841
@@ -855,9 +857,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
855 mii_nway_restart(&dev->mii); 857 mii_nway_restart(&dev->mii);
856 858
857 return 0; 859 return 0;
858out2: 860
859 kfree(buf); 861out:
860out1:
861 return ret; 862 return ret;
862} 863}
863 864
@@ -900,66 +901,58 @@ static int ax88772_link_reset(struct usbnet *dev)
900static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) 901static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
901{ 902{
902 int ret, embd_phy; 903 int ret, embd_phy;
903 void *buf;
904 u16 rx_ctl; 904 u16 rx_ctl;
905 struct asix_data *data = (struct asix_data *)&dev->data; 905 struct asix_data *data = (struct asix_data *)&dev->data;
906 u8 buf[ETH_ALEN];
906 u32 phyid; 907 u32 phyid;
907 908
908 data->eeprom_len = AX88772_EEPROM_LEN; 909 data->eeprom_len = AX88772_EEPROM_LEN;
909 910
910 usbnet_get_endpoints(dev,intf); 911 usbnet_get_endpoints(dev,intf);
911 912
912 buf = kmalloc(6, GFP_KERNEL);
913 if(!buf) {
914 dbg ("Cannot allocate memory for buffer");
915 ret = -ENOMEM;
916 goto out1;
917 }
918
919 if ((ret = asix_write_gpio(dev, 913 if ((ret = asix_write_gpio(dev,
920 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) 914 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
921 goto out2; 915 goto out;
922 916
923 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */ 917 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
924 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); 918 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
925 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 919 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
926 embd_phy, 0, 0, buf)) < 0) { 920 embd_phy, 0, 0, NULL)) < 0) {
927 dbg("Select PHY #1 failed: %d", ret); 921 dbg("Select PHY #1 failed: %d", ret);
928 goto out2; 922 goto out;
929 } 923 }
930 924
931 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) 925 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
932 goto out2; 926 goto out;
933 927
934 msleep(150); 928 msleep(150);
935 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) 929 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0)
936 goto out2; 930 goto out;
937 931
938 msleep(150); 932 msleep(150);
939 if (embd_phy) { 933 if (embd_phy) {
940 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) 934 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
941 goto out2; 935 goto out;
942 } 936 }
943 else { 937 else {
944 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) 938 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
945 goto out2; 939 goto out;
946 } 940 }
947 941
948 msleep(150); 942 msleep(150);
949 rx_ctl = asix_read_rx_ctl(dev); 943 rx_ctl = asix_read_rx_ctl(dev);
950 dbg("RX_CTL is 0x%04x after software reset", rx_ctl); 944 dbg("RX_CTL is 0x%04x after software reset", rx_ctl);
951 if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) 945 if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0)
952 goto out2; 946 goto out;
953 947
954 rx_ctl = asix_read_rx_ctl(dev); 948 rx_ctl = asix_read_rx_ctl(dev);
955 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); 949 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl);
956 950
957 /* Get the MAC address */ 951 /* Get the MAC address */
958 memset(buf, 0, ETH_ALEN);
959 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 952 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
960 0, 0, ETH_ALEN, buf)) < 0) { 953 0, 0, ETH_ALEN, buf)) < 0) {
961 dbg("Failed to read MAC address: %d", ret); 954 dbg("Failed to read MAC address: %d", ret);
962 goto out2; 955 goto out;
963 } 956 }
964 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 957 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
965 958
@@ -976,12 +969,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
976 dbg("PHYID=0x%08x", phyid); 969 dbg("PHYID=0x%08x", phyid);
977 970
978 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0) 971 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
979 goto out2; 972 goto out;
980 973
981 msleep(150); 974 msleep(150);
982 975
983 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) 976 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
984 goto out2; 977 goto out;
985 978
986 msleep(150); 979 msleep(150);
987 980
@@ -994,18 +987,18 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
994 mii_nway_restart(&dev->mii); 987 mii_nway_restart(&dev->mii);
995 988
996 if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) 989 if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0)
997 goto out2; 990 goto out;
998 991
999 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, 992 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
1000 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 993 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
1001 AX88772_IPG2_DEFAULT, 0, buf)) < 0) { 994 AX88772_IPG2_DEFAULT, 0, NULL)) < 0) {
1002 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 995 dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
1003 goto out2; 996 goto out;
1004 } 997 }
1005 998
1006 /* Set RX_CTL to default values with 2k buffer, and enable cactus */ 999 /* Set RX_CTL to default values with 2k buffer, and enable cactus */
1007 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1000 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
1008 goto out2; 1001 goto out;
1009 1002
1010 rx_ctl = asix_read_rx_ctl(dev); 1003 rx_ctl = asix_read_rx_ctl(dev);
1011 dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); 1004 dbg("RX_CTL is 0x%04x after all initializations", rx_ctl);
@@ -1013,20 +1006,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1013 rx_ctl = asix_read_medium_status(dev); 1006 rx_ctl = asix_read_medium_status(dev);
1014 dbg("Medium Status is 0x%04x after all initializations", rx_ctl); 1007 dbg("Medium Status is 0x%04x after all initializations", rx_ctl);
1015 1008
1016 kfree(buf);
1017
1018 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1009 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1019 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1010 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
1020 /* hard_mtu is still the default - the device does not support 1011 /* hard_mtu is still the default - the device does not support
1021 jumbo eth frames */ 1012 jumbo eth frames */
1022 dev->rx_urb_size = 2048; 1013 dev->rx_urb_size = 2048;
1023 } 1014 }
1024
1025 return 0; 1015 return 0;
1026 1016
1027out2: 1017out:
1028 kfree(buf);
1029out1:
1030 return ret; 1018 return ret;
1031} 1019}
1032 1020
@@ -1195,23 +1183,16 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1195{ 1183{
1196 struct asix_data *data = (struct asix_data *)&dev->data; 1184 struct asix_data *data = (struct asix_data *)&dev->data;
1197 int ret; 1185 int ret;
1198 void *buf; 1186 u8 buf[ETH_ALEN];
1199 u16 eeprom; 1187 __le16 eeprom;
1188 u8 status;
1200 int gpio0 = 0; 1189 int gpio0 = 0;
1201 u32 phyid; 1190 u32 phyid;
1202 1191
1203 usbnet_get_endpoints(dev,intf); 1192 usbnet_get_endpoints(dev,intf);
1204 1193
1205 buf = kmalloc(6, GFP_KERNEL); 1194 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
1206 if(!buf) { 1195 dbg("GPIO Status: 0x%04x", status);
1207 dbg ("Cannot allocate memory for buffer");
1208 ret = -ENOMEM;
1209 goto out1;
1210 }
1211
1212 eeprom = 0;
1213 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &eeprom);
1214 dbg("GPIO Status: 0x%04x", eeprom);
1215 1196
1216 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); 1197 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
1217 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); 1198 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
@@ -1219,19 +1200,19 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1219 1200
1220 dbg("EEPROM index 0x17 is 0x%04x", eeprom); 1201 dbg("EEPROM index 0x17 is 0x%04x", eeprom);
1221 1202
1222 if (eeprom == 0xffff) { 1203 if (eeprom == cpu_to_le16(0xffff)) {
1223 data->phymode = PHY_MODE_MARVELL; 1204 data->phymode = PHY_MODE_MARVELL;
1224 data->ledmode = 0; 1205 data->ledmode = 0;
1225 gpio0 = 1; 1206 gpio0 = 1;
1226 } else { 1207 } else {
1227 data->phymode = eeprom & 7; 1208 data->phymode = le16_to_cpu(eeprom) & 7;
1228 data->ledmode = eeprom >> 8; 1209 data->ledmode = le16_to_cpu(eeprom) >> 8;
1229 gpio0 = (eeprom & 0x80) ? 0 : 1; 1210 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
1230 } 1211 }
1231 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); 1212 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
1232 1213
1233 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); 1214 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
1234 if ((eeprom >> 8) != 1) { 1215 if ((le16_to_cpu(eeprom) >> 8) != 1) {
1235 asix_write_gpio(dev, 0x003c, 30); 1216 asix_write_gpio(dev, 0x003c, 30);
1236 asix_write_gpio(dev, 0x001c, 300); 1217 asix_write_gpio(dev, 0x001c, 300);
1237 asix_write_gpio(dev, 0x003c, 30); 1218 asix_write_gpio(dev, 0x003c, 30);
@@ -1250,11 +1231,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1250 asix_write_rx_ctl(dev, 0); 1231 asix_write_rx_ctl(dev, 0);
1251 1232
1252 /* Get the MAC address */ 1233 /* Get the MAC address */
1253 memset(buf, 0, ETH_ALEN);
1254 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 1234 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID,
1255 0, 0, ETH_ALEN, buf)) < 0) { 1235 0, 0, ETH_ALEN, buf)) < 0) {
1256 dbg("Failed to read MAC address: %d", ret); 1236 dbg("Failed to read MAC address: %d", ret);
1257 goto out2; 1237 goto out;
1258 } 1238 }
1259 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 1239 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1260 1240
@@ -1289,12 +1269,10 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1289 mii_nway_restart(&dev->mii); 1269 mii_nway_restart(&dev->mii);
1290 1270
1291 if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0) 1271 if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0)
1292 goto out2; 1272 goto out;
1293 1273
1294 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1274 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0)
1295 goto out2; 1275 goto out;
1296
1297 kfree(buf);
1298 1276
1299 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1277 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1300 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1278 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -1302,12 +1280,9 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1302 jumbo eth frames */ 1280 jumbo eth frames */
1303 dev->rx_urb_size = 2048; 1281 dev->rx_urb_size = 2048;
1304 } 1282 }
1305
1306 return 0; 1283 return 0;
1307 1284
1308out2: 1285out:
1309 kfree(buf);
1310out1:
1311 return ret; 1286 return ret;
1312} 1287}
1313 1288
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c
index 8a1778cf98d1..d3b28b01b9f9 100644
--- a/drivers/net/wan/cycx_x25.c
+++ b/drivers/net/wan/cycx_x25.c
@@ -503,7 +503,7 @@ static int cycx_netdevice_init(struct net_device *dev)
503 dev->addr_len = 0; /* hardware address length */ 503 dev->addr_len = 0; /* hardware address length */
504 504
505 if (!chan->svc) 505 if (!chan->svc)
506 *(u16*)dev->dev_addr = htons(chan->lcn); 506 *(__be16*)dev->dev_addr = htons(chan->lcn);
507 507
508 /* Initialize hardware parameters (just for reference) */ 508 /* Initialize hardware parameters (just for reference) */
509 dev->irq = wandev->irq; 509 dev->irq = wandev->irq;
@@ -565,7 +565,7 @@ static int cycx_netdevice_hard_header(struct sk_buff *skb,
565 const void *daddr, const void *saddr, 565 const void *daddr, const void *saddr,
566 unsigned len) 566 unsigned len)
567{ 567{
568 skb->protocol = type; 568 skb->protocol = htons(type);
569 569
570 return dev->hard_header_len; 570 return dev->hard_header_len;
571} 571}
@@ -600,15 +600,15 @@ static int cycx_netdevice_hard_start_xmit(struct sk_buff *skb,
600 struct cycx_device *card = chan->card; 600 struct cycx_device *card = chan->card;
601 601
602 if (!chan->svc) 602 if (!chan->svc)
603 chan->protocol = skb->protocol; 603 chan->protocol = ntohs(skb->protocol);
604 604
605 if (card->wandev.state != WAN_CONNECTED) 605 if (card->wandev.state != WAN_CONNECTED)
606 ++chan->ifstats.tx_dropped; 606 ++chan->ifstats.tx_dropped;
607 else if (chan->svc && chan->protocol && 607 else if (chan->svc && chan->protocol &&
608 chan->protocol != skb->protocol) { 608 chan->protocol != ntohs(skb->protocol)) {
609 printk(KERN_INFO 609 printk(KERN_INFO
610 "%s: unsupported Ethertype 0x%04X on interface %s!\n", 610 "%s: unsupported Ethertype 0x%04X on interface %s!\n",
611 card->devname, skb->protocol, dev->name); 611 card->devname, ntohs(skb->protocol), dev->name);
612 ++chan->ifstats.tx_errors; 612 ++chan->ifstats.tx_errors;
613 } else if (chan->protocol == ETH_P_IP) { 613 } else if (chan->protocol == ETH_P_IP) {
614 switch (chan->state) { 614 switch (chan->state) {
@@ -1401,7 +1401,7 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state)
1401 switch (state) { 1401 switch (state) {
1402 case WAN_CONNECTED: 1402 case WAN_CONNECTED:
1403 string_state = "connected!"; 1403 string_state = "connected!";
1404 *(u16*)dev->dev_addr = htons(chan->lcn); 1404 *(__be16*)dev->dev_addr = htons(chan->lcn);
1405 netif_wake_queue(dev); 1405 netif_wake_queue(dev);
1406 reset_timer(dev); 1406 reset_timer(dev);
1407 1407
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index 5583719a0dca..c98fc62a3e61 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -587,15 +587,66 @@ config ADM8211
587config P54_COMMON 587config P54_COMMON
588 tristate "Softmac Prism54 support" 588 tristate "Softmac Prism54 support"
589 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL 589 depends on MAC80211 && WLAN_80211 && FW_LOADER && EXPERIMENTAL
590 ---help---
591 This is common code for isl38xx based cards.
592 This module does nothing by itself - the USB/PCI frontends
593 also need to be enabled in order to support any devices.
594
595 These devices require softmac firmware which can be found at
596 http://prism54.org/
597
598 If you choose to build a module, it'll be called p54common.
590 599
591config P54_USB 600config P54_USB
592 tristate "Prism54 USB support" 601 tristate "Prism54 USB support"
593 depends on P54_COMMON && USB 602 depends on P54_COMMON && USB
594 select CRC32 603 select CRC32
604 ---help---
605 This driver is for USB isl38xx based wireless cards.
606 These are USB based adapters found in devices such as:
607
608 3COM 3CRWE254G72
609 SMC 2862W-G
610 Accton 802.11g WN4501 USB
611 Siemens Gigaset USB
612 Netgear WG121
613 Netgear WG111
614 Medion 40900, Roper Europe
615 Shuttle PN15, Airvast WM168g, IOGear GWU513
616 Linksys WUSB54G
617 Linksys WUSB54G Portable
618 DLink DWL-G120 Spinnaker
619 DLink DWL-G122
620 Belkin F5D7050 ver 1000
621 Cohiba Proto board
622 SMC 2862W-G version 2
623 U.S. Robotics U5 802.11g Adapter
624 FUJITSU E-5400 USB D1700
625 Sagem XG703A
626 DLink DWL-G120 Cohiba
627 Spinnaker Proto board
628 Linksys WUSB54AG
629 Inventel UR054G
630 Spinnaker DUT
631
632 These devices require softmac firmware which can be found at
633 http://prism54.org/
634
635 If you choose to build a module, it'll be called p54usb.
595 636
596config P54_PCI 637config P54_PCI
597 tristate "Prism54 PCI support" 638 tristate "Prism54 PCI support"
598 depends on P54_COMMON && PCI 639 depends on P54_COMMON && PCI
640 ---help---
641 This driver is for PCI isl38xx based wireless cards.
642 This driver supports most devices that are supported by the
643 fullmac prism54 driver plus many devices which are not
644 supported by the fullmac driver/firmware.
645
646 This driver requires softmac firmware which can be found at
647 http://prism54.org/
648
649 If you choose to build a module, it'll be called p54pci.
599 650
600source "drivers/net/wireless/iwlwifi/Kconfig" 651source "drivers/net/wireless/iwlwifi/Kconfig"
601source "drivers/net/wireless/hostap/Kconfig" 652source "drivers/net/wireless/hostap/Kconfig"
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index da51f477e9df..88062c1318a8 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d,
1233{ 1233{
1234 struct ipw_priv *priv = dev_get_drvdata(d); 1234 struct ipw_priv *priv = dev_get_drvdata(d);
1235 u32 log_len = ipw_get_event_log_len(priv); 1235 u32 log_len = ipw_get_event_log_len(priv);
1236 struct ipw_event log[log_len]; 1236 u32 log_size;
1237 struct ipw_event *log;
1237 u32 len = 0, i; 1238 u32 len = 0, i;
1238 1239
1240 /* not using min() because of its strict type checking */
1241 log_size = PAGE_SIZE / sizeof(*log) > log_len ?
1242 sizeof(*log) * log_len : PAGE_SIZE;
1243 log = kzalloc(log_size, GFP_KERNEL);
1244 if (!log) {
1245 IPW_ERROR("Unable to allocate memory for log\n");
1246 return 0;
1247 }
1248 log_len = log_size / sizeof(*log);
1239 ipw_capture_event_log(priv, log_len, log); 1249 ipw_capture_event_log(priv, log_len, log);
1240 1250
1241 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); 1251 len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len);
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d,
1244 "\n%08X%08X%08X", 1254 "\n%08X%08X%08X",
1245 log[i].time, log[i].event, log[i].data); 1255 log[i].time, log[i].event, log[i].data);
1246 len += snprintf(buf + len, PAGE_SIZE - len, "\n"); 1256 len += snprintf(buf + len, PAGE_SIZE - len, "\n");
1257 kfree(log);
1247 return len; 1258 return len;
1248} 1259}
1249 1260
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 3d1da0759b97..1a6b0e0edf6f 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -6246,8 +6246,6 @@ static void __iwl_down(struct iwl_priv *priv)
6246 /* Unblock any waiting calls */ 6246 /* Unblock any waiting calls */
6247 wake_up_interruptible_all(&priv->wait_command_queue); 6247 wake_up_interruptible_all(&priv->wait_command_queue);
6248 6248
6249 iwl_cancel_deferred_work(priv);
6250
6251 /* Wipe out the EXIT_PENDING status bit if we are not actually 6249 /* Wipe out the EXIT_PENDING status bit if we are not actually
6252 * exiting the module */ 6250 * exiting the module */
6253 if (!exit_pending) 6251 if (!exit_pending)
@@ -6322,6 +6320,8 @@ static void iwl_down(struct iwl_priv *priv)
6322 mutex_lock(&priv->mutex); 6320 mutex_lock(&priv->mutex);
6323 __iwl_down(priv); 6321 __iwl_down(priv);
6324 mutex_unlock(&priv->mutex); 6322 mutex_unlock(&priv->mutex);
6323
6324 iwl_cancel_deferred_work(priv);
6325} 6325}
6326 6326
6327#define MAX_HW_RESTARTS 5 6327#define MAX_HW_RESTARTS 5
@@ -8580,10 +8580,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
8580 8580
8581 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 8581 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
8582 8582
8583 mutex_lock(&priv->mutex);
8584 set_bit(STATUS_EXIT_PENDING, &priv->status); 8583 set_bit(STATUS_EXIT_PENDING, &priv->status);
8585 __iwl_down(priv); 8584
8586 mutex_unlock(&priv->mutex); 8585 iwl_down(priv);
8587 8586
8588 /* Free MAC hash list for ADHOC */ 8587 /* Free MAC hash list for ADHOC */
8589 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 8588 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -8642,12 +8641,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8642{ 8641{
8643 struct iwl_priv *priv = pci_get_drvdata(pdev); 8642 struct iwl_priv *priv = pci_get_drvdata(pdev);
8644 8643
8645 mutex_lock(&priv->mutex);
8646
8647 set_bit(STATUS_IN_SUSPEND, &priv->status); 8644 set_bit(STATUS_IN_SUSPEND, &priv->status);
8648 8645
8649 /* Take down the device; powers it off, etc. */ 8646 /* Take down the device; powers it off, etc. */
8650 __iwl_down(priv); 8647 iwl_down(priv);
8651 8648
8652 if (priv->mac80211_registered) 8649 if (priv->mac80211_registered)
8653 ieee80211_stop_queues(priv->hw); 8650 ieee80211_stop_queues(priv->hw);
@@ -8656,8 +8653,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
8656 pci_disable_device(pdev); 8653 pci_disable_device(pdev);
8657 pci_set_power_state(pdev, PCI_D3hot); 8654 pci_set_power_state(pdev, PCI_D3hot);
8658 8655
8659 mutex_unlock(&priv->mutex);
8660
8661 return 0; 8656 return 0;
8662} 8657}
8663 8658
@@ -8715,8 +8710,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8715 8710
8716 printk(KERN_INFO "Coming out of suspend...\n"); 8711 printk(KERN_INFO "Coming out of suspend...\n");
8717 8712
8718 mutex_lock(&priv->mutex);
8719
8720 pci_set_power_state(pdev, PCI_D0); 8713 pci_set_power_state(pdev, PCI_D0);
8721 err = pci_enable_device(pdev); 8714 err = pci_enable_device(pdev);
8722 pci_restore_state(pdev); 8715 pci_restore_state(pdev);
@@ -8730,7 +8723,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
8730 pci_write_config_byte(pdev, 0x41, 0x00); 8723 pci_write_config_byte(pdev, 0x41, 0x00);
8731 8724
8732 iwl_resume(priv); 8725 iwl_resume(priv);
8733 mutex_unlock(&priv->mutex);
8734 8726
8735 return 0; 8727 return 0;
8736} 8728}
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index b54fe5e6d529..6cd57c220631 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -6601,8 +6601,6 @@ static void __iwl_down(struct iwl_priv *priv)
6601 /* Unblock any waiting calls */ 6601 /* Unblock any waiting calls */
6602 wake_up_interruptible_all(&priv->wait_command_queue); 6602 wake_up_interruptible_all(&priv->wait_command_queue);
6603 6603
6604 iwl_cancel_deferred_work(priv);
6605
6606 /* Wipe out the EXIT_PENDING status bit if we are not actually 6604 /* Wipe out the EXIT_PENDING status bit if we are not actually
6607 * exiting the module */ 6605 * exiting the module */
6608 if (!exit_pending) 6606 if (!exit_pending)
@@ -6677,6 +6675,8 @@ static void iwl_down(struct iwl_priv *priv)
6677 mutex_lock(&priv->mutex); 6675 mutex_lock(&priv->mutex);
6678 __iwl_down(priv); 6676 __iwl_down(priv);
6679 mutex_unlock(&priv->mutex); 6677 mutex_unlock(&priv->mutex);
6678
6679 iwl_cancel_deferred_work(priv);
6680} 6680}
6681 6681
6682#define MAX_HW_RESTARTS 5 6682#define MAX_HW_RESTARTS 5
@@ -9174,10 +9174,9 @@ static void iwl_pci_remove(struct pci_dev *pdev)
9174 9174
9175 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n"); 9175 IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
9176 9176
9177 mutex_lock(&priv->mutex);
9178 set_bit(STATUS_EXIT_PENDING, &priv->status); 9177 set_bit(STATUS_EXIT_PENDING, &priv->status);
9179 __iwl_down(priv); 9178
9180 mutex_unlock(&priv->mutex); 9179 iwl_down(priv);
9181 9180
9182 /* Free MAC hash list for ADHOC */ 9181 /* Free MAC hash list for ADHOC */
9183 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) { 9182 for (i = 0; i < IWL_IBSS_MAC_HASH_SIZE; i++) {
@@ -9236,12 +9235,10 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9236{ 9235{
9237 struct iwl_priv *priv = pci_get_drvdata(pdev); 9236 struct iwl_priv *priv = pci_get_drvdata(pdev);
9238 9237
9239 mutex_lock(&priv->mutex);
9240
9241 set_bit(STATUS_IN_SUSPEND, &priv->status); 9238 set_bit(STATUS_IN_SUSPEND, &priv->status);
9242 9239
9243 /* Take down the device; powers it off, etc. */ 9240 /* Take down the device; powers it off, etc. */
9244 __iwl_down(priv); 9241 iwl_down(priv);
9245 9242
9246 if (priv->mac80211_registered) 9243 if (priv->mac80211_registered)
9247 ieee80211_stop_queues(priv->hw); 9244 ieee80211_stop_queues(priv->hw);
@@ -9250,8 +9247,6 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
9250 pci_disable_device(pdev); 9247 pci_disable_device(pdev);
9251 pci_set_power_state(pdev, PCI_D3hot); 9248 pci_set_power_state(pdev, PCI_D3hot);
9252 9249
9253 mutex_unlock(&priv->mutex);
9254
9255 return 0; 9250 return 0;
9256} 9251}
9257 9252
@@ -9309,8 +9304,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9309 9304
9310 printk(KERN_INFO "Coming out of suspend...\n"); 9305 printk(KERN_INFO "Coming out of suspend...\n");
9311 9306
9312 mutex_lock(&priv->mutex);
9313
9314 pci_set_power_state(pdev, PCI_D0); 9307 pci_set_power_state(pdev, PCI_D0);
9315 err = pci_enable_device(pdev); 9308 err = pci_enable_device(pdev);
9316 pci_restore_state(pdev); 9309 pci_restore_state(pdev);
@@ -9324,7 +9317,6 @@ static int iwl_pci_resume(struct pci_dev *pdev)
9324 pci_write_config_byte(pdev, 0x41, 0x00); 9317 pci_write_config_byte(pdev, 0x41, 0x00);
9325 9318
9326 iwl_resume(priv); 9319 iwl_resume(priv);
9327 mutex_unlock(&priv->mutex);
9328 9320
9329 return 0; 9321 return 0;
9330} 9322}
diff --git a/drivers/net/wireless/rtl8187_dev.c b/drivers/net/wireless/rtl8187_dev.c
index e454ae83e97a..bd1ab3b3afc0 100644
--- a/drivers/net/wireless/rtl8187_dev.c
+++ b/drivers/net/wireless/rtl8187_dev.c
@@ -38,6 +38,8 @@ static struct usb_device_id rtl8187_table[] __devinitdata = {
38 {USB_DEVICE(0x0846, 0x6a00)}, 38 {USB_DEVICE(0x0846, 0x6a00)},
39 /* HP */ 39 /* HP */
40 {USB_DEVICE(0x03f0, 0xca02)}, 40 {USB_DEVICE(0x03f0, 0xca02)},
41 /* Sitecom */
42 {USB_DEVICE(0x0df6, 0x000d)},
41 {} 43 {}
42}; 44};
43 45
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 87f002ade531..fe6ff3e3d525 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -265,10 +265,10 @@ enum yellowfin_offsets {
265/* The Yellowfin Rx and Tx buffer descriptors. 265/* The Yellowfin Rx and Tx buffer descriptors.
266 Elements are written as 32 bit for endian portability. */ 266 Elements are written as 32 bit for endian portability. */
267struct yellowfin_desc { 267struct yellowfin_desc {
268 u32 dbdma_cmd; 268 __le32 dbdma_cmd;
269 u32 addr; 269 __le32 addr;
270 u32 branch_addr; 270 __le32 branch_addr;
271 u32 result_status; 271 __le32 result_status;
272}; 272};
273 273
274struct tx_status_words { 274struct tx_status_words {
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance)
922 dev->stats.tx_packets++; 922 dev->stats.tx_packets++;
923 dev->stats.tx_bytes += skb->len; 923 dev->stats.tx_bytes += skb->len;
924 /* Free the original skb. */ 924 /* Free the original skb. */
925 pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, 925 pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr),
926 skb->len, PCI_DMA_TODEVICE); 926 skb->len, PCI_DMA_TODEVICE);
927 dev_kfree_skb_irq(skb); 927 dev_kfree_skb_irq(skb);
928 yp->tx_skbuff[entry] = NULL; 928 yp->tx_skbuff[entry] = NULL;
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev)
1056 1056
1057 if(!desc->result_status) 1057 if(!desc->result_status)
1058 break; 1058 break;
1059 pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, 1059 pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr),
1060 yp->rx_buf_sz, PCI_DMA_FROMDEVICE); 1060 yp->rx_buf_sz, PCI_DMA_FROMDEVICE);
1061 desc_status = le32_to_cpu(desc->result_status) >> 16; 1061 desc_status = le32_to_cpu(desc->result_status) >> 16;
1062 buf_addr = rx_skb->data; 1062 buf_addr = rx_skb->data;
1063 data_size = (le32_to_cpu(desc->dbdma_cmd) - 1063 data_size = (le32_to_cpu(desc->dbdma_cmd) -
1064 le32_to_cpu(desc->result_status)) & 0xffff; 1064 le32_to_cpu(desc->result_status)) & 0xffff;
1065 frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); 1065 frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2])));
1066 if (yellowfin_debug > 4) 1066 if (yellowfin_debug > 4)
1067 printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", 1067 printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n",
1068 frame_status); 1068 frame_status);
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev)
1123 if (pkt_len > rx_copybreak) { 1123 if (pkt_len > rx_copybreak) {
1124 skb_put(skb = rx_skb, pkt_len); 1124 skb_put(skb = rx_skb, pkt_len);
1125 pci_unmap_single(yp->pci_dev, 1125 pci_unmap_single(yp->pci_dev,
1126 yp->rx_ring[entry].addr, 1126 le32_to_cpu(yp->rx_ring[entry].addr),
1127 yp->rx_buf_sz, 1127 yp->rx_buf_sz,
1128 PCI_DMA_FROMDEVICE); 1128 PCI_DMA_FROMDEVICE);
1129 yp->rx_skbuff[entry] = NULL; 1129 yp->rx_skbuff[entry] = NULL;
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev)
1134 skb_reserve(skb, 2); /* 16 byte align the IP header */ 1134 skb_reserve(skb, 2); /* 16 byte align the IP header */
1135 skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); 1135 skb_copy_to_linear_data(skb, rx_skb->data, pkt_len);
1136 skb_put(skb, pkt_len); 1136 skb_put(skb, pkt_len);
1137 pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, 1137 pci_dma_sync_single_for_device(yp->pci_dev,
1138 yp->rx_buf_sz, 1138 le32_to_cpu(desc->addr),
1139 PCI_DMA_FROMDEVICE); 1139 yp->rx_buf_sz,
1140 PCI_DMA_FROMDEVICE);
1140 } 1141 }
1141 skb->protocol = eth_type_trans(skb, dev); 1142 skb->protocol = eth_type_trans(skb, dev);
1142 netif_rx(skb); 1143 netif_rx(skb);
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev)
1252 /* Free all the skbuffs in the Rx queue. */ 1253 /* Free all the skbuffs in the Rx queue. */
1253 for (i = 0; i < RX_RING_SIZE; i++) { 1254 for (i = 0; i < RX_RING_SIZE; i++) {
1254 yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); 1255 yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP);
1255 yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ 1256 yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */
1256 if (yp->rx_skbuff[i]) { 1257 if (yp->rx_skbuff[i]) {
1257 dev_kfree_skb(yp->rx_skbuff[i]); 1258 dev_kfree_skb(yp->rx_skbuff[i]);
1258 } 1259 }