[PATCH net-next v18 3/6] net: dsa: motorcomm: use GENMASK_U32() for mbus phy_mask

From: Kyle Switch

Date: Wed Dec 02 2026 - 03:41:19 EST


mbus->phy_mask is a u32, but the mask was built with GENMASK(), which
has type unsigned long, requiring an explicit (u32) cast to avoid a
truncation warning.

Use GENMASK_U32() instead, which yields a u32 and makes the intended
32-bit width explicit. The cast can then be dropped. GENMASK_U32()
also lets the compiler reject out-of-range masks at build time.

No functional change.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Signed-off-by: Kyle Switch <kyle.switch@xxxxxxxxxxxxxx>
---
drivers/net/dsa/motorcomm/mdio_bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c
index a06e2cc94a3e..94087c9962cc 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.c
+++ b/drivers/net/dsa/motorcomm/mdio_bus.c
@@ -173,7 +173,7 @@ int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp)
dev_err(dev, "Invalid max_ports: %u\n", max_ports);
return -EINVAL;
}
- mbus->phy_mask = (u32)~GENMASK(max_ports - 1, 0);
+ mbus->phy_mask = ~GENMASK_U32(max_ports - 1, 0);

res = of_mdiobus_register(mbus, mnp);
if (res) {
--
2.25.1