net: convert print_mac to %pM
[deliverable/linux.git] / drivers / net / gianfar.c
index 999d69168277f7190bb2d4e0367ea56a5ba473d8..15c4223870287989926abc9643dae1ffdc20de3e 100644 (file)
@@ -105,6 +105,7 @@ const char gfar_driver_version[] = "1.3";
 
 static int gfar_enet_open(struct net_device *dev);
 static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev);
+static void gfar_reset_task(struct work_struct *work);
 static void gfar_timeout(struct net_device *dev);
 static int gfar_close(struct net_device *dev);
 struct sk_buff *gfar_new_skb(struct net_device *dev);
@@ -160,8 +161,7 @@ static int gfar_probe(struct platform_device *pdev)
        struct gfar_private *priv = NULL;
        struct gianfar_platform_data *einfo;
        struct resource *r;
-       int err = 0;
-       DECLARE_MAC_BUF(mac);
+       int err = 0, irq;
 
        einfo = (struct gianfar_platform_data *) pdev->dev.platform_data;
 
@@ -186,15 +186,25 @@ static int gfar_probe(struct platform_device *pdev)
 
        /* fill out IRQ fields */
        if (einfo->device_flags & FSL_GIANFAR_DEV_HAS_MULTI_INTR) {
-               priv->interruptTransmit = platform_get_irq_byname(pdev, "tx");
-               priv->interruptReceive = platform_get_irq_byname(pdev, "rx");
-               priv->interruptError = platform_get_irq_byname(pdev, "error");
-               if (priv->interruptTransmit < 0 || priv->interruptReceive < 0 || priv->interruptError < 0)
+               irq = platform_get_irq_byname(pdev, "tx");
+               if (irq < 0)
+                       goto regs_fail;
+               priv->interruptTransmit = irq;
+
+               irq = platform_get_irq_byname(pdev, "rx");
+               if (irq < 0)
+                       goto regs_fail;
+               priv->interruptReceive = irq;
+
+               irq = platform_get_irq_byname(pdev, "error");
+               if (irq < 0)
                        goto regs_fail;
+               priv->interruptError = irq;
        } else {
-               priv->interruptTransmit = platform_get_irq(pdev, 0);
-               if (priv->interruptTransmit < 0)
+               irq = platform_get_irq(pdev, 0);
+               if (irq < 0)
                        goto regs_fail;
+               priv->interruptTransmit = irq;
        }
 
        /* get a pointer to the register memory */
@@ -209,6 +219,7 @@ static int gfar_probe(struct platform_device *pdev)
        spin_lock_init(&priv->txlock);
        spin_lock_init(&priv->rxlock);
        spin_lock_init(&priv->bflock);
+       INIT_WORK(&priv->reset_task, gfar_reset_task);
 
        platform_set_drvdata(pdev, dev);
 
@@ -337,6 +348,9 @@ static int gfar_probe(struct platform_device *pdev)
        /* Enable most messages by default */
        priv->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1;
 
+       /* Carrier starts down, phylib will bring it up */
+       netif_carrier_off(dev);
+
        err = register_netdev(dev);
 
        if (err) {
@@ -349,8 +363,7 @@ static int gfar_probe(struct platform_device *pdev)
        gfar_init_sysfs(dev);
 
        /* Print out the device info */
-       printk(KERN_INFO DEVICE_NAME "%s\n",
-              dev->name, print_mac(mac, dev->dev_addr));
+       printk(KERN_INFO DEVICE_NAME "%pM\n", dev->name, dev->dev_addr);
 
        /* Even more device info helps when determining which kernel */
        /* provided which set of benchmarks. */
@@ -1212,6 +1225,7 @@ static int gfar_close(struct net_device *dev)
 
        napi_disable(&priv->napi);
 
+       cancel_work_sync(&priv->reset_task);
        stop_gfar(dev);
 
        /* Disconnect from the PHY */
@@ -1326,13 +1340,16 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
-/* gfar_timeout gets called when a packet has not been
+/* gfar_reset_task gets scheduled when a packet has not been
  * transmitted after a set amount of time.
  * For now, assume that clearing out all the structures, and
- * starting over will fix the problem. */
-static void gfar_timeout(struct net_device *dev)
+ * starting over will fix the problem.
+ */
+static void gfar_reset_task(struct work_struct *work)
 {
-       dev->stats.tx_errors++;
+       struct gfar_private *priv = container_of(work, struct gfar_private,
+                       reset_task);
+       struct net_device *dev = priv->dev;
 
        if (dev->flags & IFF_UP) {
                stop_gfar(dev);
@@ -1342,6 +1359,14 @@ static void gfar_timeout(struct net_device *dev)
        netif_tx_schedule_all(dev);
 }
 
+static void gfar_timeout(struct net_device *dev)
+{
+       struct gfar_private *priv = netdev_priv(dev);
+
+       dev->stats.tx_errors++;
+       schedule_work(&priv->reset_task);
+}
+
 /* Interrupt Handler for Transmit complete */
 static int gfar_clean_tx_ring(struct net_device *dev)
 {
This page took 0.029599 seconds and 5 git commands to generate.