extern const struct dev_pm_ops stmmac_simple_pm_ops;
 
+static inline bool stmmac_wol_enabled_mac(struct stmmac_priv *priv)
+{
+       return priv->plat->pmt && device_may_wakeup(priv->device);
+}
+
+static inline bool stmmac_wol_enabled_phy(struct stmmac_priv *priv)
+{
+       return !priv->plat->pmt && device_may_wakeup(priv->device);
+}
+
 int stmmac_mdio_unregister(struct net_device *ndev);
 int stmmac_mdio_register(struct net_device *ndev);
 int stmmac_mdio_reset(struct mii_bus *mii);
 
                priv->plat->serdes_powerdown(ndev, priv->plat->bsp_priv);
 
        /* Enable Power down mode by programming the PMT regs */
-       if (device_may_wakeup(priv->device) && priv->plat->pmt) {
+       if (stmmac_wol_enabled_mac(priv)) {
                stmmac_pmt(priv, priv->hw, priv->wolopts);
                priv->irq_wake = 1;
        } else {
        mutex_unlock(&priv->lock);
 
        rtnl_lock();
-       if (device_may_wakeup(priv->device) && !priv->plat->pmt)
+       if (stmmac_wol_enabled_phy(priv))
                phylink_speed_down(priv->phylink, false);
 
-       phylink_suspend(priv->phylink,
-                       device_may_wakeup(priv->device) && priv->plat->pmt);
+       phylink_suspend(priv->phylink, stmmac_wol_enabled_mac(priv));
        rtnl_unlock();
 
        if (stmmac_fpe_supported(priv))
         * this bit because it can generate problems while resuming
         * from another devices (e.g. serial console).
         */
-       if (device_may_wakeup(priv->device) && priv->plat->pmt) {
+       if (stmmac_wol_enabled_mac(priv)) {
                mutex_lock(&priv->lock);
                stmmac_pmt(priv, priv->hw, 0);
                mutex_unlock(&priv->lock);
         * workqueue thread, which will race with initialisation.
         */
        phylink_resume(priv->phylink);
-       if (device_may_wakeup(priv->device) && !priv->plat->pmt)
+       if (stmmac_wol_enabled_phy(priv))
                phylink_speed_up(priv->phylink);
 
        rtnl_unlock();
 
        if (!netif_running(ndev))
                return 0;
 
-       if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
+       if (!stmmac_wol_enabled_mac(priv)) {
                /* Disable clock in case of PWM is off */
                clk_disable_unprepare(priv->plat->clk_ptp_ref);
 
        if (!netif_running(ndev))
                return 0;
 
-       if (!device_may_wakeup(priv->device) || !priv->plat->pmt) {
+       if (!stmmac_wol_enabled_mac(priv)) {
                /* enable the clk previously disabled */
                ret = pm_runtime_force_resume(dev);
                if (ret)