Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / drivers / net / ethernet / stmicro / stmmac / stmmac_main.c
index d20496f0ebd06a22fa5f50b4965570edd56997df..e821ccc8027bb34a17df8d8b19b672f3d1392c8b 100644 (file)
@@ -2550,12 +2550,6 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
                        netdev_warn(priv->dev, "PTP init failed\n");
        }
 
-#ifdef CONFIG_DEBUG_FS
-       ret = stmmac_init_fs(dev);
-       if (ret < 0)
-               netdev_warn(priv->dev, "%s: failed debugFS registration\n",
-                           __func__);
-#endif
        priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
 
        if (priv->use_riwt) {
@@ -2756,10 +2750,6 @@ static int stmmac_release(struct net_device *dev)
 
        netif_carrier_off(dev);
 
-#ifdef CONFIG_DEBUG_FS
-       stmmac_exit_fs(dev);
-#endif
-
        stmmac_release_ptp(priv);
 
        return 0;
@@ -3899,6 +3889,9 @@ static int stmmac_rings_status_show(struct seq_file *seq, void *v)
        u32 tx_count = priv->plat->tx_queues_to_use;
        u32 queue;
 
+       if ((dev->flags & IFF_UP) == 0)
+               return 0;
+
        for (queue = 0; queue < rx_count; queue++) {
                struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
 
@@ -4371,6 +4364,13 @@ int stmmac_dvr_probe(struct device *device,
                goto error_netdev_register;
        }
 
+#ifdef CONFIG_DEBUG_FS
+       ret = stmmac_init_fs(ndev);
+       if (ret < 0)
+               netdev_warn(priv->dev, "%s: failed debugFS registration\n",
+                           __func__);
+#endif
+
        return ret;
 
 error_netdev_register:
@@ -4406,6 +4406,9 @@ int stmmac_dvr_remove(struct device *dev)
 
        netdev_info(priv->dev, "%s: removing driver", __func__);
 
+#ifdef CONFIG_DEBUG_FS
+       stmmac_exit_fs(ndev);
+#endif
        stmmac_stop_all_dma(priv);
 
        stmmac_mac_set(priv, priv->ioaddr, false);