diff options
author | Joe Perches <joe@perches.com> | 2010-02-15 03:34:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 18:45:45 -0500 |
commit | 9e3f8063a72a946f2ba29068b34190436573dffe (patch) | |
tree | 87810eb54507b99b93d0d7d105a36a42dd17a222 | |
parent | 13ff83b90f1dfae1068a250e8d99d3f9991cfa9d (diff) |
drivers/net/pcnet32.c: Checkpatch cleaning
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/pcnet32.c | 153 |
1 files changed, 73 insertions, 80 deletions
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 9194abc11eef..63e03159daf7 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -52,10 +52,10 @@ static const char *const version = | |||
52 | #include <linux/spinlock.h> | 52 | #include <linux/spinlock.h> |
53 | #include <linux/moduleparam.h> | 53 | #include <linux/moduleparam.h> |
54 | #include <linux/bitops.h> | 54 | #include <linux/bitops.h> |
55 | #include <linux/io.h> | ||
56 | #include <linux/uaccess.h> | ||
55 | 57 | ||
56 | #include <asm/dma.h> | 58 | #include <asm/dma.h> |
57 | #include <asm/io.h> | ||
58 | #include <asm/uaccess.h> | ||
59 | #include <asm/irq.h> | 59 | #include <asm/irq.h> |
60 | 60 | ||
61 | /* | 61 | /* |
@@ -85,7 +85,7 @@ static int cards_found; | |||
85 | static unsigned int pcnet32_portlist[] __initdata = | 85 | static unsigned int pcnet32_portlist[] __initdata = |
86 | { 0x300, 0x320, 0x340, 0x360, 0 }; | 86 | { 0x300, 0x320, 0x340, 0x360, 0 }; |
87 | 87 | ||
88 | static int pcnet32_debug = 0; | 88 | static int pcnet32_debug; |
89 | static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */ | 89 | static int tx_start = 1; /* Mapping -- 0:20, 1:64, 2:128, 3:~220 (depends on chip vers) */ |
90 | static int pcnet32vlb; /* check for VLB cards ? */ | 90 | static int pcnet32vlb; /* check for VLB cards ? */ |
91 | 91 | ||
@@ -392,7 +392,7 @@ static struct pcnet32_access pcnet32_wio = { | |||
392 | static u16 pcnet32_dwio_read_csr(unsigned long addr, int index) | 392 | static u16 pcnet32_dwio_read_csr(unsigned long addr, int index) |
393 | { | 393 | { |
394 | outl(index, addr + PCNET32_DWIO_RAP); | 394 | outl(index, addr + PCNET32_DWIO_RAP); |
395 | return (inl(addr + PCNET32_DWIO_RDP) & 0xffff); | 395 | return inl(addr + PCNET32_DWIO_RDP) & 0xffff; |
396 | } | 396 | } |
397 | 397 | ||
398 | static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val) | 398 | static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val) |
@@ -404,7 +404,7 @@ static void pcnet32_dwio_write_csr(unsigned long addr, int index, u16 val) | |||
404 | static u16 pcnet32_dwio_read_bcr(unsigned long addr, int index) | 404 | static u16 pcnet32_dwio_read_bcr(unsigned long addr, int index) |
405 | { | 405 | { |
406 | outl(index, addr + PCNET32_DWIO_RAP); | 406 | outl(index, addr + PCNET32_DWIO_RAP); |
407 | return (inl(addr + PCNET32_DWIO_BDP) & 0xffff); | 407 | return inl(addr + PCNET32_DWIO_BDP) & 0xffff; |
408 | } | 408 | } |
409 | 409 | ||
410 | static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val) | 410 | static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val) |
@@ -415,7 +415,7 @@ static void pcnet32_dwio_write_bcr(unsigned long addr, int index, u16 val) | |||
415 | 415 | ||
416 | static u16 pcnet32_dwio_read_rap(unsigned long addr) | 416 | static u16 pcnet32_dwio_read_rap(unsigned long addr) |
417 | { | 417 | { |
418 | return (inl(addr + PCNET32_DWIO_RAP) & 0xffff); | 418 | return inl(addr + PCNET32_DWIO_RAP) & 0xffff; |
419 | } | 419 | } |
420 | 420 | ||
421 | static void pcnet32_dwio_write_rap(unsigned long addr, u16 val) | 421 | static void pcnet32_dwio_write_rap(unsigned long addr, u16 val) |
@@ -524,15 +524,14 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
524 | lp->tx_skbuff = new_skb_list; | 524 | lp->tx_skbuff = new_skb_list; |
525 | return; | 525 | return; |
526 | 526 | ||
527 | free_new_lists: | 527 | free_new_lists: |
528 | kfree(new_dma_addr_list); | 528 | kfree(new_dma_addr_list); |
529 | free_new_tx_ring: | 529 | free_new_tx_ring: |
530 | pci_free_consistent(lp->pci_dev, | 530 | pci_free_consistent(lp->pci_dev, |
531 | sizeof(struct pcnet32_tx_head) * | 531 | sizeof(struct pcnet32_tx_head) * |
532 | (1 << size), | 532 | (1 << size), |
533 | new_tx_ring, | 533 | new_tx_ring, |
534 | new_ring_dma_addr); | 534 | new_ring_dma_addr); |
535 | return; | ||
536 | } | 535 | } |
537 | 536 | ||
538 | /* | 537 | /* |
@@ -587,10 +586,11 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
587 | new_skb_list[new] = lp->rx_skbuff[new]; | 586 | new_skb_list[new] = lp->rx_skbuff[new]; |
588 | } | 587 | } |
589 | /* now allocate any new buffers needed */ | 588 | /* now allocate any new buffers needed */ |
590 | for (; new < size; new++ ) { | 589 | for (; new < size; new++) { |
591 | struct sk_buff *rx_skbuff; | 590 | struct sk_buff *rx_skbuff; |
592 | new_skb_list[new] = dev_alloc_skb(PKT_BUF_SKB); | 591 | new_skb_list[new] = dev_alloc_skb(PKT_BUF_SKB); |
593 | if (!(rx_skbuff = new_skb_list[new])) { | 592 | rx_skbuff = new_skb_list[new]; |
593 | if (!rx_skbuff) { | ||
594 | /* keep the original lists and buffers */ | 594 | /* keep the original lists and buffers */ |
595 | netif_err(lp, drv, dev, "%s dev_alloc_skb failed\n", | 595 | netif_err(lp, drv, dev, "%s dev_alloc_skb failed\n", |
596 | __func__); | 596 | __func__); |
@@ -630,8 +630,8 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
630 | lp->rx_skbuff = new_skb_list; | 630 | lp->rx_skbuff = new_skb_list; |
631 | return; | 631 | return; |
632 | 632 | ||
633 | free_all_new: | 633 | free_all_new: |
634 | for (; --new >= lp->rx_ring_size; ) { | 634 | while (--new >= lp->rx_ring_size) { |
635 | if (new_skb_list[new]) { | 635 | if (new_skb_list[new]) { |
636 | pci_unmap_single(lp->pci_dev, new_dma_addr_list[new], | 636 | pci_unmap_single(lp->pci_dev, new_dma_addr_list[new], |
637 | PKT_BUF_SIZE, PCI_DMA_FROMDEVICE); | 637 | PKT_BUF_SIZE, PCI_DMA_FROMDEVICE); |
@@ -639,9 +639,9 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
639 | } | 639 | } |
640 | } | 640 | } |
641 | kfree(new_skb_list); | 641 | kfree(new_skb_list); |
642 | free_new_lists: | 642 | free_new_lists: |
643 | kfree(new_dma_addr_list); | 643 | kfree(new_dma_addr_list); |
644 | free_new_rx_ring: | 644 | free_new_rx_ring: |
645 | pci_free_consistent(lp->pci_dev, | 645 | pci_free_consistent(lp->pci_dev, |
646 | sizeof(struct pcnet32_rx_head) * | 646 | sizeof(struct pcnet32_rx_head) * |
647 | (1 << size), | 647 | (1 << size), |
@@ -831,7 +831,7 @@ static int pcnet32_set_ringparam(struct net_device *dev, | |||
831 | } | 831 | } |
832 | 832 | ||
833 | static void pcnet32_get_strings(struct net_device *dev, u32 stringset, | 833 | static void pcnet32_get_strings(struct net_device *dev, u32 stringset, |
834 | u8 * data) | 834 | u8 *data) |
835 | { | 835 | { |
836 | memcpy(data, pcnet32_gstrings_test, sizeof(pcnet32_gstrings_test)); | 836 | memcpy(data, pcnet32_gstrings_test, sizeof(pcnet32_gstrings_test)); |
837 | } | 837 | } |
@@ -908,39 +908,39 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
908 | /* Initialize Transmit buffers. */ | 908 | /* Initialize Transmit buffers. */ |
909 | size = data_len + 15; | 909 | size = data_len + 15; |
910 | for (x = 0; x < numbuffs; x++) { | 910 | for (x = 0; x < numbuffs; x++) { |
911 | if (!(skb = dev_alloc_skb(size))) { | 911 | skb = dev_alloc_skb(size); |
912 | if (!skb) { | ||
912 | netif_printk(lp, hw, KERN_DEBUG, dev, | 913 | netif_printk(lp, hw, KERN_DEBUG, dev, |
913 | "Cannot allocate skb at line: %d!\n", | 914 | "Cannot allocate skb at line: %d!\n", |
914 | __LINE__); | 915 | __LINE__); |
915 | goto clean_up; | 916 | goto clean_up; |
916 | } else { | ||
917 | packet = skb->data; | ||
918 | skb_put(skb, size); /* create space for data */ | ||
919 | lp->tx_skbuff[x] = skb; | ||
920 | lp->tx_ring[x].length = cpu_to_le16(-skb->len); | ||
921 | lp->tx_ring[x].misc = 0; | ||
922 | |||
923 | /* put DA and SA into the skb */ | ||
924 | for (i = 0; i < 6; i++) | ||
925 | *packet++ = dev->dev_addr[i]; | ||
926 | for (i = 0; i < 6; i++) | ||
927 | *packet++ = dev->dev_addr[i]; | ||
928 | /* type */ | ||
929 | *packet++ = 0x08; | ||
930 | *packet++ = 0x06; | ||
931 | /* packet number */ | ||
932 | *packet++ = x; | ||
933 | /* fill packet with data */ | ||
934 | for (i = 0; i < data_len; i++) | ||
935 | *packet++ = i; | ||
936 | |||
937 | lp->tx_dma_addr[x] = | ||
938 | pci_map_single(lp->pci_dev, skb->data, skb->len, | ||
939 | PCI_DMA_TODEVICE); | ||
940 | lp->tx_ring[x].base = cpu_to_le32(lp->tx_dma_addr[x]); | ||
941 | wmb(); /* Make sure owner changes after all others are visible */ | ||
942 | lp->tx_ring[x].status = cpu_to_le16(status); | ||
943 | } | 917 | } |
918 | packet = skb->data; | ||
919 | skb_put(skb, size); /* create space for data */ | ||
920 | lp->tx_skbuff[x] = skb; | ||
921 | lp->tx_ring[x].length = cpu_to_le16(-skb->len); | ||
922 | lp->tx_ring[x].misc = 0; | ||
923 | |||
924 | /* put DA and SA into the skb */ | ||
925 | for (i = 0; i < 6; i++) | ||
926 | *packet++ = dev->dev_addr[i]; | ||
927 | for (i = 0; i < 6; i++) | ||
928 | *packet++ = dev->dev_addr[i]; | ||
929 | /* type */ | ||
930 | *packet++ = 0x08; | ||
931 | *packet++ = 0x06; | ||
932 | /* packet number */ | ||
933 | *packet++ = x; | ||
934 | /* fill packet with data */ | ||
935 | for (i = 0; i < data_len; i++) | ||
936 | *packet++ = i; | ||
937 | |||
938 | lp->tx_dma_addr[x] = | ||
939 | pci_map_single(lp->pci_dev, skb->data, skb->len, | ||
940 | PCI_DMA_TODEVICE); | ||
941 | lp->tx_ring[x].base = cpu_to_le32(lp->tx_dma_addr[x]); | ||
942 | wmb(); /* Make sure owner changes after all others are visible */ | ||
943 | lp->tx_ring[x].status = cpu_to_le16(status); | ||
944 | } | 944 | } |
945 | 945 | ||
946 | x = a->read_bcr(ioaddr, 32); /* set internal loopback in BCR32 */ | 946 | x = a->read_bcr(ioaddr, 32); /* set internal loopback in BCR32 */ |
@@ -978,9 +978,8 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
978 | for (x = 0; x < numbuffs; x++) { | 978 | for (x = 0; x < numbuffs; x++) { |
979 | netdev_printk(KERN_DEBUG, dev, "Packet %d: ", x); | 979 | netdev_printk(KERN_DEBUG, dev, "Packet %d: ", x); |
980 | skb = lp->rx_skbuff[x]; | 980 | skb = lp->rx_skbuff[x]; |
981 | for (i = 0; i < size; i++) { | 981 | for (i = 0; i < size; i++) |
982 | pr_cont(" %02x", *(skb->data + i)); | 982 | pr_cont(" %02x", *(skb->data + i)); |
983 | } | ||
984 | pr_cont("\n"); | 983 | pr_cont("\n"); |
985 | } | 984 | } |
986 | } | 985 | } |
@@ -1002,7 +1001,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
1002 | x++; | 1001 | x++; |
1003 | } | 1002 | } |
1004 | 1003 | ||
1005 | clean_up: | 1004 | clean_up: |
1006 | *data1 = rc; | 1005 | *data1 = rc; |
1007 | pcnet32_purge_tx_ring(dev); | 1006 | pcnet32_purge_tx_ring(dev); |
1008 | 1007 | ||
@@ -1021,7 +1020,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t * data1) | |||
1021 | } | 1020 | } |
1022 | spin_unlock_irqrestore(&lp->lock, flags); | 1021 | spin_unlock_irqrestore(&lp->lock, flags); |
1023 | 1022 | ||
1024 | return (rc); | 1023 | return rc; |
1025 | } /* end pcnet32_loopback_test */ | 1024 | } /* end pcnet32_loopback_test */ |
1026 | 1025 | ||
1027 | static void pcnet32_led_blink_callback(struct net_device *dev) | 1026 | static void pcnet32_led_blink_callback(struct net_device *dev) |
@@ -1033,9 +1032,8 @@ static void pcnet32_led_blink_callback(struct net_device *dev) | |||
1033 | int i; | 1032 | int i; |
1034 | 1033 | ||
1035 | spin_lock_irqsave(&lp->lock, flags); | 1034 | spin_lock_irqsave(&lp->lock, flags); |
1036 | for (i = 4; i < 8; i++) { | 1035 | for (i = 4; i < 8; i++) |
1037 | a->write_bcr(ioaddr, i, a->read_bcr(ioaddr, i) ^ 0x4000); | 1036 | a->write_bcr(ioaddr, i, a->read_bcr(ioaddr, i) ^ 0x4000); |
1038 | } | ||
1039 | spin_unlock_irqrestore(&lp->lock, flags); | 1037 | spin_unlock_irqrestore(&lp->lock, flags); |
1040 | 1038 | ||
1041 | mod_timer(&lp->blink_timer, PCNET32_BLINK_TIMEOUT); | 1039 | mod_timer(&lp->blink_timer, PCNET32_BLINK_TIMEOUT); |
@@ -1057,9 +1055,8 @@ static int pcnet32_phys_id(struct net_device *dev, u32 data) | |||
1057 | 1055 | ||
1058 | /* Save the current value of the bcrs */ | 1056 | /* Save the current value of the bcrs */ |
1059 | spin_lock_irqsave(&lp->lock, flags); | 1057 | spin_lock_irqsave(&lp->lock, flags); |
1060 | for (i = 4; i < 8; i++) { | 1058 | for (i = 4; i < 8; i++) |
1061 | regs[i - 4] = a->read_bcr(ioaddr, i); | 1059 | regs[i - 4] = a->read_bcr(ioaddr, i); |
1062 | } | ||
1063 | spin_unlock_irqrestore(&lp->lock, flags); | 1060 | spin_unlock_irqrestore(&lp->lock, flags); |
1064 | 1061 | ||
1065 | mod_timer(&lp->blink_timer, jiffies); | 1062 | mod_timer(&lp->blink_timer, jiffies); |
@@ -1074,9 +1071,8 @@ static int pcnet32_phys_id(struct net_device *dev, u32 data) | |||
1074 | 1071 | ||
1075 | /* Restore the original value of the bcrs */ | 1072 | /* Restore the original value of the bcrs */ |
1076 | spin_lock_irqsave(&lp->lock, flags); | 1073 | spin_lock_irqsave(&lp->lock, flags); |
1077 | for (i = 4; i < 8; i++) { | 1074 | for (i = 4; i < 8; i++) |
1078 | a->write_bcr(ioaddr, i, regs[i - 4]); | 1075 | a->write_bcr(ioaddr, i, regs[i - 4]); |
1079 | } | ||
1080 | spin_unlock_irqrestore(&lp->lock, flags); | 1076 | spin_unlock_irqrestore(&lp->lock, flags); |
1081 | 1077 | ||
1082 | return 0; | 1078 | return 0; |
@@ -1173,7 +1169,8 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1173 | if (pkt_len > rx_copybreak) { | 1169 | if (pkt_len > rx_copybreak) { |
1174 | struct sk_buff *newskb; | 1170 | struct sk_buff *newskb; |
1175 | 1171 | ||
1176 | if ((newskb = dev_alloc_skb(PKT_BUF_SKB))) { | 1172 | newskb = dev_alloc_skb(PKT_BUF_SKB); |
1173 | if (newskb) { | ||
1177 | skb_reserve(newskb, NET_IP_ALIGN); | 1174 | skb_reserve(newskb, NET_IP_ALIGN); |
1178 | skb = lp->rx_skbuff[entry]; | 1175 | skb = lp->rx_skbuff[entry]; |
1179 | pci_unmap_single(lp->pci_dev, | 1176 | pci_unmap_single(lp->pci_dev, |
@@ -1191,9 +1188,8 @@ static void pcnet32_rx_entry(struct net_device *dev, | |||
1191 | rx_in_place = 1; | 1188 | rx_in_place = 1; |
1192 | } else | 1189 | } else |
1193 | skb = NULL; | 1190 | skb = NULL; |
1194 | } else { | 1191 | } else |
1195 | skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN); | 1192 | skb = dev_alloc_skb(pkt_len + NET_IP_ALIGN); |
1196 | } | ||
1197 | 1193 | ||
1198 | if (skb == NULL) { | 1194 | if (skb == NULL) { |
1199 | netif_err(lp, drv, dev, "Memory squeeze, dropping packet\n"); | 1195 | netif_err(lp, drv, dev, "Memory squeeze, dropping packet\n"); |
@@ -1380,7 +1376,7 @@ static int pcnet32_get_regs_len(struct net_device *dev) | |||
1380 | struct pcnet32_private *lp = netdev_priv(dev); | 1376 | struct pcnet32_private *lp = netdev_priv(dev); |
1381 | int j = lp->phycount * PCNET32_REGS_PER_PHY; | 1377 | int j = lp->phycount * PCNET32_REGS_PER_PHY; |
1382 | 1378 | ||
1383 | return ((PCNET32_NUM_REGS + j) * sizeof(u16)); | 1379 | return (PCNET32_NUM_REGS + j) * sizeof(u16); |
1384 | } | 1380 | } |
1385 | 1381 | ||
1386 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | 1382 | static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, |
@@ -1404,21 +1400,20 @@ static void pcnet32_get_regs(struct net_device *dev, struct ethtool_regs *regs, | |||
1404 | *buff++ = inw(ioaddr + i); | 1400 | *buff++ = inw(ioaddr + i); |
1405 | 1401 | ||
1406 | /* read control and status registers */ | 1402 | /* read control and status registers */ |
1407 | for (i = 0; i < 90; i++) { | 1403 | for (i = 0; i < 90; i++) |
1408 | *buff++ = a->read_csr(ioaddr, i); | 1404 | *buff++ = a->read_csr(ioaddr, i); |
1409 | } | ||
1410 | 1405 | ||
1411 | *buff++ = a->read_csr(ioaddr, 112); | 1406 | *buff++ = a->read_csr(ioaddr, 112); |
1412 | *buff++ = a->read_csr(ioaddr, 114); | 1407 | *buff++ = a->read_csr(ioaddr, 114); |
1413 | 1408 | ||
1414 | /* read bus configuration registers */ | 1409 | /* read bus configuration registers */ |
1415 | for (i = 0; i < 30; i++) { | 1410 | for (i = 0; i < 30; i++) |
1416 | *buff++ = a->read_bcr(ioaddr, i); | 1411 | *buff++ = a->read_bcr(ioaddr, i); |
1417 | } | 1412 | |
1418 | *buff++ = 0; /* skip bcr30 so as not to hang 79C976 */ | 1413 | *buff++ = 0; /* skip bcr30 so as not to hang 79C976 */ |
1419 | for (i = 31; i < 36; i++) { | 1414 | |
1415 | for (i = 31; i < 36; i++) | ||
1420 | *buff++ = a->read_bcr(ioaddr, i); | 1416 | *buff++ = a->read_bcr(ioaddr, i); |
1421 | } | ||
1422 | 1417 | ||
1423 | /* read mii phy registers */ | 1418 | /* read mii phy registers */ |
1424 | if (lp->mii) { | 1419 | if (lp->mii) { |
@@ -1511,17 +1506,16 @@ pcnet32_probe_pci(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1511 | pr_err("architecture does not support 32bit PCI busmaster DMA\n"); | 1506 | pr_err("architecture does not support 32bit PCI busmaster DMA\n"); |
1512 | return -ENODEV; | 1507 | return -ENODEV; |
1513 | } | 1508 | } |
1514 | if (request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci") == | 1509 | if (!request_region(ioaddr, PCNET32_TOTAL_SIZE, "pcnet32_probe_pci")) { |
1515 | NULL) { | ||
1516 | if (pcnet32_debug & NETIF_MSG_PROBE) | 1510 | if (pcnet32_debug & NETIF_MSG_PROBE) |
1517 | pr_err("io address range already allocated\n"); | 1511 | pr_err("io address range already allocated\n"); |
1518 | return -EBUSY; | 1512 | return -EBUSY; |
1519 | } | 1513 | } |
1520 | 1514 | ||
1521 | err = pcnet32_probe1(ioaddr, 1, pdev); | 1515 | err = pcnet32_probe1(ioaddr, 1, pdev); |
1522 | if (err < 0) { | 1516 | if (err < 0) |
1523 | pci_disable_device(pdev); | 1517 | pci_disable_device(pdev); |
1524 | } | 1518 | |
1525 | return err; | 1519 | return err; |
1526 | } | 1520 | } |
1527 | 1521 | ||
@@ -1764,8 +1758,9 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1764 | dev->base_addr = ioaddr; | 1758 | dev->base_addr = ioaddr; |
1765 | lp = netdev_priv(dev); | 1759 | lp = netdev_priv(dev); |
1766 | /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */ | 1760 | /* pci_alloc_consistent returns page-aligned memory, so we do not have to check the alignment */ |
1767 | if ((lp->init_block = | 1761 | lp->init_block = pci_alloc_consistent(pdev, sizeof(*lp->init_block), |
1768 | pci_alloc_consistent(pdev, sizeof(*lp->init_block), &lp->init_dma_addr)) == NULL) { | 1762 | &lp->init_dma_addr); |
1763 | if (!lp->init_block) { | ||
1769 | if (pcnet32_debug & NETIF_MSG_PROBE) | 1764 | if (pcnet32_debug & NETIF_MSG_PROBE) |
1770 | pr_err("Consistent memory allocation failed\n"); | 1765 | pr_err("Consistent memory allocation failed\n"); |
1771 | ret = -ENOMEM; | 1766 | ret = -ENOMEM; |
@@ -1890,9 +1885,8 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1890 | id1, id2, i); | 1885 | id1, id2, i); |
1891 | } | 1886 | } |
1892 | lp->a.write_bcr(ioaddr, 33, (lp->mii_if.phy_id) << 5); | 1887 | lp->a.write_bcr(ioaddr, 33, (lp->mii_if.phy_id) << 5); |
1893 | if (lp->phycount > 1) { | 1888 | if (lp->phycount > 1) |
1894 | lp->options |= PCNET32_PORT_MII; | 1889 | lp->options |= PCNET32_PORT_MII; |
1895 | } | ||
1896 | } | 1890 | } |
1897 | 1891 | ||
1898 | init_timer(&lp->watchdog_timer); | 1892 | init_timer(&lp->watchdog_timer); |
@@ -2236,7 +2230,7 @@ static int pcnet32_open(struct net_device *dev) | |||
2236 | 2230 | ||
2237 | return 0; /* Always succeed */ | 2231 | return 0; /* Always succeed */ |
2238 | 2232 | ||
2239 | err_free_ring: | 2233 | err_free_ring: |
2240 | /* free any allocated skbuffs */ | 2234 | /* free any allocated skbuffs */ |
2241 | pcnet32_purge_rx_ring(dev); | 2235 | pcnet32_purge_rx_ring(dev); |
2242 | 2236 | ||
@@ -2246,7 +2240,7 @@ static int pcnet32_open(struct net_device *dev) | |||
2246 | */ | 2240 | */ |
2247 | lp->a.write_bcr(ioaddr, 20, 4); | 2241 | lp->a.write_bcr(ioaddr, 20, 4); |
2248 | 2242 | ||
2249 | err_free_irq: | 2243 | err_free_irq: |
2250 | spin_unlock_irqrestore(&lp->lock, flags); | 2244 | spin_unlock_irqrestore(&lp->lock, flags); |
2251 | free_irq(dev->irq, dev); | 2245 | free_irq(dev->irq, dev); |
2252 | return rc; | 2246 | return rc; |
@@ -2297,10 +2291,10 @@ static int pcnet32_init_ring(struct net_device *dev) | |||
2297 | for (i = 0; i < lp->rx_ring_size; i++) { | 2291 | for (i = 0; i < lp->rx_ring_size; i++) { |
2298 | struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; | 2292 | struct sk_buff *rx_skbuff = lp->rx_skbuff[i]; |
2299 | if (rx_skbuff == NULL) { | 2293 | if (rx_skbuff == NULL) { |
2300 | if (! | 2294 | lp->rx_skbuff[i] = dev_alloc_skb(PKT_BUF_SKB); |
2301 | (rx_skbuff = lp->rx_skbuff[i] = | 2295 | rx_skbuff = lp->rx_skbuff[i]; |
2302 | dev_alloc_skb(PKT_BUF_SKB))) { | 2296 | if (!rx_skbuff) { |
2303 | /* there is not much, we can do at this point */ | 2297 | /* there is not much we can do at this point */ |
2304 | netif_err(lp, drv, dev, "%s dev_alloc_skb failed\n", | 2298 | netif_err(lp, drv, dev, "%s dev_alloc_skb failed\n", |
2305 | __func__); | 2299 | __func__); |
2306 | return -1; | 2300 | return -1; |
@@ -2482,9 +2476,8 @@ pcnet32_interrupt(int irq, void *dev_id) | |||
2482 | 2476 | ||
2483 | csr0 = lp->a.read_csr(ioaddr, CSR0); | 2477 | csr0 = lp->a.read_csr(ioaddr, CSR0); |
2484 | while ((csr0 & 0x8f00) && --boguscnt >= 0) { | 2478 | while ((csr0 & 0x8f00) && --boguscnt >= 0) { |
2485 | if (csr0 == 0xffff) { | 2479 | if (csr0 == 0xffff) |
2486 | break; /* PCMCIA remove happened */ | 2480 | break; /* PCMCIA remove happened */ |
2487 | } | ||
2488 | /* Acknowledge all of the current interrupt sources ASAP. */ | 2481 | /* Acknowledge all of the current interrupt sources ASAP. */ |
2489 | lp->a.write_csr(ioaddr, CSR0, csr0 & ~0x004f); | 2482 | lp->a.write_csr(ioaddr, CSR0, csr0 & ~0x004f); |
2490 | 2483 | ||