604-rt2x00-of_load_eeprom_filename.patch 834 B

123456789101112131415161718192021222324252627282930313233
  1. --- a/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  2. +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00eeprom.c
  3. @@ -26,6 +26,7 @@
  4. #include <linux/kernel.h>
  5. #include <linux/module.h>
  6. +#include <linux/of.h>
  7. #include "rt2x00.h"
  8. #include "rt2x00lib.h"
  9. @@ -34,11 +35,21 @@ static const char *
  10. rt2x00lib_get_eeprom_file_name(struct rt2x00_dev *rt2x00dev)
  11. {
  12. struct rt2x00_platform_data *pdata = rt2x00dev->dev->platform_data;
  13. +#ifdef CONFIG_OF
  14. + struct device_node *np;
  15. + const char *eep;
  16. +#endif
  17. if (pdata && pdata->eeprom_file_name)
  18. return pdata->eeprom_file_name;
  19. - return NULL
  20. +#ifdef CONFIG_OF
  21. + np = rt2x00dev->dev->of_node;
  22. + if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0)
  23. + return eep;
  24. +#endif
  25. +
  26. + return NULL;
  27. }
  28. static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)