[PATCH:xf86-video-sis] Make SiSRegInit & SiSSetLVDSetc args match in both headers that define them

Alan Coopersmith alan.coopersmith at oracle.com
Fri Jun 29 20:45:27 PDT 2012


Adds include of "sis_dac.h" to init.c to force compilers to compare the
definitions, making it obvious that sis_dac.h defined an extra argument
to SiSSetLVDSetc that the function itself didn't have, and that SiSRegInit
expected an unsigned long (in the form of SISIOADDRESS), not the unsigned
short that sis_dac.h claimed to pass it.

Found by the Parfait 1.0 bug checking tool:

Error: Function Call Mismatch
   Function call with extra args: Forward declaration of function 'SiSSetLVDSetc
' does not match its definition
      Function expects 1 argument (SiS_Private*); given 2 (SiS_Private*, unsigne
d short)
        at line 604 of driver/xf86-video-sis/src/sis_dac.c in function 'SiS300Restore'.
          Function defined at line 1153 of driver/xf86-video-sis/src/init.c.
[repeated for each call]

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 src/init.c       |    1 +
 src/sis_dac.c    |    8 ++++----
 src/sis_dac.h    |    4 ++--
 src/sis_driver.c |    4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/init.c b/src/init.c
index 74df1f5..a232cb7 100644
--- a/src/init.c
+++ b/src/init.c
@@ -59,6 +59,7 @@
 #endif
 
 #include "init.h"
+#include "sis_dac.h"
 
 #ifdef SIS300
 #include "300vtbl.h"
diff --git a/src/sis_dac.c b/src/sis_dac.c
index 816d0c8..04276b6 100644
--- a/src/sis_dac.c
+++ b/src/sis_dac.c
@@ -601,7 +601,7 @@ SiS300Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
     if(!(pSiS->UseVESA)) {
        if(pSiS->VBFlags2 & VB2_LVDS) {
 	  SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
-	  SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+	  SiSSetLVDSetc(pSiS->SiS_Pr);
 	  SiS_GetVBType(pSiS->SiS_Pr);
 	  SiS_UnLockCRT2(pSiS->SiS_Pr);
 	  SiS_DisableBridge(pSiS->SiS_Pr);
@@ -990,7 +990,7 @@ SiS301Restore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
     Part4max = 0x1b;
 
     SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
-    SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+    SiSSetLVDSetc(pSiS->SiS_Pr);
     SiS_GetVBType(pSiS->SiS_Pr);
     SiS_DisableBridge(pSiS->SiS_Pr);
     SiS_UnLockCRT2(pSiS->SiS_Pr);
@@ -1084,7 +1084,7 @@ SiS301BRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
     } /* TODO for 307 */
 
     SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
-    SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+    SiSSetLVDSetc(pSiS->SiS_Pr);
     SiS_GetVBType(pSiS->SiS_Pr);
     SiS_DisableBridge(pSiS->SiS_Pr);
     SiS_UnLockCRT2(pSiS->SiS_Pr);
@@ -1193,7 +1193,7 @@ SiSLVDSChrontelRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg)
     int i;
 
     SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO + 0x30);
-    SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+    SiSSetLVDSetc(pSiS->SiS_Pr);
     SiS_GetVBType(pSiS->SiS_Pr);
     SiS_DisableBridge(pSiS->SiS_Pr);
     if(pSiS->ChipType == SIS_730) {
diff --git a/src/sis_dac.h b/src/sis_dac.h
index b270675..18d956d 100644
--- a/src/sis_dac.h
+++ b/src/sis_dac.h
@@ -72,7 +72,7 @@ extern void		SiS_DisplayOn(struct SiS_Private *SiS_Pr);
 extern unsigned char	SiS_GetSetModeID(ScrnInfoPtr pScrn, unsigned char id);
 extern void		SiS_SetEnableDstn(struct SiS_Private *SiS_Pr, int enable);
 extern void		SiS_SetEnableFstn(struct SiS_Private *SiS_Pr, int enable);
-extern void		SiSRegInit(struct SiS_Private *SiS_Pr, unsigned short BaseAddr);
-extern void		SiSSetLVDSetc(struct SiS_Private *SiS_Pr, unsigned short ModeNo);
+extern void		SiSRegInit(struct SiS_Private *SiS_Pr, SISIOADDRESS BaseAddr);
+extern void		SiSSetLVDSetc(struct SiS_Private *SiS_Pr);
 extern void		SiS_GetVBType(struct SiS_Private *SiS_Pr);
 /* End of init.c/init301.c imports */
diff --git a/src/sis_driver.c b/src/sis_driver.c
index 5fbf76c..7f6cfc4 100644
--- a/src/sis_driver.c
+++ b/src/sis_driver.c
@@ -7413,7 +7413,7 @@ SISSave(ScrnInfoPtr pScrn)
 #ifdef SIS_PC_PLATFORM
        if(pSiS->VGAMemBase) {
           SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
-          SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+          SiSSetLVDSetc(pSiS->SiS_Pr);
           SiS_GetVBType(pSiS->SiS_Pr);
           SiS_DisableBridge(pSiS->SiS_Pr);
           SiSVGASave(pScrn, sisReg, SISVGA_SR_FONTS);
@@ -8089,7 +8089,7 @@ SISRestore(ScrnInfoPtr pScrn)
 
 	   if(flags & SISVGA_SR_FONTS) {
               SiSRegInit(pSiS->SiS_Pr, pSiS->RelIO+0x30);
-	      SiSSetLVDSetc(pSiS->SiS_Pr, 0);
+	      SiSSetLVDSetc(pSiS->SiS_Pr);
 	      SiS_GetVBType(pSiS->SiS_Pr);
 	      SiS_DisableBridge(pSiS->SiS_Pr);
 	      SiSVGAProtect(pScrn, TRUE);
-- 
1.7.9.2



More information about the xorg-devel mailing list