From: Fugang Duan Date: Wed, 6 Nov 2013 05:36:23 +0000 (+0800) Subject: ENGR00286416 net:fec: Pinctrl PM: add net device running status check X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=501454ee92342304ff49ee9458d2783665f27225;p=karo-tx-linux.git ENGR00286416 net:fec: Pinctrl PM: add net device running status check In below case: ifconfig eth0 down echo mem > /sys/power/state After resume, fec pin status set to default, which is not expected and cost unnecessary power. So, add net device running status check before calling Pinctrl PM APIs. Signed-off-by: Fugang Duan --- diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index d48fb53eaebc..78773f7314b5 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -2359,13 +2359,12 @@ fec_suspend(struct device *dev) fec_stop(ndev); netif_device_detach(ndev); fec_enet_clk_enable(ndev, false); + pinctrl_pm_select_sleep_state(&fep->pdev->dev); } if (fep->reg_phy) regulator_disable(fep->reg_phy); - pinctrl_pm_select_sleep_state(&fep->pdev->dev); - return 0; } @@ -2376,8 +2375,6 @@ fec_resume(struct device *dev) struct fec_enet_private *fep = netdev_priv(ndev); int ret; - pinctrl_pm_select_default_state(&fep->pdev->dev); - if (fep->reg_phy) { ret = regulator_enable(fep->reg_phy); if (ret) @@ -2385,6 +2382,7 @@ fec_resume(struct device *dev) } if (netif_running(ndev)) { + pinctrl_pm_select_default_state(&fep->pdev->dev); fec_enet_clk_enable(ndev, true); fec_restart(ndev, fep->full_duplex); netif_device_attach(ndev);