lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20230817150644.3605105-6-vladimir.oltean@nxp.com> Date: Thu, 17 Aug 2023 18:06:41 +0300 From: Vladimir Oltean <vladimir.oltean@....com> To: netdev@...r.kernel.org, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, linux-phy@...ts.infradead.org Cc: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>, Heiner Kallweit <hkallweit1@...il.com>, Andrew Lunn <andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>, Madalin Bucur <madalin.bucur@....com>, Ioana Ciornei <ioana.ciornei@....com>, Camelia Groza <camelia.groza@....com>, Li Yang <leoyang.li@....com>, Rob Herring <robh+dt@...nel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>, Conor Dooley <conor@...nel.org>, Sean Anderson <sean.anderson@...o.com>, Maxime Chevallier <maxime.chevallier@...tlin.com>, Vinod Koul <vkoul@...nel.org>, Kishon Vijay Abraham I <kishon@...nel.org> Subject: [RFC PATCH net-next 5/8] net: phy: balance calls to ->suspend() and ->resume() Some future PHY drivers will need to do balanced stuff in these methods, like phy_power_off() and phy_power_on(). Currently ->resume() is called twice during initialization, leading to phy_power_off() not actually doing anything during ->suspend() because the refcount in the generic PHY core remains elevated. Signed-off-by: Vladimir Oltean <vladimir.oltean@....com> --- drivers/net/phy/phy_device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 17cb3e07216a..9cb5aa04b2b5 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1882,7 +1882,7 @@ int __phy_resume(struct phy_device *phydev) lockdep_assert_held(&phydev->lock); - if (!phydrv || !phydrv->resume) + if (!phydrv || !phydrv->resume || !phydev->suspended) return 0; ret = phydrv->resume(phydev); @@ -3275,6 +3275,8 @@ static int phy_probe(struct device *dev) if (phydrv->flags & PHY_IS_INTERNAL) phydev->is_internal = true; + phydev->suspended = true; + /* Deassert the reset signal */ phy_device_reset(phydev, 0); -- 2.34.1
Powered by blists - more mailing lists