[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221006170237.784639-1-shenwei.wang@nxp.com>
Date: Thu, 6 Oct 2022 12:02:37 -0500
From: Shenwei Wang <shenwei.wang@....com>
To: Russell King <linux@...linux.org.uk>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org, imx@...ts.linux.dev,
Shenwei Wang <shenwei.wang@....com>
Subject: [PATCH 1/1] net: phylink: add phylink_set_mac_pm() helper
The recent commit
'commit 47ac7b2f6a1f ("net: phy: Warn about incorrect
mdio_bus_phy_resume() state")'
requires the MAC driver explicitly tell the phy driver who is
managing the PM, otherwise you will see warning during resume
stage.
Add a helper to let the MAC driver has a way to tell the PHY
driver it will manage the PM.
Signed-off-by: Shenwei Wang <shenwei.wang@....com>
---
drivers/net/phy/phylink.c | 9 +++++++++
include/linux/phylink.h | 1 +
2 files changed, 10 insertions(+)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index e9d62f9598f9..a741c4bb5dd5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1722,6 +1722,15 @@ void phylink_stop(struct phylink *pl)
}
EXPORT_SYMBOL_GPL(phylink_stop);
+void phylink_set_mac_pm(struct phylink *pl)
+{
+ ASSERT_RTNL();
+
+ if (pl->phydev)
+ pl->phydev->mac_managed_pm = true;
+}
+EXPORT_SYMBOL_GPL(phylink_set_mac_pm);
+
/**
* phylink_suspend() - handle a network device suspend event
* @pl: a pointer to a &struct phylink returned from phylink_create()
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 6d06896fc20d..cfcc680462b9 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -540,6 +540,7 @@ void phylink_mac_change(struct phylink *, bool up);
void phylink_start(struct phylink *);
void phylink_stop(struct phylink *);
+void phylink_set_mac_pm(struct phylink *pl);
void phylink_suspend(struct phylink *pl, bool mac_wol);
void phylink_resume(struct phylink *pl);
--
2.34.1
Powered by blists - more mailing lists