From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3786B23F417 for ; Mon, 14 Jul 2025 09:52:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752486773; cv=none; b=VFM1sZ5nbijgKFEYpl4QeZW6MW6+KcyXKXFeeS+dERj+hXPx7JqVyNasDZJiGW6lPPzDxWTdM3ws/chZVP6xuov286VZBV6XQesLtuK82Alat8kyYONGnQbDxHZPGYP9Fe65G2ztotqFhCMxW9HW5CUuIbnCaNmAew+ZmkO6oVU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752486773; c=relaxed/simple; bh=z7zcbjKhSKUviabBl30iOgZwAH/q4ejRejd08eNu8KQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r6uyfw8tu9Zo8VSo0sCvlFMYX8tS4OZVC9cDPz61CREylcSfGWbWNcCLRS4zJCOGa2VdW0Mf83B9kY4WUmwjPAjPt6smj4Q6e+HxRVLYF/qFoFHrgZbmLa5IYJtO9eEjjWqm4yE0V0OdEZbENHEr/LRk+6p0w3VD5lBiWDYyzRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ubFrX-0006Hq-1I; Mon, 14 Jul 2025 11:52:43 +0200 Received: from dude04.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::ac]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1ubFrV-008OKW-24; Mon, 14 Jul 2025 11:52:41 +0200 Received: from ore by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1ubFrV-00BmI6-1r; Mon, 14 Jul 2025 11:52:41 +0200 From: Oleksij Rempel To: Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Oleksij Rempel , kernel@pengutronix.de, linux-kernel@vger.kernel.org, Russell King , netdev@vger.kernel.org, Andre Edich , Lukas Wunner Subject: [PATCH net v4 1/3] net: phy: enable polling when driver implements get_next_update_time Date: Mon, 14 Jul 2025 11:52:38 +0200 Message-Id: <20250714095240.2807202-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250714095240.2807202-1-o.rempel@pengutronix.de> References: <20250714095240.2807202-1-o.rempel@pengutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Currently, phy_polling_mode() enables polling only if: - the PHY is in interrupt-less mode, or - the driver provides an update_stats() callback. This excludes drivers that implement get_next_update_time() to support adaptive polling but do not provide update_stats(). As a result, the state machine timer will not run, and the get_next_update_time() callback is never used. This patch extends the polling condition to include drivers that implement get_next_update_time(). This change is required to support adaptive polling in the SMSC LAN9512/LAN8700 PHY family, which cannot reliably use interrupts. No in-tree drivers rely on this mechanism yet, so existing behavior is unchanged. If any out-of-tree driver incorrectly implements get_next_update_time(), enabling polling is still the correct behavior. Fixes: 8bf47e4d7b87 ("net: phy: Add support for driver-specific next update time") Signed-off-by: Oleksij Rempel Reviewed-by: Andrew Lunn --- changes v2: - update commit message --- include/linux/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/phy.h b/include/linux/phy.h index 4c2b8b6e7187..2688c0435b9b 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1636,7 +1636,7 @@ static inline bool phy_polling_mode(struct phy_device *phydev) if (phydev->drv->flags & PHY_POLL_CABLE_TEST) return true; - if (phydev->drv->update_stats) + if (phydev->drv->update_stats || phydev->drv->get_next_update_time) return true; return phydev->irq == PHY_POLL; -- 2.39.5