603-rt2x00-of_load_eeprom_filename.patch 748 B

12345678910111213141516171819202122232425262728293031
  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,10 +35,20 @@ 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. +#ifdef CONFIG_OF
  20. + np = rt2x00dev->dev->of_node;
  21. + if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0)
  22. + return eep;
  23. +#endif
  24. +
  25. return NULL;
  26. }