Browse Source

[rtl818x] Obviate RTL_ROM() hack

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 years ago
parent
commit
2154af0077

+ 14
- 7
src/drivers/net/rtl818x/rtl8180.c View File

@@ -3,16 +3,23 @@
3 3
 FILE_LICENCE(GPL2_OR_LATER);
4 4
 
5 5
 #include <ipxe/pci.h>
6
+#include "rtl818x.h"
6 7
 
7
-PROVIDE_REQUIRING_SYMBOL();
8
-REQUIRE_OBJECT(rtl818x);
9
-REQUIRE_OBJECT(rtl8180_grf5101);
10
-REQUIRE_OBJECT(rtl8180_max2820);
11
-REQUIRE_OBJECT(rtl8180_sa2400);
12
-
13
-static struct pci_device_id rtl8180_nics[] __unused = {
8
+static struct pci_device_id rtl8180_nics[] = {
14 9
 	PCI_ROM(0x10ec, 0x8180, "rtl8180", "Realtek 8180", 0),
15 10
 	PCI_ROM(0x1799, 0x6001, "f5d6001", "Belkin F5D6001", 0),
16 11
 	PCI_ROM(0x1799, 0x6020, "f5d6020", "Belkin F5D6020", 0),
17 12
 	PCI_ROM(0x1186, 0x3300, "dwl510",  "D-Link DWL-510", 0),
18 13
 };
14
+
15
+struct pci_driver rtl8180_driver __pci_driver = {
16
+	.ids            = rtl8180_nics,
17
+	.id_count       = sizeof(rtl8180_nics) / sizeof(rtl8180_nics[0]),
18
+	.probe		= rtl818x_probe,
19
+	.remove		= rtl818x_remove,
20
+};
21
+
22
+REQUIRING_SYMBOL(rtl8180_driver);
23
+REQUIRE_OBJECT(rtl8180_grf5101);
24
+REQUIRE_OBJECT(rtl8180_max2820);
25
+REQUIRE_OBJECT(rtl8180_sa2400);

+ 11
- 4
src/drivers/net/rtl818x/rtl8185.c View File

@@ -3,13 +3,20 @@
3 3
 FILE_LICENCE(GPL2_OR_LATER);
4 4
 
5 5
 #include <ipxe/pci.h>
6
-
7
-PROVIDE_REQUIRING_SYMBOL();
8
-REQUIRE_OBJECT(rtl818x);
9
-REQUIRE_OBJECT(rtl8185_rtl8225);
6
+#include "rtl818x.h"
10 7
 
11 8
 static struct pci_device_id rtl8185_nics[] __unused = {
12 9
 	PCI_ROM(0x10ec, 0x8185, "rtl8185", "Realtek 8185", 0),
13 10
 	PCI_ROM(0x1799, 0x700f, "f5d7000", "Belkin F5D7000", 0),
14 11
 	PCI_ROM(0x1799, 0x701f, "f5d7010", "Belkin F5D7010", 0),
15 12
 };
13
+
14
+struct pci_driver rtl8185_driver __pci_driver = {
15
+	.ids            = rtl8185_nics,
16
+	.id_count       = sizeof(rtl8185_nics) / sizeof(rtl8185_nics[0]),
17
+	.probe		= rtl818x_probe,
18
+	.remove		= rtl818x_remove,
19
+};
20
+
21
+REQUIRING_SYMBOL(rtl8185_driver);
22
+REQUIRE_OBJECT(rtl8185_rtl8225);

+ 2
- 24
src/drivers/net/rtl818x/rtl818x.c View File

@@ -649,7 +649,7 @@ struct net80211_device_operations rtl818x_operations = {
649 649
 	.config = rtl818x_config,
650 650
 };
651 651
 
652
-static int rtl818x_probe(struct pci_device *pdev )
652
+int rtl818x_probe(struct pci_device *pdev )
653 653
 {
654 654
 	struct net80211_device *dev;
655 655
 	struct rtl818x_priv *priv;
@@ -820,7 +820,7 @@ static int rtl818x_probe(struct pci_device *pdev )
820 820
 	return err;
821 821
 }
822 822
 
823
-static void rtl818x_remove(struct pci_device *pdev)
823
+void rtl818x_remove(struct pci_device *pdev)
824 824
 {
825 825
 	struct net80211_device *dev = pci_get_drvdata(pdev);
826 826
 
@@ -830,25 +830,3 @@ static void rtl818x_remove(struct pci_device *pdev)
830 830
 	net80211_unregister(dev);
831 831
 	net80211_free(dev);
832 832
 }
833
-
834
-/* Hide PCI_ROM definitions in here from parserom.pl; the definitions
835
-   that should be used are in rtl8180.c and rtl8185.c. */
836
-#define RTL_ROM PCI_ROM
837
-
838
-static struct pci_device_id rtl818x_nics[] = {
839
-	RTL_ROM(0x10ec, 0x8185, "rtl8185", "Realtek 8185", 0),
840
-	RTL_ROM(0x1799, 0x700f, "f5d7000", "Belkin F5D7000", 0),
841
-	RTL_ROM(0x1799, 0x701f, "f5d7010", "Belkin F5D7010", 0),
842
-
843
-	RTL_ROM(0x10ec, 0x8180, "rtl8180", "Realtek 8180", 0),
844
-	RTL_ROM(0x1799, 0x6001, "f5d6001", "Belkin F5D6001", 0),
845
-	RTL_ROM(0x1799, 0x6020, "f5d6020", "Belkin F5D6020", 0),
846
-	RTL_ROM(0x1186, 0x3300, "dwl510",  "D-Link DWL-510", 0),
847
-};
848
-
849
-struct pci_driver rtl818x_driver __pci_driver = {
850
-	.ids            = rtl818x_nics,
851
-	.id_count       = sizeof(rtl818x_nics) / sizeof(rtl818x_nics[0]),
852
-	.probe		= rtl818x_probe,
853
-	.remove		= rtl818x_remove,
854
-};

+ 4
- 0
src/drivers/net/rtl818x/rtl818x.h View File

@@ -19,6 +19,7 @@
19 19
 
20 20
 #include <ipxe/spi_bit.h>
21 21
 #include <ipxe/tables.h>
22
+#include <ipxe/net80211.h>
22 23
 
23 24
 FILE_LICENCE(GPL2_ONLY);
24 25
 
@@ -356,4 +357,7 @@ struct rtl818x_rf_ops {
356 357
 	void (*conf_erp)(struct net80211_device *dev); /* set based on dev->erp_flags */
357 358
 };
358 359
 
360
+extern int rtl818x_probe(struct pci_device *pdev );
361
+extern void rtl818x_remove(struct pci_device *pdev);
362
+
359 363
 #endif /* RTL818X_H */

Loading…
Cancel
Save