9806fbb7b73a1cf48c1a635aa08fcf03434ba5cb
[openwrt.git] / target / linux / lantiq / patches-3.10 / 0202-lantiq_ath5k.patch
1 Index: linux-3.10.34/arch/mips/lantiq/xway/ath_eep.c
2 ===================================================================
3 --- linux-3.10.34.orig/arch/mips/lantiq/xway/ath_eep.c  2014-03-29 20:17:33.826386600 +0000
4 +++ linux-3.10.34/arch/mips/lantiq/xway/ath_eep.c       2014-03-29 20:18:19.610387315 +0000
5 @@ -36,6 +36,7 @@
6         return 0;
7  }
8  
9 +static int ath9k_eep_load;
10  int __init of_ath9k_eeprom_probe(struct platform_device *pdev)
11  {
12         struct device_node *np = pdev->dev.of_node, *mtd_np;
13 @@ -112,6 +113,12 @@
14         if (!of_property_read_u32(np, "ath,pci-slot", &pci_slot)) {
15                 ltq_pci_ath_fixup(pci_slot, ath9k_pdata.eeprom_data);
16                 dev_info(&pdev->dev, "pci slot: %u\n", pci_slot);
17 +               if (ath9k_eep_load) {
18 +                       struct pci_dev *d = NULL;
19 +                       while ((d = pci_get_device(PCI_VENDOR_ID_ATHEROS,
20 +                                       PCI_ANY_ID, d)) != NULL)
21 +                               pci_fixup_device(pci_fixup_early, d);
22 +               }
23         }
24  
25         dev_info(&pdev->dev, "loaded ath9k eeprom\n");
26 @@ -132,20 +139,19 @@
27         },
28  };
29  
30 -static int ath9k_eep_loaded;
31  static int __init of_ath9k_eeprom_init(void)
32  {
33         int ret = platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
34  
35 -       if (!ret)
36 -               ath9k_eep_loaded = 1;
37 +       if (ret)
38 +               ath9k_eep_load = 1;
39  
40         return ret;
41  }
42  
43  static int __init of_ath9k_eeprom_init_late(void)
44  {
45 -       if (ath9k_eep_loaded)
46 +       if (!ath9k_eep_load)
47                 return 0;
48         return platform_driver_probe(&ath9k_eeprom_driver, of_ath9k_eeprom_probe);
49  }
50 @@ -247,4 +253,4 @@
51  {
52         return platform_driver_probe(&ath5k_eeprom_driver, of_ath5k_eeprom_probe);
53  }
54 -device_initcall(of_ath5k_eeprom_init);
55 +subsys_initcall(of_ath5k_eeprom_init);