[PATCH net-next v4 2/3] net: stmmac: introduce small helper to check STMMAC_FLAG_USE_PHY_WOL

From: Marco Felsch
Date: Fri Jul 21 2023 - 07:09:05 EST


Add a convenient helper to make it easier to check the
STMMAC_FLAG_USE_PHY_WOL flag which is useful for the follow up commit.

Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
Changelog:
v4:
- new patch

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e7ca52f0d2f2d..add271ec8d801 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6949,6 +6949,11 @@ static void stmmac_service_task(struct work_struct *work)
clear_bit(STMMAC_SERVICE_SCHED, &priv->state);
}

+static bool stmmac_use_phy_wol(struct stmmac_priv *priv)
+{
+ return priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL;
+}
+
/**
* stmmac_hw_init - Init the MAC device
* @priv: driver private structure
@@ -6983,7 +6988,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
*/
priv->plat->enh_desc = priv->dma_cap.enh_desc;
priv->plat->pmt = priv->dma_cap.pmt_remote_wake_up &&
- !(priv->plat->flags & STMMAC_FLAG_USE_PHY_WOL);
+ !stmmac_use_phy_wol(priv);
priv->hw->pmt = priv->plat->pmt;
if (priv->dma_cap.hash_tb_sz) {
priv->hw->multicast_filter_bins =
--
2.39.2