[PATCH 6.12 085/113] net: phy: add phy_interface_weight()

Greg Kroah-Hartman
2026-02-09T14:39:40Z

From: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

[ Upstream commit 4beb44a2d62dddfe450f310aa1a950901731cb3a ]

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/E1uslwn-00000001SOx-0a7H@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: adcbadfd8e05 ("net: sfp: Fix quirk for Ubiquiti U-Fiber Instant SFP module")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/phy.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/phy.h b/include/linux/phy.h
index dfc7b97f9648d..6fe5d564beed4 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -187,6 +187,11 @@ static inline bool phy_interface_empty(const unsigned long *intf)
return bitmap_empty(intf, PHY_INTERFACE_MODE_MAX);
}

+static inline unsigned int phy_interface_weight(const unsigned long *intf)
+{
+ return bitmap_weight(intf, PHY_INTERFACE_MODE_MAX);
+}
+
static inline void phy_interface_and(unsigned long *dst, const unsigned long *a,
const unsigned long *b)
{
--
2.51.0