net: dsa: qca8k: fix led devicename when using external mdio bus
PATCH v3 1/1 net: dsa: qca8k: fix led devicename when using external mdio bus
The qca8k dsa switch can use either an external or internal mdio bus. This depends on whether the mdio node is defined under the switch node itself. Upon registering the internal mdio bus, the internal_mdio_bus of the dsa switch is assigned to this bus. When an external mdio bus is used, the driver still uses the internal_mdio_bus id which is used to create the device names of the leds.
This leads to the leds being prefixed with '(efault)' as the internal_mii_bus is null. So let's fix this by adding a null check and use the devicename of the external bus instead when an external bus is configured.
---
Resending this patch as v3 with an updated commit message. There was a discussion on removing the notion of having an external and internal bus which was never followed up on, yet the issue is still there.
Changed in v3:
- Rebased on top of tree
- Updated commit message to reflect renaming of slave_mii_bus to internal_mdio_bus
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Fixed c/p error from older kernel version: slave_mii_bus was renamed
to internal_mdio_bus
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/net/dsa/qca/qca8k-leds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/qca/qca8k-leds.c +2 -1
@@ -429,7 +429,8 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p init_data.fwnode = led; init_data.devname_mandatory = true; init_data.devicename =kasprintf (GFP_KERNEL ,"%s:0%d" , - priv->internal_mdio_bus->id, + priv->internal_mdio_bus ? + priv->internal_mdio_bus->id : priv->bus->id, port_num);if (!init_data.devicename) {fwnode_handle_put (led);
---
base-commit: 6e845bcb78c95af935094040bd4edc3c2b6dd784
change-id: 20260608-qca8k-leds-fix-e8b4d8feb47b
Best regards,
Signature · 1 line
George Moussalem <[email protected]>
Paolo Abeni
maintainerQuoted 40 lines · On 6/8/26 9:22 AM, George Moussalem via B4 Relay wrote:
From: George Moussalem <[email protected]>
The qca8k dsa switch can use either an external or internal mdio bus. This depends on whether the mdio node is defined under the switch node itself. Upon registering the internal mdio bus, the
internal_mdio_busof the dsa switch is assigned to this bus. When an external mdio bus is used, the driver still uses theinternal_mdio_busid which is used to create the device names of the leds.
This leads to the leds being prefixed with '(efault)' as theinternal_mii_busis null. So let's fix this by adding a null check and use the devicename of the external bus instead when an external bus is configured.Fixes 1e264f9d2918 ("net: dsa: qca8k: add LEDs basic support")Signed-off-by George Moussalem <[email protected]>---
Resending this patch as v3 with an updated commit message. There was a discussion on removing the notion of having an external and internal bus which was never followed up on, yet the issue is still there.Changed in v3:
- Rebased on top of tree
- Updated commit message to reflect renaming ofslave_mii_bustointernal_mdio_bus
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Fixed c/p error from older kernel version:slave_mii_buswas renamed
tointernal_mdio_bus
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/net/dsa/qca/qca8k-leds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/net/dsa/qca/qca8k-leds.c +0
-0
drivers/net/dsa/qca/qca8k-leds.c qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p · line 436
Quoted 9 lines
drivers/net/dsa/qca/qca8k-leds.c +2
-1@@ -429,7 +429,8 @@ qca8k_parse_port_leds(struct qca8k_priv *priv, struct fwnode_handle *port, int p init_data.fwnode = led; init_data.devname_mandatory = true; init_data.devicename =kasprintf (GFP_KERNEL ,"%s:0%d" , - priv->internal_mdio_bus->id, + priv->internal_mdio_bus ? + priv->internal_mdio_bus->id : priv->bus->id, port_num);if (!init_data.devicename) {fwnode_handle_put (led);
@Andrew: are you ok with this? I *think* you may still have the same concern WRT the previous iteration.
/P
Quoted 13 lines · On Mon, Jun 08, 2026 at 11:22:08AM +0400, George Moussalem via B4 Relay wrote:
From: George Moussalem <[email protected]>
The qca8k dsa switch can use either an external or internal mdio bus. This depends on whether the mdio node is defined under the switch node itself. Upon registering the internal mdio bus, the
internal_mdio_busof the dsa switch is assigned to this bus. When an external mdio bus is used, the driver still uses theinternal_mdio_busid which is used to create the device names of the leds.
This leads to the leds being prefixed with '(efault)' as theinternal_mii_busis null. So let's fix this by adding a null check and use the devicename of the external bus instead when an external bus is configured.
Quoted 2 lines
Fixes 1e264f9d2918 ("net: dsa: qca8k: add LEDs basic support")Signed-off-by George Moussalem <[email protected]>
Andrew
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 13 lines · On Mon, 08 Jun 2026 11:22:08 +0400 you wrote:
From: George Moussalem <[email protected]>
The qca8k dsa switch can use either an external or internal mdio bus. This depends on whether the mdio node is defined under the switch node itself. Upon registering the internal mdio bus, the
internal_mdio_busof the dsa switch is assigned to this bus. When an external mdio bus is used, the driver still uses theinternal_mdio_busid which is used to create the device names of the leds.
This leads to the leds being prefixed with '(efault)' as theinternal_mii_busis null. So let's fix this by adding a null check and use the devicename of the external bus instead when an external bus is configured.
Quoted 1 line
[...]
Here is the summary with links:
- [v3] net: dsa: qca8k: fix led devicename when using external mdio bus
https://git.kernel.org/netdev/net/c/0b7b378ce6ca
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html