wifi: ath11k: switch to of_get_mac_address
PATCH 1/1 wifi: ath11k: switch to of_get_mac_address
This is needed to support nvmem defined MAC addresses in DTS.
In addition, check if the probe should be deferred as nvmem can load after ath11k.
For brevity, ACPI is not a factor here. ath11k is too new for that.
--- drivers/net/wireless/ath/ath11k/mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/mac.c +4 -1
@@ -9,6 +9,7 @@#include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> +#include <linux/of_net.h> #include <net/if_inet6.h> #include <net/ipv6.h>
@@ -10434,7 +10435,9 @@ int ath11k_mac_register(struct ath11k_base *ab)if (ret)return ret; -device_get_mac_address (ab->dev, mac_addr); + ret =of_get_mac_address (ab->dev->of_node, mac_addr); +if (ret == -EPROBE_DEFER ) +return ret;for (i =0 ; i < ab->num_radios; i++) { pdev = &ab->pdevs[i];
Signature · 1 line
2.50.1
Quoted 6 lines · Rosen Penev
This is needed to support nvmem defined MAC addresses in DTS.
In addition, check if the probe should be deferred as nvmem can load after ath11k.
For brevity, ACPI is not a factor here. ath11k is too new for that.
This may not be accurate, pcie devices are widely used on x86 where ACPI is not certainly new.
Quoted 19 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/wireless/ath/ath11k/mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9,6 +9,7 @@#include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> +#include <linux/of_net.h> #include <net/if_inet6.h> #include <net/ipv6.h>
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10438
Quoted 5 lines
drivers/net/wireless/ath/ath11k/mac.c +1
-1@@ -10434,7 +10435,9 @@ int ath11k_mac_register(struct ath11k_base *ab)if (ret)return ret; -device_get_mac_address (ab->dev, mac_addr); + ret =of_get_mac_address (ab->dev->of_node, mac_addr);
I still think it is better to keep the generic API and add the the one specific to nvmem when the generic one fails.
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10440
Quoted 2 lines
drivers/net/wireless/ath/ath11k/mac.c +2
-0+if (ret == -EPROBE_DEFER ) +return ret;
Please note that this error does not impact the device probe as this is being done in the event path after probe returns withis complete. Also, this will result in device registration failure even when the device is not really looking for mac_addr from nvmem (or it is not there) as firmware can also provide the mac_addr from the hardware.
Vasanth
Quoted 6 lines · Vasanthakumar Thiagarajan
Quoted 2 lines · Rosen Penev
This is needed to support nvmem defined MAC addresses in DTS.
Quoted 7 lines
Quoted 4 lines
In addition, check if the probe should be deferred as nvmem can load after ath11k.
For brevity, ACPI is not a factor here. ath11k is too new for that.
This may not be accurate, pcie devices are widely used on x86 where ACPI is not certainly new.
No way ACPI is used to define MAC addresses.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/wireless/ath/ath11k/mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9,6 +9,7 @@#include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> +#include <linux/of_net.h> #include <net/if_inet6.h> #include <net/ipv6.h> @@ -10434,7 +10435,9 @@ int ath11k_mac_register(struct ath11k_base *ab)if (ret)return ret;
Quoted 5 lines
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10438
Quoted 2 lines
drivers/net/wireless/ath/ath11k/mac.c +1
-1-device_get_mac_address (ab->dev, mac_addr); + ret =of_get_mac_address (ab->dev->of_node, mac_addr);I still think it is better to keep the generic API and add the the one specific to nvmem when the generic one fails.
I don't. ath10k and ath11k are the only modern drivers using device_get_mac_address
Quoted 9 lines
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10440
Quoted 3 lines
drivers/net/wireless/ath/ath11k/mac.c +2
-0+if (ret == -EPROBE_DEFER ) +return ret;Please note that this error does not impact the device probe as this is being done in the event path after probe returns withis complete. Also, this will result in device registration failure even when the device is not really looking for
mac_addrfrom nvmem (or it is not there) as firmware can also provide themac_addrfrom the hardware.
Does probe not handle EPROBE_DEFER?
Quoted 2 lines
Vasanth
Quoted 50 lines · Rosen Penev
Quoted 6 lines · Vasanthakumar Thiagarajan
Quoted 2 lines · Rosen Penev
This is needed to support nvmem defined MAC addresses in DTS.
Quoted 7 lines
Quoted 4 lines
In addition, check if the probe should be deferred as nvmem can load after ath11k.
For brevity, ACPI is not a factor here. ath11k is too new for that.
This may not be accurate, pcie devices are widely used on x86 where ACPI is not certainly new.
No way ACPI is used to define MAC addresses.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/wireless/ath/ath11k/mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9,6 +9,7 @@#include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> +#include <linux/of_net.h> #include <net/if_inet6.h> #include <net/ipv6.h> @@ -10434,7 +10435,9 @@ int ath11k_mac_register(struct ath11k_base *ab)if (ret)return ret;Quoted 5 lines
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10438
Quoted 2 lines
drivers/net/wireless/ath/ath11k/mac.c +1
-1-device_get_mac_address (ab->dev, mac_addr); + ret =of_get_mac_address (ab->dev->of_node, mac_addr);I still think it is better to keep the generic API and add the the one specific to nvmem when the generic one fails.
I don't. ath10k and ath11k are the only modern drivers using
device_get_mac_addressQuoted 4 lines
Quoted 3 lines
drivers/net/wireless/ath/ath11k/mac.c +2
-0+if (ret == -EPROBE_DEFER ) +return ret;
Quoted 7 lines
Quoted 5 lines
Please note that this error does not impact the device probe as this is being done in the event path after probe returns withis complete. Also, this will result in device registration failure even when the device is not really looking for
mac_addrfrom nvmem (or it is not there) as firmware can also provide themac_addrfrom the hardware.Does probe not handle
EPROBE_DEFER?
right
Quoted 60 lines · Vasanthakumar Thiagarajan
Quoted 56 lines · Rosen Penev
Quoted 6 lines · Vasanthakumar Thiagarajan
Quoted 2 lines · Rosen Penev
This is needed to support nvmem defined MAC addresses in DTS.
Quoted 7 lines
Quoted 4 lines
In addition, check if the probe should be deferred as nvmem can load after ath11k.
For brevity, ACPI is not a factor here. ath11k is too new for that.
This may not be accurate, pcie devices are widely used on x86 where ACPI is not certainly new.
No way ACPI is used to define MAC addresses.
Quoted 23 lines
Quoted 23 lines
Signed-off-by Rosen Penev <[email protected]>--- drivers/net/wireless/ath/ath11k/mac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/wireless/ath/ath11k/mac.c +1
-0@@ -9,6 +9,7 @@#include <linux/etherdevice.h> #include <linux/bitfield.h> #include <linux/inetdevice.h> +#include <linux/of_net.h> #include <net/if_inet6.h> #include <net/ipv6.h> @@ -10434,7 +10435,9 @@ int ath11k_mac_register(struct ath11k_base *ab)if (ret)return ret;Quoted 5 lines
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10438
Quoted 2 lines
drivers/net/wireless/ath/ath11k/mac.c +1
-1-device_get_mac_address (ab->dev, mac_addr); + ret =of_get_mac_address (ab->dev->of_node, mac_addr);I still think it is better to keep the generic API and add the the one specific to nvmem when the generic one fails.
I don't. ath10k and ath11k are the only modern drivers using
device_get_mac_addressQuoted 9 lines
drivers/net/wireless/ath/ath11k/mac.c int ath11k_mac_register(struct ath11k_base *ab) · line 10440
Quoted 3 lines
drivers/net/wireless/ath/ath11k/mac.c +2
-0+if (ret == -EPROBE_DEFER ) +return ret;Please note that this error does not impact the device probe as this is being done in the event path after probe returns withis complete. Also, this will result in device registration failure even when the device is not really looking for
mac_addrfrom nvmem (or it is not there) as firmware can also provide themac_addrfrom the hardware.
Quoted 3 lines
Quoted 1 line
Does probe not handle
EPROBE_DEFER?right
I looked further into this. The function ends up being called in _probe as ath11k_core_init , which doesn't seem to pass the return code of of_get_mac_address as it currently stands. Unfortunate.