[openwrt/openwrt] net: dsa: qca8k: fix led devicename when using external mdio bus

LEDE Commits lede-commits at lists.infradead.org
Fri Jun 13 03:02:47 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/a23f8412894db465f1b5d5176f88c6f7d8120bce

commit a23f8412894db465f1b5d5176f88c6f7d8120bce
Author: George Moussalem <george.moussalem at outlook.com>
AuthorDate: Fri Apr 25 11:07:55 2025 +0400

    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 and, as such, the internal_mdio_mask is populated with its
    internal phys. 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, it is left unassigned, though its id
    is used to create the device names of the leds.
    This leads to the leds being named '(efault):00:green:lan' and so on as
    the internal_mdio_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.
    
    Signed-off-by: George Moussalem <george.moussalem at outlook.com>
    Link: https://github.com/openwrt/openwrt/pull/19004
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 ...d-devicename-when-using-external-mdio-bus.patch | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/target/linux/qualcommax/patches-6.12/0753-net-dsa-qca8k-fix-led-devicename-when-using-external-mdio-bus.patch b/target/linux/qualcommax/patches-6.12/0753-net-dsa-qca8k-fix-led-devicename-when-using-external-mdio-bus.patch
new file mode 100644
index 0000000000..bfa213e009
--- /dev/null
+++ b/target/linux/qualcommax/patches-6.12/0753-net-dsa-qca8k-fix-led-devicename-when-using-external-mdio-bus.patch
@@ -0,0 +1,34 @@
+From ec0031908d3abb24e791af2d5be9f3b0e265c945 Mon Sep 17 00:00:00 2001
+From: George Moussalem <george.moussalem at outlook.com>
+Date: Fri, 25 Apr 2025 10:51:28 +0400
+Subject: [PATCH] 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 and, as such, the internal_mdio_mask is populated with its
+internal phys. Upon registering the internal mdio bus, the slave_mii_bus
+of the dsa switch is assigned to this bus. When an external mdio bus is
+used, it is left unassigned, though its id is used to create the device
+names of the leds.
+This leads to the leds being named '(efault):00:green:lan' and so on as
+the slave_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.
+
+Signed-off-by: George Moussalem <george.moussalem at outlook.com>
+---
+ drivers/net/dsa/qca/qca8k-leds.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/dsa/qca/qca8k-leds.c
++++ b/drivers/net/dsa/qca/qca8k-leds.c
+@@ -429,7 +429,8 @@ qca8k_parse_port_leds(struct qca8k_priv
+ 		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);




More information about the lede-commits mailing list