PCI: Remove DEFINE_PCI_DEVICE_TABLE macro use
[deliverable/linux.git] / drivers / net / ethernet / amd / pcnet32.c
index e7cc9174e364162c68652e8c083e1d66fd5eefa0..e2e3aaf501a20f7b9e8a7838b9b410ec89017c4d 100644 (file)
@@ -61,7 +61,7 @@ static const char *const version =
 /*
  * PCI device identifiers for "new style" Linux PCI Device Drivers
  */
-static DEFINE_PCI_DEVICE_TABLE(pcnet32_pci_tbl) = {
+static const struct pci_device_id pcnet32_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE_HOME), },
        { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE), },
 
@@ -481,37 +481,32 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev,
        dma_addr_t *new_dma_addr_list;
        struct pcnet32_tx_head *new_tx_ring;
        struct sk_buff **new_skb_list;
+       unsigned int entries = BIT(size);
 
        pcnet32_purge_tx_ring(dev);
 
-       new_tx_ring = pci_alloc_consistent(lp->pci_dev,
-                                          sizeof(struct pcnet32_tx_head) *
-                                          (1 << size),
-                                          &new_ring_dma_addr);
-       if (new_tx_ring == NULL) {
-               netif_err(lp, drv, dev, "Consistent memory allocation failed\n");
+       new_tx_ring =
+               pci_zalloc_consistent(lp->pci_dev,
+                                     sizeof(struct pcnet32_tx_head) * entries,
+                                     &new_ring_dma_addr);
+       if (new_tx_ring == NULL)
                return;
-       }
-       memset(new_tx_ring, 0, sizeof(struct pcnet32_tx_head) * (1 << size));
 
-       new_dma_addr_list = kcalloc(1 << size, sizeof(dma_addr_t),
-                                   GFP_ATOMIC);
+       new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC);
        if (!new_dma_addr_list)
                goto free_new_tx_ring;
 
-       new_skb_list = kcalloc(1 << size, sizeof(struct sk_buff *),
-                              GFP_ATOMIC);
+       new_skb_list = kcalloc(entries, sizeof(struct sk_buff *), GFP_ATOMIC);
        if (!new_skb_list)
                goto free_new_lists;
 
        kfree(lp->tx_skbuff);
        kfree(lp->tx_dma_addr);
        pci_free_consistent(lp->pci_dev,
-                           sizeof(struct pcnet32_tx_head) *
-                           lp->tx_ring_size, lp->tx_ring,
-                           lp->tx_ring_dma_addr);
+                           sizeof(struct pcnet32_tx_head) * lp->tx_ring_size,
+                           lp->tx_ring, lp->tx_ring_dma_addr);
 
-       lp->tx_ring_size = (1 << size);
+       lp->tx_ring_size = entries;
        lp->tx_mod_mask = lp->tx_ring_size - 1;
        lp->tx_len_bits = (size << 12);
        lp->tx_ring = new_tx_ring;
@@ -524,8 +519,7 @@ free_new_lists:
        kfree(new_dma_addr_list);
 free_new_tx_ring:
        pci_free_consistent(lp->pci_dev,
-                           sizeof(struct pcnet32_tx_head) *
-                           (1 << size),
+                           sizeof(struct pcnet32_tx_head) * entries,
                            new_tx_ring,
                            new_ring_dma_addr);
 }
@@ -549,17 +543,14 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev,
        struct pcnet32_rx_head *new_rx_ring;
        struct sk_buff **new_skb_list;
        int new, overlap;
-       unsigned int entries = 1 << size;
+       unsigned int entries = BIT(size);
 
-       new_rx_ring = pci_alloc_consistent(lp->pci_dev,
-                                          sizeof(struct pcnet32_rx_head) *
-                                          entries,
-                                          &new_ring_dma_addr);
-       if (new_rx_ring == NULL) {
-               netif_err(lp, drv, dev, "Consistent memory allocation failed\n");
+       new_rx_ring =
+               pci_zalloc_consistent(lp->pci_dev,
+                                     sizeof(struct pcnet32_rx_head) * entries,
+                                     &new_ring_dma_addr);
+       if (new_rx_ring == NULL)
                return;
-       }
-       memset(new_rx_ring, 0, sizeof(struct pcnet32_rx_head) * entries);
 
        new_dma_addr_list = kcalloc(entries, sizeof(dma_addr_t), GFP_ATOMIC);
        if (!new_dma_addr_list)
This page took 0.026465 seconds and 5 git commands to generate.