]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/gianfar.c
USB: use IRQF_DISABLED for HCD interrupt handlers
[linux-2.6-omap-h63xx.git] / drivers / net / gianfar.c
index 0db5e6fabe73146ddc1f29e4e3b220f3ce4fcfec..0431e9ed0fac56681615a495f9f2c1a5f2d30040 100644 (file)
@@ -168,7 +168,6 @@ static int gfar_probe(struct platform_device *pdev)
        struct gfar_private *priv = NULL;
        struct gianfar_platform_data *einfo;
        struct resource *r;
-       int idx;
        int err = 0;
        DECLARE_MAC_BUF(mac);
 
@@ -261,7 +260,9 @@ static int gfar_probe(struct platform_device *pdev)
        dev->hard_start_xmit = gfar_start_xmit;
        dev->tx_timeout = gfar_timeout;
        dev->watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_GFAR_NAPI
        netif_napi_add(dev, &priv->napi, gfar_poll, GFAR_DEV_WEIGHT);
+#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
        dev->poll_controller = gfar_netpoll;
 #endif
@@ -695,7 +696,7 @@ int startup_gfar(struct net_device *dev)
 {
        struct txbd8 *txbdp;
        struct rxbd8 *rxbdp;
-       dma_addr_t addr;
+       dma_addr_t addr = 0;
        unsigned long vaddr;
        int i;
        struct gfar_private *priv = netdev_priv(dev);
@@ -931,9 +932,14 @@ tx_skb_fail:
 /* Returns 0 for success. */
 static int gfar_enet_open(struct net_device *dev)
 {
+#ifdef CONFIG_GFAR_NAPI
+       struct gfar_private *priv = netdev_priv(dev);
+#endif
        int err;
 
+#ifdef CONFIG_GFAR_NAPI
        napi_enable(&priv->napi);
+#endif
 
        /* Initialize a bunch of registers */
        init_registers(dev);
@@ -943,13 +949,19 @@ static int gfar_enet_open(struct net_device *dev)
        err = init_phy(dev);
 
        if(err) {
+#ifdef CONFIG_GFAR_NAPI
                napi_disable(&priv->napi);
+#endif
                return err;
        }
 
        err = startup_gfar(dev);
-       if (err)
+       if (err) {
+#ifdef CONFIG_GFAR_NAPI
                napi_disable(&priv->napi);
+#endif
+               return err;
+       }
 
        netif_start_queue(dev);
 
@@ -1103,7 +1115,9 @@ static int gfar_close(struct net_device *dev)
 {
        struct gfar_private *priv = netdev_priv(dev);
 
+#ifdef CONFIG_GFAR_NAPI
        napi_disable(&priv->napi);
+#endif
 
        stop_gfar(dev);
 
@@ -1225,8 +1239,6 @@ static int gfar_change_mtu(struct net_device *dev, int new_mtu)
  * starting over will fix the problem. */
 static void gfar_timeout(struct net_device *dev)
 {
-       struct gfar_private *priv = netdev_priv(dev);
-
        dev->stats.tx_errors++;
 
        if (dev->flags & IFF_UP) {
@@ -1332,8 +1344,9 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, struct rxbd8 *bdp)
        return skb;
 }
 
-static inline void count_errors(unsigned short status, struct gfar_private *priv)
+static inline void count_errors(unsigned short status, struct net_device *dev)
 {
+       struct gfar_private *priv = netdev_priv(dev);
        struct net_device_stats *stats = &dev->stats;
        struct gfar_extra_stats *estats = &priv->extra_stats;
 
@@ -1527,7 +1540,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
 
                        dev->stats.rx_bytes += pkt_len;
                } else {
-                       count_errors(bdp->status, priv);
+                       count_errors(bdp->status, dev);
 
                        if (skb)
                                dev_kfree_skb_any(skb);