qlcnic: check device class
[safe/jmp/linux-2.6] / drivers / net / dnet.c
index 92c3bd3..8b0f50b 100644 (file)
@@ -8,7 +8,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#include <linux/version.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/kernel.h>
@@ -21,7 +21,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
-#include <linux/platform_device.h>
 
 #include "dnet.h"
 
@@ -280,11 +279,11 @@ static int dnet_mii_probe(struct net_device *dev)
 
        /* attach the mac to the phy */
        if (bp->capabilities & DNET_HAS_RMII) {
-               phydev = phy_connect(dev, phydev->dev.bus_id,
+               phydev = phy_connect(dev, dev_name(&phydev->dev),
                                     &dnet_handle_link_change, 0,
                                     PHY_INTERFACE_MODE_RMII);
        } else {
-               phydev = phy_connect(dev, phydev->dev.bus_id,
+               phydev = phy_connect(dev, dev_name(&phydev->dev),
                                     &dnet_handle_link_change, 0,
                                     PHY_INTERFACE_MODE_MII);
        }
@@ -408,7 +407,7 @@ static int dnet_poll(struct napi_struct *napi, int budget)
                 * packets waiting
                 */
                if (!(dnet_readl(bp, RX_FIFO_WCNT) >> 16)) {
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        int_enable = dnet_readl(bp, INTR_ENB);
                        int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
                        dnet_writel(bp, int_enable, INTR_ENB);
@@ -447,7 +446,7 @@ static int dnet_poll(struct napi_struct *napi, int budget)
        if (npackets < budget) {
                /* We processed all packets available.  Tell NAPI it can
                 * stop polling then re-enable rx interrupts */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                int_enable = dnet_readl(bp, INTR_ENB);
                int_enable |= DNET_INTR_SRC_RX_CMDFIFOAF;
                dnet_writel(bp, int_enable, INTR_ENB);
@@ -507,7 +506,7 @@ static irqreturn_t dnet_interrupt(int irq, void *dev_id)
        }
 
        if (int_current & DNET_INTR_SRC_RX_CMDFIFOAF) {
-               if (netif_rx_schedule_prep(&bp->napi)) {
+               if (napi_schedule_prep(&bp->napi)) {
                        /*
                         * There's no point taking any more interrupts
                         * until we have processed the buffers
@@ -516,7 +515,7 @@ static irqreturn_t dnet_interrupt(int irq, void *dev_id)
                        int_enable = dnet_readl(bp, INTR_ENB);
                        int_enable &= ~DNET_INTR_SRC_RX_CMDFIFOAF;
                        dnet_writel(bp, int_enable, INTR_ENB);
-                       __netif_rx_schedule(&bp->napi);
+                       __napi_schedule(&bp->napi);
                }
                handled = 1;
        }
@@ -542,7 +541,7 @@ static inline void dnet_print_skb(struct sk_buff *skb)
 #define dnet_print_skb(skb)    do {} while (0)
 #endif
 
-static int dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 
        struct dnet *bp = netdev_priv(dev);
@@ -553,8 +552,8 @@ static int dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        tx_status = dnet_readl(bp, TX_STATUS);
 
-       pr_debug("start_xmit: len %u head %p data %p tail %p end %p\n",
-              skb->len, skb->head, skb->data, skb->tail, skb->end);
+       pr_debug("start_xmit: len %u head %p data %p\n",
+              skb->len, skb->head, skb->data);
        dnet_print_skb(skb);
 
        /* frame size (words) */
@@ -564,11 +563,11 @@ static int dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        tx_status = dnet_readl(bp, TX_STATUS);
 
-       bufp = (unsigned int *)(((u32) skb->data) & 0xFFFFFFFC);
+       bufp = (unsigned int *)(((unsigned long) skb->data) & ~0x3UL);
        wrsz = (u32) skb->len + 3;
-       wrsz += ((u32) skb->data) & 0x3;
+       wrsz += ((unsigned long) skb->data) & 0x3;
        wrsz >>= 2;
-       tx_cmd = ((((unsigned int)(skb->data)) & 0x03) << 16) | (u32) skb->len;
+       tx_cmd = ((((unsigned long)(skb->data)) & 0x03) << 16) | (u32) skb->len;
 
        /* check if there is enough room for the current frame */
        if (wrsz < (DNET_FIFO_SIZE - dnet_readl(bp, TX_FIFO_WCNT))) {
@@ -595,9 +594,7 @@ static int dnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        spin_unlock_irqrestore(&bp->lock, flags);
 
-       dev->trans_start = jiffies;
-
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 static void dnet_reset_hw(struct dnet *bp)
@@ -919,7 +916,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
 
        dev_info(&pdev->dev, "Dave DNET at 0x%p (0x%08x) irq %d %pM\n",
               bp->regs, mem_base, dev->irq, dev->dev_addr);
-       dev_info(&pdev->dev, "has %smdio, %sirq, %sgigabit, %sdma \n",
+       dev_info(&pdev->dev, "has %smdio, %sirq, %sgigabit, %sdma\n",
               (bp->capabilities & DNET_HAS_MDIO) ? "" : "no ",
               (bp->capabilities & DNET_HAS_IRQ) ? "" : "no ",
               (bp->capabilities & DNET_HAS_GIGABIT) ? "" : "no ",
@@ -927,7 +924,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
        phydev = bp->phy_dev;
        dev_info(&pdev->dev, "attached PHY driver [%s] "
               "(mii_bus:phy_addr=%s, irq=%d)\n",
-              phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        return 0;