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