summaryrefslogtreecommitdiff
blob: 3124f1ea2766c408412f0974c1b3f09ed963211c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
--- src/cir_driver.c.orig	2006-05-28 12:24:07.000000000 +0200
+++ src/cir_driver.c	2006-05-28 12:46:58.000000000 +0200
@@ -119,16 +119,29 @@
  * unresolved symbols that are not required.
  */
 
+typedef enum {AvailableOptions, Probe} SubSymbolIdx;
+typedef ScrnInfoPtr (*subFunctionPtr)(int);
+
 static const char *alpSymbols[] = {
 	"AlpAvailableOptions",
 	"AlpProbe",
 	NULL
 };
+subFunctionPtr alpRefs[] = {
+	NULL,
+	NULL,
+	NULL
+};
 static const char *lgSymbols[] = {
 	"LgAvailableOptions",
 	"LgProbe",
 	NULL
 };
+subFunctionPtr lgRefs[] = {
+	NULL,
+	NULL,
+	NULL
+};
 
 static const char *vbeSymbols[] = {
 	"VBEInit",
@@ -200,13 +213,13 @@
 	case PCI_CHIP_GD5464BD:
 	case PCI_CHIP_GD5465:
 		if (lg_loaded)
-			return LgAvailableOptions(chipid);
+			return (*lgRefs[AvailableOptions])(chipid);
 		else
 			return NULL;
 
 	default:
 		if (alp_loaded)
-			return AlpAvailableOptions(chipid);
+			return (*alpRefs[AvailableOptions])(chipid);
 		else
 			return NULL;
 	}
@@ -215,7 +228,7 @@
 static Bool
 CIRProbe(DriverPtr drv, int flags)
 {
-    int i;
+    int i, symidx;
     GDevPtr *devSections;
     pciVideoPtr pPci;
     int *usedChips;
@@ -238,12 +251,18 @@
 	if (!lg_loaded) {
 	    if (xf86LoadDrvSubModule(drv, "cirrus_laguna")) {
 		xf86LoaderReqSymLists(lgSymbols, NULL);
+		for (symidx=0; lgSymbols[symidx]!=NULL; symidx++) {
+		    lgRefs[symidx]=(subFunctionPtr)LoaderSymbol(lgSymbols[symidx]);
+		}
 		lg_loaded = TRUE;
 	    }
 	}
 	if (!alp_loaded) {
 	    if (xf86LoadDrvSubModule(drv, "cirrus_alpine")) {
 		xf86LoaderReqSymLists(alpSymbols, NULL);
+		for (symidx=0; alpSymbols[symidx]!=NULL; symidx++) {
+		    alpRefs[symidx]=(subFunctionPtr)LoaderSymbol(alpSymbols[symidx]);
+		}
 		alp_loaded = TRUE;
 	    }
 	}
@@ -288,17 +307,23 @@
  		if (!xf86LoadDrvSubModule(drv, "cirrus_laguna")) 
 		    continue;
  		xf86LoaderReqSymLists(lgSymbols, NULL);
+		for (symidx=0; lgSymbols[symidx]!=NULL; symidx++) {
+		    lgRefs[symidx]=(subFunctionPtr)LoaderSymbol(lgSymbols[symidx]);
+		}
  		lg_loaded = TRUE;
  	    }
-	    pScrn = LgProbe(usedChips[i]);
+	    pScrn = (*lgRefs[Probe])(usedChips[i]);
  	} else {
  	    if (!alp_loaded) {
  		if (!xf86LoadDrvSubModule(drv, "cirrus_alpine")) 
  		    continue;
  		xf86LoaderReqSymLists(alpSymbols, NULL);
+		for (symidx=0; alpSymbols[symidx]!=NULL; symidx++) {
+		    alpRefs[symidx]=(subFunctionPtr)LoaderSymbol(alpSymbols[symidx]);
+		}
  		alp_loaded = TRUE;
  	    }
- 	    pScrn = AlpProbe(usedChips[i]);
+	    pScrn = (*alpRefs[Probe])(usedChips[i]);
  	}
  	
  	if (pScrn) {