Skip to contentSkip to conversation

wifi: ath10k: switch to of_get_mac_address

PATCH In review Rosen Penev 2 participants 3 messages Aug 9, 2025 – Aug 11, 2025 Qualcomm Atheros ATH10K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: ath10k: switch to of_get_mac_address

In 9d5804662ce1f9bdde0a14c3c40940acbbf09538 , device_get_mac_address was introduced as a generic way to get MAC addresses from anywhere. Unfortunately since then, the landscape has changed and the OF version is required for NVMEM support. The second problem is that with NVMEM it's possible that it loads after ath10k. For that reason, check for deferred errors and exit out of probe in such a case.

---
 drivers/net/wireless/ath/ath10k/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/core.c +4 -1
index 6f78f1752cd6..76747eb0925b 100644
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/firmware.h>
 #include <linux/of.h>
+#include <linux/of_net.h>
 #include <linux/property.h>
 #include <linux/dmi.h>
 #include <linux/ctype.h>
@@ -3456,7 +3457,9 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 		ath10k_debug_print_board_info(ar);
 	}
 
-	device_get_mac_address(ar->dev, ar->mac_addr);
+	ret = of_get_mac_address(ar->dev->of_node, ar->mac_addr);
+	if (ret == -EPROBE_DEFER)
+		goto err_free_firmware_files;
 
 	ret = ath10k_core_init_firmware_features(ar);
 	if (ret) {
Signature · 1 line
2.50.1
#1 lore raw
Quoted 1 line · Rosen Penev

In 9d5804662ce1f9bdde0a14c3c40940acbbf09538 , device_get_mac_address was

see
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

specifically: If you want to refer to a specific commit, don’t just refer to the SHA-1 ID of the commit. Please also include the oneline summary of the commit, to make it easier for reviewers to know what it is about.

So in this case:
9d5804662ce1 ("ath10k: retrieve MAC address from system firmware if provided")

Quoted 2 lines

introduced as a generic way to get MAC addresses from anywhere. Unfortunately since then, the landscape has changed and the OF version

when did the landscape change? if using device_get_mac_address() is breaking folks, it would be nice to know which versions of the kernel have the bad behavior so that the patch can be backported to any broken LTS kernels.

Quoted 22 lines

is required for NVMEM support. The second problem is that with NVMEM it's possible that it loads after ath10k. For that reason, check for deferred errors and exit out of probe in such a case.

---
 drivers/net/wireless/ath/ath10k/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/core.c +1 -0
index 6f78f1752cd6..76747eb0925b 100644
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/firmware.h>
 #include <linux/of.h>
+#include <linux/of_net.h>
 #include <linux/property.h>
 #include <linux/dmi.h>
 #include <linux/ctype.h>

drivers/net/wireless/ath/ath10k/core.c static int ath10k_core_probe_fw(struct ath10k *ar) · line 3462

Quoted 7 lines
drivers/net/wireless/ath/ath10k/core.c +3 -1
@@ -3456,7 +3457,9 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
 		ath10k_debug_print_board_info(ar);
 	}
 
-	device_get_mac_address(ar->dev, ar->mac_addr);
+	ret = of_get_mac_address(ar->dev->of_node, ar->mac_addr);
+	if (ret == -EPROBE_DEFER)
+		goto err_free_firmware_files;

Note a similar proposal for ath11k was deferred since it seems to break x86 attachment when there isn't a device tree node:
https://msgid.link/[email protected]

I'd have the same concerns here.
(but I didn't dig into how the fwnode items are set if there isn't a DT)

Quoted 3 lines
drivers/net/wireless/ath/ath10k/core.c +0 -0
 	ret = ath10k_core_init_firmware_features(ar);
 	if (ret) {
#2 lore raw
Quoted 46 lines · Jeff Johnson
Quoted 1 line · Rosen Penev

In 9d5804662ce1f9bdde0a14c3c40940acbbf09538 , device_get_mac_address was

see
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#describe-your-changes

specifically: If you want to refer to a specific commit, don’t just refer to the SHA-1 ID of the commit. Please also include the oneline summary of the commit, to make it easier for reviewers to know what it is about.

So in this case:
9d5804662ce1 ("ath10k: retrieve MAC address from system firmware if provided")

Quoted 2 lines

introduced as a generic way to get MAC addresses from anywhere. Unfortunately since then, the landscape has changed and the OF version

when did the landscape change? if using device_get_mac_address() is breaking folks, it would be nice to know which versions of the kernel have the bad behavior so that the patch can be backported to any broken LTS kernels.

Quoted 25 lines

is required for NVMEM support. The second problem is that with NVMEM it's possible that it loads after ath10k. For that reason, check for deferred errors and exit out of probe in such a case.

---
 drivers/net/wireless/ath/ath10k/core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/core.c +1 -0
index 6f78f1752cd6..76747eb0925b 100644
@@ -11,6 +11,7 @@
 #include <linux/module.h>
 #include <linux/firmware.h>
 #include <linux/of.h>
+#include <linux/of_net.h>
 #include <linux/property.h>
 #include <linux/dmi.h>
 #include <linux/ctype.h>
@@ -3456,7 +3457,9 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
              ath10k_debug_print_board_info(ar);
      }
 
Quoted 8 lines

drivers/net/wireless/ath/ath10k/core.c static int ath10k_core_probe_fw(struct ath10k *ar) · line 3462

Quoted 4 lines
drivers/net/wireless/ath/ath10k/core.c +3 -1
-     device_get_mac_address(ar->dev, ar->mac_addr);
+     ret = of_get_mac_address(ar->dev->of_node, ar->mac_addr);
+     if (ret == -EPROBE_DEFER)
+             goto err_free_firmware_files;

Note a similar proposal for ath11k was deferred since it seems to break x86 attachment when there isn't a device tree node:
https://msgid.link/[email protected]

In response to this, I'll change this patch to only add NVMEM support

Quoted 3 lines

I'd have the same concerns here.
(but I didn't dig into how the fwnode items are set if there isn't a DT)

I have no idea either. I assume for pcie cards the MAC is set from the EEPROM.

Quoted 5 lines
Quoted 4 lines
drivers/net/wireless/ath/ath10k/core.c +0 -0
      ret = ath10k_core_init_firmware_features(ar);
      if (ret) {