treewide: backport support for nvmem on non platform devices
[openwrt/staging/ldir.git] / package / kernel / mac80211 / patches / rt2x00 / 607-rt2x00-add_platform_data_mac_addr.patch
index f694b061d8e09277e5fe635efcadbb05c982d240..79f99ffdf4a23e6ba4751e15cd59747bc784ad52 100644 (file)
@@ -1,19 +1,18 @@
 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
 +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00dev.c
-@@ -993,8 +993,13 @@ static void rt2x00lib_rate(struct ieee80
+@@ -990,6 +990,12 @@ static void rt2x00lib_rate(struct ieee80
  
  void rt2x00lib_set_mac_address(struct rt2x00_dev *rt2x00dev, u8 *eeprom_mac_addr)
  {
 +      struct rt2x00_platform_data *pdata;
-       const char *mac_addr;
++
 +      pdata = rt2x00dev->dev->platform_data;
 +      if (pdata && pdata->mac_address)
 +              ether_addr_copy(eeprom_mac_addr, pdata->mac_address);
 +
-       mac_addr = of_get_mac_address(rt2x00dev->dev->of_node);
-       if (!IS_ERR(mac_addr))
-               ether_addr_copy(eeprom_mac_addr, mac_addr);
+       of_get_mac_address(rt2x00dev->dev->of_node, eeprom_mac_addr);
+       if (!is_valid_ether_addr(eeprom_mac_addr)) {
 --- a/include/linux/rt2x00_platform.h
 +++ b/include/linux/rt2x00_platform.h
 @@ -14,6 +14,7 @@