[PATCH net v3 1/2] net: phy: move DECLARE_PHY_INTERFACE_MASK_ZERO to core
Coia Prant
coiaprant at gmail.com
Mon Nov 2 13:25:06 PST 2026
The txgbe driver currently defines DECLARE_PHY_INTERFACE_MASK_ZERO()
locally, but incorrectly uses PHY_INTERFACE_MODE_MAX as the array
length instead of BITS_TO_LONGS().
Move the macro to include/linux/phy.h and use
DECLARE_PHY_INTERFACE_MASK() to properly size the bitmap, while still
zeroing the stack variable.
Fixes: 47f848aac4e7 ("net: txgbe: initialize PHY interface to 0")
Signed-off-by: Coia Prant <coiaprant at gmail.com>
---
drivers/net/ethernet/wangxun/txgbe/txgbe_type.h | 3 ---
include/linux/phy.h | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
index 757d1ce8d3ad..8071464c7b90 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_type.h
@@ -315,9 +315,6 @@ void txgbe_up(struct wx *wx);
int txgbe_setup_tc(struct net_device *dev, u8 tc);
void txgbe_do_reset(struct net_device *netdev, bool reinit);
-#define DECLARE_PHY_INTERFACE_MASK_ZERO(name) \
- unsigned long name[PHY_INTERFACE_MODE_MAX] = { 0, }
-
#define TXGBE_LINK_SPEED_UNKNOWN 0
#define TXGBE_LINK_SPEED_10GB_FULL 4
#define TXGBE_LINK_SPEED_25GB_FULL 0x10
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 21afc2082b17..43aba23109fa 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -159,6 +159,9 @@ typedef enum {
#define DECLARE_PHY_INTERFACE_MASK(name) \
DECLARE_BITMAP(name, PHY_INTERFACE_MODE_MAX)
+#define DECLARE_PHY_INTERFACE_MASK_ZERO(name) \
+ DECLARE_PHY_INTERFACE_MASK(name) = { 0, }
+
static inline void phy_interface_zero(unsigned long *intf)
{
bitmap_zero(intf, PHY_INTERFACE_MODE_MAX);
--
2.47.3
More information about the linux-arm-kernel
mailing list