[PATCH] modes: Remove the ClockRanges type

Adam Jackson ajax at redhat.com
Tue Nov 10 11:56:36 PST 2009


ba2d39dd5428cb5922b797a1d4ea45b859412b40 introduced warnings:

xf86Mode.c: In function ‘xf86CheckModeForDriver’:
xf86Mode.c:986: warning: passing argument 1 of ‘modeInClockRange’ from incompatible pointer type
xf86Mode.c:253: note: expected ‘ClockRangePtr’ but argument is of type ‘ClockRangesPtr’
xf86Mode.c:1002: warning: passing argument 1 of ‘modeInClockRange’ from incompatible pointer type
xf86Mode.c:253: note: expected ‘ClockRangePtr’ but argument is of type ‘ClockRangesPtr’

Because I foolishly didn't notice that we had types with nearly
identical members named ClockRange and ClockRanges.  The latter
contained an extra 'strategy' member at the end, which claimed to be
needed by the vidmode extension.  Of course, this was a lie: the only time
we'd use it was in mode validation, for drivers using LOOKUP_CLKDIV2 with
non-programmable clocks.  The only driver using LOOKUP_CLKDIV2 is
rendition, which has a programmable clock.  The only driver using the
ClockRanges type was smi, which did not use it for its 'strategy' member,
so has been fixed to use ClockRange instead.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/common/xf86Mode.c |   14 +++++---------
 hw/xfree86/common/xf86str.h  |   16 +---------------
 2 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/hw/xfree86/common/xf86Mode.c b/hw/xfree86/common/xf86Mode.c
index 4a948d7..949d4fc 100644
--- a/hw/xfree86/common/xf86Mode.c
+++ b/hw/xfree86/common/xf86Mode.c
@@ -941,14 +941,13 @@ xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
 ModeStatus
 xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
 {
-    ClockRangesPtr cp;
+    ClockRangePtr cp;
     int i, k, gap, minimumGap = CLOCK_TOLERANCE + 1;
     int extraFlags = 0;
     int clockIndex = -1;
     int MulFactor = 1;
     int DivFactor = 1;
     int ModePrivFlags = 0;
-    Bool allowDiv2;
     ModeStatus status = MODE_NOMODE;
 
     /* Some sanity checking */
@@ -1005,8 +1004,7 @@ xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, int flags)
 		 * find a matching clock.
 		 */
     
-		allowDiv2 = (cp->strategy & LOOKUP_CLKDIV2) != 0;
-		i = xf86GetNearestClock(scrp, mode->Clock, allowDiv2,
+		i = xf86GetNearestClock(scrp, mode->Clock, 0,
 			   cp->ClockDivFactor, cp->ClockMulFactor, &k);
 		/*
 		 * If the clock is too far from the requested clock, this
@@ -1194,7 +1192,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
     int saveType;
     PixmapFormatRec *BankFormat;
     ClockRangePtr cp;
-    ClockRangesPtr storeClockRanges;
+    ClockRangePtr storeClockRanges;
     int numTimings = 0;
     range hsync[MAX_HSYNC];
     range vrefresh[MAX_VREFRESH];
@@ -1300,8 +1298,7 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
     }
 
     /*
-     * Store the clockRanges for later use by the VidMode extension. Must
-     * also store the strategy, since ClockDiv2 flag is stored there.
+     * Store the clockRanges for later use by the VidMode extension.
      */
     storeClockRanges = scrp->clockRanges;
     while (storeClockRanges != NULL) {
@@ -1309,11 +1306,10 @@ xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
     }
     for (cp = clockRanges; cp != NULL; cp = cp->next,
 	   	storeClockRanges = storeClockRanges->next) {
-	storeClockRanges = xnfalloc(sizeof(ClockRanges));
+	storeClockRanges = xnfalloc(sizeof(ClockRange));
 	if (scrp->clockRanges == NULL)
 	    scrp->clockRanges = storeClockRanges;
 	memcpy(storeClockRanges, cp, sizeof(ClockRange));
-	storeClockRanges->strategy = strategy;
     }
 
     /* Determine which pixmap format to pass to miScanLineWidth() */
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index 7b0b758..de1f1b6 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -241,20 +241,6 @@ typedef struct x_ClockRange {
     int			PrivFlags;
 } ClockRange, *ClockRangePtr;
 
-/* Need to store the strategy with clockRange for VidMode extension */
-typedef struct x_ClockRanges {
-    struct x_ClockRanges *next;
-    int			minClock;
-    int			maxClock;
-    int			clockIndex;	/* -1 for programmable clocks */
-    Bool		interlaceAllowed;
-    Bool		doubleScanAllowed;
-    int			ClockMulFactor;
-    int			ClockDivFactor;
-    int			PrivFlags;
-    int			strategy;
-} ClockRanges, *ClockRangesPtr;
-
 /*
  * The driverFunc. xorgDriverFuncOp specifies the action driver should
  * perform. If requested option is not supported function should return
@@ -786,7 +772,7 @@ typedef struct _ScrnInfoRec {
     Bool		silkenMouse;
 
     /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
-    ClockRangesPtr	clockRanges;
+    ClockRangePtr	clockRanges;
     int			adjustFlags;
 
     /*
-- 
1.6.5.2



More information about the xorg-devel mailing list