Re: [PATCH net-next v4 1/2] net: phy: move DECLARE_PHY_INTERFACE_MASK_ZERO to core

From
Coia Prant <coiaprant@gmail.com>
Date
2026-11-17 06:24:10
Also in
linux-arm-kernel, linux-rockchip, lkml
Reply to
Jakub Kicinski, 2026-11-17
Jakub Kicinski [off-list ref] 于2026年11月17日周二 10:30写道:
On Wed, 11 Nov 2026 00:05:53 +0800 Coia Prant wrote:
quoted
--- 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, }
I wonder who suggested this, hiding the init inside the macro seems
a bit subjective. I see no such defines today. We'll need an Andrew
ack for sure.

Please try to add lore links to previous versions of the patchset
in the cover letter.
Hi Jakub,

Thanks for the review.

The macro was originally introduced locally in the Wangxun (txgbe)
driver (commit 47f848aac4e7) to handle the uninitialized stack variable.
However, their local version incorrectly uses PHY_INTERFACE_MODE_MAX as
the array length instead of BITS_TO_LONGS(), which allocates far more
stack space than necessary.

I was just trying to fix that bug and move it to the core header so
both txgbe and XPCS can use a properly sized, zero-initialized bitmap.

I understand your concern that hiding the init inside the macro seems
subjective. Since you mentioned an Andrew ack is needed, and he is the
net PHY maintainer (who also looks after the WX driver), I'll keep it
as-is for now so he can review it in context.

If Andrew also feels this doesn't belong in the core, I will drop the
macro entirely and switch to explicit manual initialization using
phy_interface_zero() in both drivers.

I'll also make sure to add the lore links to the cover letter in the
next version.


Coia
Thread (7 messages) 7 messages, 4 authors, last reply 2h ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help