gianfar: Remove legacy PM callbacks
[safe/jmp/linux-2.6] / drivers / net / hamachi.c
index 1d5064a..61f2b1c 100644 (file)
@@ -145,6 +145,7 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 /* Time in jiffies before concluding the transmitter is hung. */
 #define TX_TIMEOUT  (5*HZ)
 
+#include <linux/capability.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -152,7 +153,6 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 #include <linux/time.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
-#include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/init.h>
@@ -406,10 +406,9 @@ that case.
 /* A few values that may be tweaked. */
 /* Size of each temporary Rx buffer, calculated as:
  * 1518 bytes (ethernet packet) + 2 bytes (to get 8 byte alignment for
- * the card) + 8 bytes of status info + 8 bytes for the Rx Checksum +
- * 2 more because we use skb_reserve.
+ * the card) + 8 bytes of status info + 8 bytes for the Rx Checksum
  */
-#define PKT_BUF_SZ             1538
+#define PKT_BUF_SZ             1536
 
 /* For now, this is going to be set to the maximum size of an ethernet
  * packet.  Eventually, we may want to make it a variable that is
@@ -860,7 +859,6 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
        for (i = 10000; i >= 0; i--)
                if ((readw(ioaddr + MII_Status) & 1) == 0)
                        break;
-       return;
 }
 
 
@@ -872,7 +870,7 @@ static int hamachi_open(struct net_device *dev)
        u32 rx_int_var, tx_int_var;
        u16 fifo_info;
 
-       i = request_irq(dev->irq, &hamachi_interrupt, IRQF_SHARED, dev->name, dev);
+       i = request_irq(dev->irq, hamachi_interrupt, IRQF_SHARED, dev->name, dev);
        if (i)
                return i;
 
@@ -1151,12 +1149,13 @@ static void hamachi_tx_timeout(struct net_device *dev)
        }
        /* Fill in the Rx buffers.  Handle allocation failure gracefully. */
        for (i = 0; i < RX_RING_SIZE; i++) {
-               struct sk_buff *skb = netdev_alloc_skb(dev, hmp->rx_buf_sz);
+               struct sk_buff *skb;
+
+               skb = netdev_alloc_skb_ip_align(dev, hmp->rx_buf_sz);
                hmp->rx_skbuff[i] = skb;
                if (skb == NULL)
                        break;
 
-               skb_reserve(skb, 2); /* 16 byte align the IP header. */
                 hmp->rx_ring[i].addr = cpu_to_leXX(pci_map_single(hmp->pci_dev,
                        skb->data, hmp->rx_buf_sz, PCI_DMA_FROMDEVICE));
                hmp->rx_ring[i].status_n_length = cpu_to_le32(DescOwn |
@@ -1195,7 +1194,7 @@ static void hamachi_init_ring(struct net_device *dev)
         * card.  -KDU
         */
        hmp->rx_buf_sz = (dev->mtu <= 1492 ? PKT_BUF_SZ :
-               (((dev->mtu+26+7) & ~7) + 2 + 16));
+               (((dev->mtu+26+7) & ~7) + 16));
 
        /* Initialize all Rx descriptors. */
        for (i = 0; i < RX_RING_SIZE; i++) {
@@ -1225,8 +1224,6 @@ static void hamachi_init_ring(struct net_device *dev)
        }
        /* Mark the last entry of the ring */
        hmp->tx_ring[TX_RING_SIZE-1].status_n_length |= cpu_to_le32(DescEndRing);
-
-       return;
 }
 
 
@@ -1565,8 +1562,8 @@ static int hamachi_rx(struct net_device *dev)
 #endif
                        /* Check if the packet is long enough to accept without copying
                           to a minimally-sized skbuff. */
-                       if (pkt_len < rx_copybreak
-                               && (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
+                       if (pkt_len < rx_copybreak &&
+                           (skb = dev_alloc_skb(pkt_len + 2)) != NULL) {
 #ifdef RX_CHECKSUM
                                printk(KERN_ERR "%s: rx_copybreak non-zero "
                                  "not good with RX_CHECKSUM\n", dev->name);
@@ -1721,10 +1718,10 @@ static void hamachi_error(struct net_device *dev, int intr_status)
                readl(ioaddr + 0x370);
                readl(ioaddr + 0x3F0);
        }
-       if ((intr_status & ~(LinkChange|StatsMax|NegotiationChange|IntrRxDone|IntrTxDone))
-               && hamachi_debug)
+       if ((intr_status & ~(LinkChange|StatsMax|NegotiationChange|IntrRxDone|IntrTxDone)) &&
+           hamachi_debug)
                printk(KERN_ERR "%s: Something Wicked happened! %4.4x.\n",
-                          dev->name, intr_status);
+                      dev->name, intr_status);
        /* Hmmmmm, it's not clear how to recover from PCI faults. */
        if (intr_status & (IntrTxPCIErr | IntrTxPCIFault))
                hmp->stats.tx_fifo_errors++;
@@ -1853,17 +1850,18 @@ static void set_rx_mode(struct net_device *dev)
 
        if (dev->flags & IFF_PROMISC) {                 /* Set promiscuous. */
                writew(0x000F, ioaddr + AddrMode);
-       } else if ((dev->mc_count > 63)  ||  (dev->flags & IFF_ALLMULTI)) {
+       } else if ((netdev_mc_count(dev) > 63) || (dev->flags & IFF_ALLMULTI)) {
                /* Too many to match, or accept all multicasts. */
                writew(0x000B, ioaddr + AddrMode);
-       } else if (dev->mc_count > 0) { /* Must use the CAM filter. */
-               struct dev_mc_list *mclist;
-               int i;
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-                        i++, mclist = mclist->next) {
-                       writel(*(u32*)(mclist->dmi_addr), ioaddr + 0x100 + i*8);
-                       writel(0x20000 | (*(u16*)&mclist->dmi_addr[4]),
+       } else if (!netdev_mc_empty(dev)) { /* Must use the CAM filter. */
+               struct netdev_hw_addr *ha;
+               int i = 0;
+
+               netdev_for_each_mc_addr(ha, dev) {
+                       writel(*(u32 *)(ha->addr), ioaddr + 0x100 + i*8);
+                       writel(0x20000 | (*(u16 *)&ha->addr[4]),
                                   ioaddr + 0x104 + i*8);
+                       i++;
                }
                /* Clear remaining entries. */
                for (; i < 64; i++)
@@ -1989,7 +1987,7 @@ static void __devexit hamachi_remove_one (struct pci_dev *pdev)
        }
 }
 
-static struct pci_device_id hamachi_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(hamachi_pci_tbl) = {
        { 0x1318, 0x0911, PCI_ANY_ID, PCI_ANY_ID, },
        { 0, }
 };