[PATCH xf86-video-mga 1/4] Eliminate unused variables

Kevin Brace kevinbrace at gmx.com
Mon Nov 26 19:15:31 UTC 2018


Care had to be taken to properly handle XAA usage situation

Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
---
 src/mga_bios.c   |  1 -
 src/mga_dacG.c   |  6 +-----
 src/mga_dri.c    |  5 +++--
 src/mga_driver.c |  3 +--
 src/mga_storm.c  | 11 ++++++++++-
 src/mga_video.c  | 11 ++++++++++-
 6 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/src/mga_bios.c b/src/mga_bios.c
index a391b2c..f4198d0 100644
--- a/src/mga_bios.c
+++ b/src/mga_bios.c
@@ -297,7 +297,6 @@ Bool mga_read_and_process_bios( ScrnInfoPtr pScrn )
 #ifndef XSERVER_LIBPCIACCESS
     Bool pciBIOS = TRUE;
 #endif
-    int rlen;
     static const unsigned expected_length[] = { 0, 64, 64, 64, 128, 128 };
     unsigned version;
     unsigned pins_len;
diff --git a/src/mga_dacG.c b/src/mga_dacG.c
index 3b0d93e..b86ad39 100644
--- a/src/mga_dacG.c
+++ b/src/mga_dacG.c
@@ -827,12 +827,8 @@ MGAG200EHPIXPLLSET(ScrnInfoPtr pScrn, MGARegPtr mgaReg)
 {
     MGAPtr pMga = MGAPTR(pScrn);
 
-    unsigned long ulFallBackCounter, ulLoopCount, ulLockCheckIterations = 0, ulTempCount, ulVCount;
+    unsigned long ulLoopCount, ulLockCheckIterations = 0, ulTempCount, ulVCount;
     unsigned char ucTempByte, ucPixCtrl, ucPLLLocked = FALSE;
-    unsigned char ucM;
-    unsigned char ucN;
-    unsigned char ucP;
-    unsigned char ucS;
 
     while(ulLockCheckIterations <= 32 && ucPLLLocked == FALSE)
     {
diff --git a/src/mga_dri.c b/src/mga_dri.c
index a285f01..6867d8f 100644
--- a/src/mga_dri.c
+++ b/src/mga_dri.c
@@ -121,12 +121,13 @@ static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn )
 void MGAGetQuiescence( ScrnInfoPtr pScrn )
 {
    MGAPtr pMga = MGAPTR(pScrn);
+#ifdef USE_XAA
+   MGAFBLayout *pLayout = &pMga->CurrentLayout;
+#endif /* USE_XAA */
 
    pMga->haveQuiescense = 1;
 
    if ( pMga->directRenderingEnabled ) {
-      MGAFBLayout *pLayout = &pMga->CurrentLayout;
-
       MGAWaitForIdleDMA( pScrn );
 
         /* FIXME what about EXA? */
diff --git a/src/mga_driver.c b/src/mga_driver.c
index 636e985..0fa9d9a 100644
--- a/src/mga_driver.c
+++ b/src/mga_driver.c
@@ -2651,7 +2651,7 @@ MGAMapMem(ScrnInfoPtr pScrn)
 #ifdef XSERVER_LIBPCIACCESS
     struct pci_device *const dev = pMga->PciInfo;
     struct pci_mem_region *region;
-    int i, err;
+    int err;
 #endif
 
 
@@ -3173,7 +3173,6 @@ MGAScreenInit(SCREEN_INIT_ARGS_DECL)
     vgaHWPtr hwp;
     MGAPtr pMga;
     MGARamdacPtr MGAdac;
-    int ret;
     VisualPtr visual;
     unsigned char *FBStart;
     int width, height, displayWidth;
diff --git a/src/mga_storm.c b/src/mga_storm.c
index 3e0d382..28349c2 100644
--- a/src/mga_storm.c
+++ b/src/mga_storm.c
@@ -577,10 +577,19 @@ Bool mgaAccelInit( ScreenPtr pScreen )
 #endif
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
     MGAPtr pMga = MGAPTR(pScrn);
-    int maxFastBlitMem, maxlines;
+//  int maxFastBlitMem, maxlines;
+#ifdef HAVE_XAA_H
+    int maxFastBlitMem;
+#endif /* HAVE_XAA_H */
+    int maxlines;
+
+#if defined(HAVE_XAA_H) && defined(RENDER)
     Bool doRender = FALSE;
+#endif /* defined(HAVE_XAA_H) && defined(RENDER) */
     BoxRec AvailFBArea;
+#ifdef HAVE_XAA_H
     int i;
+#endif /* HAVE_XAA_H */
 
     pMga->ScratchBuffer = malloc(((pScrn->displayWidth * pMga->CurrentLayout.bitsPerPixel) + 127) >> 3);
     if(!pMga->ScratchBuffer) return FALSE;
diff --git a/src/mga_video.c b/src/mga_video.c
index cb6b9c9..881f88c 100644
--- a/src/mga_video.c
+++ b/src/mga_video.c
@@ -565,8 +565,12 @@ MGAAllocateMemory(
    void **mem_struct,
    int size
 ){
+#if defined(USE_XAA) || defined(USE_EXA)
    MGAPtr pMga = MGAPTR(pScrn);
+#endif /* defined(USE_XAA) || defined(USE_EXA) */
+#ifdef USE_XAA
    ScreenPtr pScreen = xf86ScrnToScreen(pScrn);
+#endif /* USE_XAA */
    int offset = 0;
 
 #ifdef USE_EXA
@@ -644,7 +648,9 @@ MGAAllocateMemory(
 static void
 MGAFreeMemory(ScrnInfoPtr pScrn, void *mem_struct)
 {
+#if defined(USE_XAA) || defined(USE_EXA)
     MGAPtr pMga = MGAPTR(pScrn);
+#endif /* defined(USE_XAA) || defined(USE_EXA) */
 
 #ifdef USE_EXA
     if (pMga->Exa) {
@@ -1805,7 +1811,10 @@ static void MGACopyILOAD(
     CARD32 *fb_ptr;
     CARD8  *ubuf, *vbuf;
     CARD32 *pu, *pv;
-    int k,l;
+#ifdef CUSTOM_MEMCOPY
+    int k;
+#endif /* CUSTOM_MEMCOPY */
+    int l;
     short clip_x1, clip_x2, tmp_w;
 
 #ifdef DEBUG_MGA2164
-- 
2.7.4



More information about the xorg-devel mailing list