666bc2dc55adf0594d72791ec73f9676b6a15374
[openwrt/staging/hauke.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,19 @@ 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 + struct device_node *np;
16 + char *eep;
17
18 if (pdata && pdata->eeprom_file_name)
19 return pdata->eeprom_file_name;
20
21 - return NULL
22 +#ifdef CONFIG_OF
23 + np = rt2x00dev->dev->of_node;
24 + if (np && of_property_read_string(np, "ralink,eeprom", &eep) == 0)
25 + return eep;
26 +#endif
27 +
28 + return NULL;
29 }
30
31 static int rt2x00lib_request_eeprom_file(struct rt2x00_dev *rt2x00dev)