ath9k: rework the mac address override patch to not break ath9k_htc
[oweals/openwrt.git] / package / mac80211 / patches / 407-ath9k-override-mac-address-from-platform-data.patch
1 --- a/include/linux/ath9k_platform.h
2 +++ b/include/linux/ath9k_platform.h
3 @@ -23,6 +23,7 @@
4  
5  struct ath9k_platform_data {
6         u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
7 +       u8 *macaddr;
8  };
9  
10  #endif /* _LINUX_ATH9K_PLATFORM_H */
11 --- a/drivers/net/wireless/ath/ath9k/init.c
12 +++ b/drivers/net/wireless/ath/ath9k/init.c
13 @@ -16,6 +16,7 @@
14  
15  #include <linux/slab.h>
16  #include <linux/pm_qos_params.h>
17 +#include <linux/ath9k_platform.h>
18  
19  #include "ath9k.h"
20  
21 @@ -520,6 +521,7 @@ static void ath9k_init_misc(struct ath_s
22  static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
23                             const struct ath_bus_ops *bus_ops)
24  {
25 +       struct ath9k_platform_data *pdata = sc->dev->platform_data;
26         struct ath_hw *ah = NULL;
27         struct ath_common *common;
28         int ret = 0, i;
29 @@ -565,6 +567,9 @@ static int ath9k_init_softc(u16 devid, s
30         if (ret)
31                 goto err_hw;
32  
33 +       if (pdata && pdata->macaddr)
34 +               memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
35 +
36         ret = ath9k_init_debug(ah);
37         if (ret) {
38                 ath_print(common, ATH_DBG_FATAL,