If defined in OF, set the MAC address. Allows avoiding having to do that in userspace. Signed-off-by: Rosen Penev --- 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 #include +#include #include #include @@ -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