summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@hadrons.org>2011-12-30 05:59:46 +0100
committerGuillem Jover <guillem@hadrons.org>2011-12-30 06:42:04 +0100
commite42689244fd5e1b23e641de46c4dc6d38a243a3b (patch)
treea76b820103417b9281b1e44f50580ec98d459ba1
parent518b189f31ee7b85d28541bf32bbcf10b5337289 (diff)
Pass SST number through GLIDERec instead of casting it to driverPrivate
Allocate GLIDERec in GLIDEProbe() instead of in GLIDEPreInit() to pass the SST number through the SST_Index member instead of casting it to the driverPrivate pointer back and forth. Signed-off-by: Guillem Jover <guillem@hadrons.org>
-rw-r--r--src/glide_driver.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/glide_driver.c b/src/glide_driver.c
index e85ee2d..9217f0b 100644
--- a/src/glide_driver.c
+++ b/src/glide_driver.c
@@ -332,6 +332,8 @@ GLIDEProbe(DriverPtr drv, int flags)
/* Allocate a ScrnInfoRec and claim the slot */
if ((pScrn = xf86AllocateScreen(drv, 0))) {
+ GLIDEPtr pGlide;
+
xf86AddEntityToScreen(pScrn, entityIndex);
/* I'm not going to "claim" the glide device since no other driver than this can drive it */
@@ -348,7 +350,14 @@ GLIDEProbe(DriverPtr drv, int flags)
pScrn->EnterVT = GLIDEEnterVT;
pScrn->LeaveVT = GLIDELeaveVT;
pScrn->FreeScreen = GLIDEFreeScreen;
- pScrn->driverPrivate = (void*)sst;
+
+ /* Allocate the GLIDERec driverPrivate */
+ if (!GLIDEGetRec(pScrn))
+ break;
+
+ pGlide = GLIDEPTR(pScrn);
+ pGlide->SST_Index = sst;
+
/*
* XXX This is a hack because don't have the PCI info. Set it as
* an ISA entity with no resources.
@@ -376,7 +385,6 @@ GLIDEPreInit(ScrnInfoPtr pScrn, int flags)
MessageType from;
int i;
ClockRangePtr clockRanges;
- int sst;
if (flags & PROBE_DETECT) return FALSE;
@@ -384,9 +392,6 @@ GLIDEPreInit(ScrnInfoPtr pScrn, int flags)
if (pScrn->numEntities != 1)
return FALSE;
- sst = (int)(pScrn->driverPrivate);
- pScrn->driverPrivate = NULL;
-
/* Set pScrn->monitor */
pScrn->monitor = pScrn->confScreen->monitor;
@@ -448,11 +453,6 @@ GLIDEPreInit(ScrnInfoPtr pScrn, int flags)
/* We use a programmable clock */
pScrn->progClock = TRUE;
- /* Allocate the GLIDERec driverPrivate */
- if (!GLIDEGetRec(pScrn)) {
- return FALSE;
- }
-
pGlide = GLIDEPTR(pScrn);
/* Get the entity */
@@ -477,8 +477,6 @@ GLIDEPreInit(ScrnInfoPtr pScrn, int flags)
"Voodoo card will be %s when exiting server.\n",
pGlide->OnAtExit ? "ON" : "OFF");
- pGlide->SST_Index = sst;
-
/*
* If the user has specified the amount of memory in the XF86Config
* file, we respect that setting.