Search Linux Wireless

[PATCH ath-next] wireless: ath5k: set MAC address through OF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If defined in OF, set the MAC address. Allows avoiding having to do that
in userspace.

Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
 drivers/net/wireless/ath/ath5k/base.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 4d88b02ffa79..22ca7e624b32 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -59,6 +59,7 @@
 #include <net/cfg80211.h>
 #include <net/ieee80211_radiotap.h>
 
+#include <linux/of_net.h>
 #include <linux/unaligned.h>
 
 #include <net/mac80211.h>
@@ -2570,6 +2571,19 @@ static const struct ieee80211_iface_combination if_comb = {
 	.num_different_channels = 1,
 };
 
+static int ath5k_of_init(struct ath5k_hw *ah)
+{
+	struct ath_common *common = ath5k_hw_common(ah);
+	struct device_node *np = ah->dev->of_node;
+	int ret;
+
+	ret = of_get_mac_address(np, common->macaddr);
+	if (ret == -EPROBE_DEFER)
+		return ret;
+
+	return 0;
+}
+
 int
 ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
 {
@@ -2638,6 +2652,10 @@ ath5k_init_ah(struct ath5k_hw *ah, const struct ath_bus_ops *bus_ops)
 	common->priv = ah;
 	common->clockrate = 40;
 
+	ret = ath5k_of_init(ah);
+	if (ret)
+		return ret;
+
 	/*
 	 * Cache line size is used to size and align various
 	 * structures used to communicate with the hardware.
-- 
2.50.1





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux