🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #9106

[PATCH net v4 4/5] net: phy: stop postponing PHY interrupts when a PHY PM callback fails

#9106
From: Igor Velkov via B4 Relay
Date: Sat, 31 Oct 2026 08:01
84 lines
13538 bytes
From: Igor Velkov <iav@iav.lv>

When phy_suspend() fails in mdio_bus_phy_suspend(), irq_suspended
stays set and the state machine stays stopped: the PM core does not
resume a device whose suspend callback failed, and the next PHY
interrupt disables the line until the next resume. When phy_init_hw()
or phy_resume() fail, mdio_bus_phy_resume() returns before the rerun,
with irq_suspended set and a postponed interrupt left disabled.

Undo the postponing and restart the state machine when phy_suspend()
fails, and rerun the postponed interrupt when phy_init_hw() or
phy_resume() fail, which gives the line back to the other users of a
shared line. A handler that then cannot read the PHY reports it through
phy_error(), as most PHY drivers do on any MDIO error.

Fixes: 1758bde2e4aa ("net: phy: Don't trigger state machine while in suspend")
Signed-off-by: Igor Velkov <iav@iav.lv>
---
 drivers/net/phy/phy_device.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index ef5e1cd3a831..390069ec13ca 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -366,6 +366,7 @@ static __maybe_unused void mdio_bus_phy_resume_irq(struct phy_device *phydev)
 static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
 {
 	struct phy_device *phydev = to_phy_device(dev);
+	int ret;
 
 	if (phydev->mac_managed_pm)
 		return 0;
@@ -383,9 +384,20 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev)
 	if (!mdio_bus_phy_may_suspend(phydev))
 		return 0;
 
+	ret = phy_suspend(phydev);
+	if (ret) {
+		/* The PM core skips the resume callback of a device whose
+		 * suspend callback failed.
+		 */
+		mdio_bus_phy_resume_irq(phydev);
+		if (phy_uses_state_machine(phydev))
+			phy_start_machine(phydev);
+		return ret;
+	}
+
 	phydev->suspended_by_mdio_bus = 1;
 
-	return phy_suspend(phydev);
+	return 0;
 }
 
 static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
@@ -411,11 +423,11 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 
 	ret = phy_init_hw(phydev);
 	if (ret < 0)
-		return ret;
+		goto err_resume_irq;
 
 	ret = phy_resume(phydev);
 	if (ret < 0)
-		return ret;
+		goto err_resume_irq;
 no_resume:
 	mdio_bus_phy_resume_irq(phydev);
 
@@ -423,6 +435,10 @@ static __maybe_unused int mdio_bus_phy_resume(struct device *dev)
 		phy_start_machine(phydev);
 
 	return 0;
+
+err_resume_irq:
+	mdio_bus_phy_resume_irq(phydev);
+	return ret;
 }
 
 static SIMPLE_DEV_PM_OPS(mdio_bus_phy_pm_ops, mdio_bus_phy_suspend,

-- 
2.43.0
Technical Details
Message-ID: <20261031-b4-phylib-mac-pm-irq-v3-v4-4-5ba23b3ff9a4@iav.lv>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354049-linux-kernel-netdev=dewy.ru
References: <20261031-b4-phylib-mac-pm-irq-v3-v4-0-5ba23b3ff9a4@iav.lv>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-354049-linux-kernel-netdev=dewy.ru
From: devnull+iav.iav.lv@kernel.org (Igor Velkov via B4 Relay)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v4 4/5] net: phy: stop postponing PHY interrupts when a
 PHY PM callback fails
Date: Sat, 31 Oct 2026 08:01:15 +0000
Organization: Usenet Network
Message-ID: <20261031-b4-phylib-mac-pm-irq-v3-v4-4-5ba23b3ff9a4@iav.lv>
References: <20261031-b4-phylib-mac-pm-irq-v3-v4-0-5ba23b3ff9a4@iav.lv>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2405946"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jfwVLClBS/iilIF3J81wpRs1oNo= sha256:ciPLamCx146pMyRRZZXu70sxCEfqYr84L8pNO8fBRSg=
	sha1:H1Nnvbt2WUtJdPnAvjzvcldhMBs= sha256:ua8JRivcWq7jF6TeY0O56rMLH8Dwp/hcoEdC9wW82b0=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 6065E125CB2; Sat, 31 Oct 2026 11:03:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id g1Q4Gy0n4q3f;
	Sat, 31 Oct 2026 11:02:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-354049-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C1760125CB0; Sat, 31 Oct 2026 11:02:45 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 984EB2B310; Sat, 31 Oct 2026 08:01:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793433686;
	b=eaG9PfIynEJMuTIC8kpnZIv073sLn99NO66pNklrSdVea0HHhmMHCYgzUIcIGlU07IT2
	 3HApaqPJZb6xD947djEHOTES6nq/sJiwX2q0bvEwAC9f9xcpR4wtWlVBLdDlvK8LkfKKr
	 kebLqTL1XGBAmAuG4UCfJVUfkVqiCtahLC/4gpPndocnpRs/heO0Ll3NKvKsKixnk2KBh
	 M56qAEDAzF+v9vLSZxzcpp9RC/s9XOOpxE+UVMNHUreXvjaiM9Wca25s+3SsOngiP9W3H
	 Bj+twB/rH3e2ibNUfoB0kB3SMcsNI+89eLWmmuBSix1lNxUNIxX3h1cI/NXG/YDCpgQ==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793433686;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:From:Date:
	 Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=aXpL5P4gFJ6lTi7GY7hCuH5B2anrQK6TIJlTE6quzOA=;
	b=40uE0UqQLpptjdbb/z1tAzoUS4n3VemFYKFWLDNqeQ0Jjip4pr7ZK+M4If6almc0JVcP
	 FwKfg8lr4re1RfV4gmu3eLW/A9CZItuyBlgpipEzviwd0ZI+5TIpa5HQfszk7+uvtcFP1
	 S24wRzST0nFyEHHZwLISivT60Gxtzw3stOAz404sreL77o86vUxY94KNt3LEqu67Lo7rC
	 OS2ofuMCjCUyToDzLuS0L+FAkfcquKvgB80mu7t4j5q73nD60zTwv0t73BXlVBY5mrdfW
	 2lVbEn1F5pRbn5TiuSK1+8fgf0eRLqzL2DTQzgYpSLb8s9pggHDyfXTXYfXKgYZtgFw==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gEu2eo4R;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BE4A60A2628;
	Sat, 31 Oct 2026 08:01:26 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gEu2eo4R
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793433680;
	b=HowSbyr5KlcWm+CrYvmK7/KOjBslPWaF9K5gjtWVmEpCFTrILNMVemfz5ODzZBjU1QPm
	 F63Aa1nHj8K6UBmDIfTgTXMOF08TX7rJ67pyBYvvPngzb1SvoHo7fpP6pDo9igECBoSW4
	 wrMNv3i62IoyVyaC5dK/BT+Gxa7NFUDRz6+3QcJw4cMAYESpnPQH3ohC4C5U0viSTzVaK
	 kwg10rb3FApihx1ZTBIi9APnSJzBxxr2YCS+INftdx/P0+VHH+lIAG704S49SsZkGtP36
	 22QnsZM87GX6nAFWX/UhPXIAaKALht7ooyApz96NsAAnfwIyQHnHZH1de1+CESd7eEg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793433680;
	h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version:
	 Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=aXpL5P4gFJ6lTi7GY7hCuH5B2anrQK6TIJlTE6quzOA=;
	b=z0mT1TpidDaVhvLzF5kUMTsf9nlQfi24s5DArfug1MwnNLBVDsT4O4UCv4OR3SrpJWw2
	 vogg+rb6vr2gH7+5maYPHf93B+HrxnR9BHbu9CHyv+cO+nUTebkRbOXsuRPLOhoM1QwAt
	 Abx6hKFbbIiHNkGVlAuRUVvvNC6LXtz9a4KscSUxbqRbjcU29t7F2Z1ZvVWXhg4R4im98
	 7lHiRDBSd0pDhDQbsJpxMhxqgOFcQr59s6uueOb1hJ5hTg7lzPJnUddZ3APlNFR79Qq/k
	 iDOslGGRRLjxTr62ZI7b0u9tJ5APmbQaPw8JVsGu1UbZ1llWr13eFkQ5fNLEIHlUXOQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gEu2eo4R;
	arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BEF8606A31F;
	Sat, 31 Oct 2026 08:01:19 +0000 (UTC)
X-Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77
X-ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none;
	t=1793433679;
	b=eIy1VwaP5Q5iXErgip/Tc7cRHHAEeTOuRdJQ/H4/7/go2KCJsdQ267rGlTjNPZnw807T
	 av+6E1cqwVFlM6yRKndeUENkYWmMpfZizTsB9wkdUlhziiAPxi+q4bq1mlCMs+k1F3vOJ
	 UVuMRNiMHa4sWzO+7Fsaub4NACvGY7yEzEz5umi6SWlj7mLFYpsIxEHe5OXhcRM0pgJhB
	 ya2AAmRRpuAkmdfITc1VgOi6zyGJOOSuxqQECw+NyiPVpGLe3NVzWUOtIz92QAW0jQmQV
	 cWQgHUnkk/IWIANAao4p5M34ueB+/GL2X794/N614GaODl2+OMZb858x7nX/5mqfl/g==
X-ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256;
	c=relaxed/relaxed; t=1793433679;
	h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type:
	 Message-Id:References:In-Reply-To:To:Cc:X-Mailer:
	 X-Developer-Signature:X-Developer-Key:X-Endpoint-Received:
	 X-Original-From:Reply-To:Content-Transfer-Encoding;
	bh=aXpL5P4gFJ6lTi7GY7hCuH5B2anrQK6TIJlTE6quzOA=;
	b=aI0Fdl/qZLKNrUNzmQ3wgrGakrvgwGbVU98YbjrExTDf/WChWgFcTOyha4jy/xSImiIp
	 nDIqWnjtY3Vaec47FI24toixxhTH53YoyMIylNeC9Cb20xAAzTIj+w1HoIkq4JqV6Whhu
	 IbwVUtzQ/68upxDtxjD4LescuuXw8i4RyPQngH/EVOTq/UsWSwTxOd90iMVP026V1Fqz0
	 lnTFUg6n+RxUgQgJ/meL3VGrniTncyS+LuVcVr25okJVOFWrLbfmYLRz08+bHDNwDy8Ln
	 oBPX84b3BEtqcQKWGC0pkdFv0DbPtdlAyNRSgnvHS6fYm3kJDDXao5mnoxrBsYDr8cw==
X-ARC-Authentication-Results: i=1; smtp.kernel.org; 
	arc=none smtp.remote-ip=100.80.115.77
X-Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.kernel.org (Postfix) with ESMTPS id 024521F00A15;
	Sat, 31 Oct 2026 08:01:18 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793433679;
	bh=aXpL5P4gFJ6lTi7GY7hCuH5B2anrQK6TIJlTE6quzOA=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To;
	b=gEu2eo4RhkDqtwkhb17Zj3G6gzhrpUcneJUNVHBz8TxibJWRqMKfN20nwVFJgtaz3
	 kJA3MxPG2Drh6RoMiqMeHU/7OWIkwJDt8LP6mRcp1kRsVvEb6PtPo04Un//JLNx3Pu
	 gq+E1XlskMJVHVMItyF75zeTFcgbCjRJVLX9z4vv0TkNPJZn9bGbvQ1TZrbZvUnjw5
	 AtoQENUXbURuyvDQEHe7Tdta7Z1f1RxD8pCaFbuj2optIVaQeK/veeOQzq9cxNM25D
	 7nV8RpxAlcYmoBhJ9t8gMpBhP+TyOzS0fh+FCbEG4qopYStP6kfhwXa/ph2p8sfvaw
	 XIj2DZPUS6Log==
X-Received: from nexus.subspace.kernel.org (localhost [IPv6:::1])
	by lkml.kernel.org (Postfix) with ESMTP id 7DAF545E56;
	Sat, 31 Oct 2026 08:01:17 +0000 (UTC)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261031-b4-phylib-mac-pm-irq-v3-v4-0-5ba23b3ff9a4@iav.lv>
X-Cc: Maxime Chevallier <maxime.chevallier@bootlin.com>, 
 Lukas Wunner <lukas@wunner.de>, 
 "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>, 
 Wei Fang <wei.fang@nxp.com>, 
 Niklas Söderlund <niklas.soderlund@ragnatech.se>, 
 Paul Barker <paul@pbarker.dev>, 
 Florian Fainelli <florian.fainelli@broadcom.com>, 
 Doug Berger <opendmb@gmail.com>, 
 Thangaraj Samynathan <Thangaraj.S@microchip.com>, 
 Shenwei Wang <shenwei.wang@nxp.com>, netdev@vger.kernel.org, 
 linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, 
 linux-kernel@vger.kernel.org, Igor Velkov <iav@iav.lv>
X-Mailer: b4 0.13.0
X-Developer-Signature: v=1; a=openpgp-sha256; l=2660; i=iav@iav.lv;
 h=from:subject:message-id;
 bh=AMBusW+D9sd+roS3h8dA/iGRRagd/TAxSjS7ZWRcGGw=;
 b=owGbwMvMwCVmNH1q96v4SmbG02pJDFlPF3irMb5Zbvn0dEa+JufUGSYN4e9/vE1/Kbyjonnyy
 rRMh81vOkpZGMS4GGTFFFkmHNK4lbHk6l9/D/MHMHNYmUCGMHBxCsBE1kxk+KdTfeHms7wHzzve
 nNXjFgqJuPnYU363yKwDB5PvhAtE9tgwMryc4fMlQq/LfOtNw5/V33aeuK7+wS1tP3PkBvaqmWc
 XX+YFAA==
X-Developer-Key: i=iav@iav.lv; a=openpgp;
 fpr=90C228DA68A4D5FD4F4837E03297958BEA5F7903
X-Endpoint-Received: by B4 Relay for iav@iav.lv/default with auth_id=1060
X-Original-From: Igor Velkov <iav@iav.lv>
X-Reply-To: iav@iav.lv