Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[safe/jmp/linux-2.6] / drivers / net / gianfar.c
index 0cef967..1830f31 100644 (file)
@@ -608,7 +608,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
        int err = 0, i;
        struct net_device *dev = NULL;
        struct gfar_private *priv = NULL;
-       struct device_node *np = ofdev->node;
+       struct device_node *np = ofdev->dev.of_node;
        struct device_node *child = NULL;
        const u32 *stash;
        const u32 *stash_len;
@@ -646,7 +646,7 @@ static int gfar_of_init(struct of_device *ofdev, struct net_device **pdev)
                return -ENOMEM;
 
        priv = netdev_priv(dev);
-       priv->node = ofdev->node;
+       priv->node = ofdev->dev.of_node;
        priv->ndev = dev;
 
        dev->num_tx_queues = num_tx_qs;
@@ -939,7 +939,7 @@ static int gfar_probe(struct of_device *ofdev,
        priv = netdev_priv(dev);
        priv->ndev = dev;
        priv->ofdev = ofdev;
-       priv->node = ofdev->node;
+       priv->node = ofdev->dev.of_node;
        SET_NETDEV_DEV(dev, &ofdev->dev);
 
        spin_lock_init(&priv->bflock);
@@ -1344,21 +1344,9 @@ static struct dev_pm_ops gfar_pm_ops = {
 
 #define GFAR_PM_OPS (&gfar_pm_ops)
 
-static int gfar_legacy_suspend(struct of_device *ofdev, pm_message_t state)
-{
-       return gfar_suspend(&ofdev->dev);
-}
-
-static int gfar_legacy_resume(struct of_device *ofdev)
-{
-       return gfar_resume(&ofdev->dev);
-}
-
 #else
 
 #define GFAR_PM_OPS NULL
-#define gfar_legacy_suspend NULL
-#define gfar_legacy_resume NULL
 
 #endif
 
@@ -1567,9 +1555,9 @@ static void gfar_halt_nodisable(struct net_device *dev)
                tempval |= (DMACTRL_GRS | DMACTRL_GTS);
                gfar_write(&regs->dmactrl, tempval);
 
-               while (!(gfar_read(&regs->ievent) &
-                        (IEVENT_GRSC | IEVENT_GTSC)))
-                       cpu_relax();
+               spin_event_timeout(((gfar_read(&regs->ievent) &
+                        (IEVENT_GRSC | IEVENT_GTSC)) ==
+                        (IEVENT_GRSC | IEVENT_GTSC)), -1, 0);
        }
 }
 
@@ -1705,6 +1693,7 @@ static void free_skb_resources(struct gfar_private *priv)
                        sizeof(struct rxbd8) * priv->total_rx_ring_size,
                        priv->tx_queue[0]->tx_bd_base,
                        priv->tx_queue[0]->tx_bd_dma_base);
+       skb_queue_purge(&priv->rx_recycle);
 }
 
 void gfar_start(struct net_device *dev)
@@ -1738,7 +1727,7 @@ void gfar_start(struct net_device *dev)
                gfar_write(&regs->imask, IMASK_DEFAULT);
        }
 
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* prevent tx timeout */
 }
 
 void gfar_configure_coalescing(struct gfar_private *priv,
@@ -2161,8 +2150,6 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
        /* reduce TxBD free count */
        tx_queue->num_txbdfree -= (nr_txbds);
 
-       dev->trans_start = jiffies;
-
        /* If the next BD still needs to be cleaned up, then the bds
           are full.  We need to tell the kernel to stop sending us stuff. */
        if (!tx_queue->num_txbdfree) {
@@ -2187,7 +2174,6 @@ static int gfar_close(struct net_device *dev)
 
        disable_napi(priv);
 
-       skb_queue_purge(&priv->rx_recycle);
        cancel_work_sync(&priv->reset_task);
        stop_gfar(dev);
 
@@ -3011,8 +2997,6 @@ static void gfar_set_multi(struct net_device *dev)
                                gfar_set_hash_for_addr(dev, ha->addr);
                }
        }
-
-       return;
 }
 
 
@@ -3053,8 +3037,6 @@ static void gfar_set_hash_for_addr(struct net_device *dev, u8 *addr)
        tempval = gfar_read(priv->hash_regs[whichreg]);
        tempval |= value;
        gfar_write(priv->hash_regs[whichreg], tempval);
-
-       return;
 }
 
 
@@ -3185,14 +3167,14 @@ MODULE_DEVICE_TABLE(of, gfar_match);
 
 /* Structure for a device driver */
 static struct of_platform_driver gfar_driver = {
-       .name = "fsl-gianfar",
-       .match_table = gfar_match,
-
+       .driver = {
+               .name = "fsl-gianfar",
+               .owner = THIS_MODULE,
+               .pm = GFAR_PM_OPS,
+               .of_match_table = gfar_match,
+       },
        .probe = gfar_probe,
        .remove = gfar_remove,
-       .suspend = gfar_legacy_suspend,
-       .resume = gfar_legacy_resume,
-       .driver.pm = GFAR_PM_OPS,
 };
 
 static int __init gfar_init(void)