aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atlx/atl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/atlx/atl2.c')
-rw-r--r--drivers/net/atlx/atl2.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index ab688862093f..54662f24f9bb 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -39,6 +39,7 @@
39#include <linux/pci_ids.h> 39#include <linux/pci_ids.h>
40#include <linux/pm.h> 40#include <linux/pm.h>
41#include <linux/skbuff.h> 41#include <linux/skbuff.h>
42#include <linux/slab.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43#include <linux/string.h> 44#include <linux/string.h>
44#include <linux/tcp.h> 45#include <linux/tcp.h>
@@ -63,7 +64,7 @@ MODULE_VERSION(ATL2_DRV_VERSION);
63/* 64/*
64 * atl2_pci_tbl - PCI Device ID Table 65 * atl2_pci_tbl - PCI Device ID Table
65 */ 66 */
66static struct pci_device_id atl2_pci_tbl[] = { 67static DEFINE_PCI_DEVICE_TABLE(atl2_pci_tbl) = {
67 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2)}, 68 {PCI_DEVICE(PCI_VENDOR_ID_ATTANSIC, PCI_DEVICE_ID_ATTANSIC_L2)},
68 /* required last entry */ 69 /* required last entry */
69 {0,} 70 {0,}
@@ -157,7 +158,7 @@ static void atl2_set_multi(struct net_device *netdev)
157 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0); 158 ATL2_WRITE_REG_ARRAY(hw, REG_RX_HASH_TABLE, 1, 0);
158 159
159 /* comoute mc addresses' hash value ,and put it into hash table */ 160 /* comoute mc addresses' hash value ,and put it into hash table */
160 for (mc_ptr = netdev->mc_list; mc_ptr; mc_ptr = mc_ptr->next) { 161 netdev_for_each_mc_addr(mc_ptr, netdev) {
161 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr); 162 hash_value = atl2_hash_mc_addr(hw, mc_ptr->dmi_addr);
162 atl2_hash_set(hw, hash_value); 163 atl2_hash_set(hw, hash_value);
163 } 164 }
@@ -409,7 +410,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
409 if (rxd->status.ok && rxd->status.pkt_size >= 60) { 410 if (rxd->status.ok && rxd->status.pkt_size >= 60) {
410 int rx_size = (int)(rxd->status.pkt_size - 4); 411 int rx_size = (int)(rxd->status.pkt_size - 4);
411 /* alloc new buffer */ 412 /* alloc new buffer */
412 skb = netdev_alloc_skb(netdev, rx_size + NET_IP_ALIGN); 413 skb = netdev_alloc_skb_ip_align(netdev, rx_size);
413 if (NULL == skb) { 414 if (NULL == skb) {
414 printk(KERN_WARNING 415 printk(KERN_WARNING
415 "%s: Mem squeeze, deferring packet.\n", 416 "%s: Mem squeeze, deferring packet.\n",
@@ -421,7 +422,6 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
421 netdev->stats.rx_dropped++; 422 netdev->stats.rx_dropped++;
422 break; 423 break;
423 } 424 }
424 skb_reserve(skb, NET_IP_ALIGN);
425 skb->dev = netdev; 425 skb->dev = netdev;
426 memcpy(skb->data, rxd->packet, rx_size); 426 memcpy(skb->data, rxd->packet, rx_size);
427 skb_put(skb, rx_size); 427 skb_put(skb, rx_size);
@@ -652,7 +652,7 @@ static int atl2_request_irq(struct atl2_adapter *adapter)
652 if (adapter->have_msi) 652 if (adapter->have_msi)
653 flags &= ~IRQF_SHARED; 653 flags &= ~IRQF_SHARED;
654 654
655 return request_irq(adapter->pdev->irq, &atl2_intr, flags, netdev->name, 655 return request_irq(adapter->pdev->irq, atl2_intr, flags, netdev->name,
656 netdev); 656 netdev);
657} 657}
658 658
@@ -1960,12 +1960,15 @@ static int atl2_get_eeprom(struct net_device *netdev,
1960 return -ENOMEM; 1960 return -ENOMEM;
1961 1961
1962 for (i = first_dword; i < last_dword; i++) { 1962 for (i = first_dword; i < last_dword; i++) {
1963 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) 1963 if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) {
1964 return -EIO; 1964 ret_val = -EIO;
1965 goto free;
1966 }
1965 } 1967 }
1966 1968
1967 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), 1969 memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3),
1968 eeprom->len); 1970 eeprom->len);
1971free:
1969 kfree(eeprom_buff); 1972 kfree(eeprom_buff);
1970 1973
1971 return ret_val; 1974 return ret_val;