stmmac: do not sleep in atomic context while suspend/resume
[firefly-linux-kernel-4.4.55.git] / drivers / net / ethernet / stmicro / stmmac / stmmac_main.c
index 81ef9202a3672382c52fee4af9f92ad9bdf9ac67..13e02c375708840e10e318104c576d3a1f2d3b68 100644 (file)
@@ -1745,9 +1745,11 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
        }
 
 #ifdef CONFIG_DEBUG_FS
-       ret = stmmac_init_fs(dev);
-       if (ret < 0)
-               pr_warn("%s: failed debugFS registration\n", __func__);
+       if (init_ptp) {
+               ret = stmmac_init_fs(dev);
+               if (ret < 0)
+                       pr_warn("%s: failed debugFS registration\n", __func__);
+       }
 #endif
        /* Start the ball rolling... */
        pr_debug("%s: DMA RX/TX processes started...\n", dev->name);
@@ -3035,13 +3037,13 @@ int stmmac_suspend(struct net_device *ndev)
        if (priv->phydev)
                phy_stop(priv->phydev);
 
-       spin_lock_irqsave(&priv->lock, flags);
-
        netif_device_detach(ndev);
        netif_stop_queue(ndev);
 
        napi_disable(&priv->napi);
 
+       spin_lock_irqsave(&priv->lock, flags);
+
        /* Stop TX/RX DMA */
        priv->hw->dma->stop_tx(priv->ioaddr);
        priv->hw->dma->stop_rx(priv->ioaddr);