407-ath9k-override-mac-address-from-platform-data.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --- a/include/linux/ath9k_platform.h
  2. +++ b/include/linux/ath9k_platform.h
  3. @@ -23,6 +23,7 @@
  4. struct ath9k_platform_data {
  5. u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
  6. + u8 *macaddr;
  7. };
  8. #endif /* _LINUX_ATH9K_PLATFORM_H */
  9. --- a/drivers/net/wireless/ath/ath9k/init.c
  10. +++ b/drivers/net/wireless/ath/ath9k/init.c
  11. @@ -15,6 +15,7 @@
  12. */
  13. #include <linux/slab.h>
  14. +#include <linux/ath9k_platform.h>
  15. #include "ath9k.h"
  16. @@ -526,6 +527,7 @@ static void ath9k_init_misc(struct ath_s
  17. static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
  18. const struct ath_bus_ops *bus_ops)
  19. {
  20. + struct ath9k_platform_data *pdata = sc->dev->platform_data;
  21. struct ath_hw *ah = NULL;
  22. struct ath_common *common;
  23. int ret = 0, i;
  24. @@ -539,7 +541,7 @@ static int ath9k_init_softc(u16 devid, s
  25. ah->hw_version.subsysid = subsysid;
  26. sc->sc_ah = ah;
  27. - if (!sc->dev->platform_data)
  28. + if (!pdata)
  29. ah->ah_flags |= AH_USE_EEPROM;
  30. common = ath9k_hw_common(ah);
  31. @@ -572,6 +574,9 @@ static int ath9k_init_softc(u16 devid, s
  32. if (ret)
  33. goto err_hw;
  34. + if (pdata && pdata->macaddr)
  35. + memcpy(common->macaddr, pdata->macaddr, ETH_ALEN);
  36. +
  37. ret = ath9k_init_queues(sc);
  38. if (ret)
  39. goto err_queues;