[PATCH 147/524] Staging: xgifb: Remove defines for TRUE, FALSE, and NULL

Greg Kroah-Hartman gregkh at suse.de
Thu Aug 5 22:18:50 UTC 2010


From: Bill Pemberton <wfp5p at virginia.edu>

Signed-off-by: Bill Pemberton <wfp5p at virginia.edu>
Cc: Arnaud Patard <apatard at mandriva.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
---
 drivers/staging/xgifb/XGI_main_26.c |   79 +++++++++++++++++--------------
 drivers/staging/xgifb/vb_init.c     |   43 +++++++---------
 drivers/staging/xgifb/vb_setmode.c  |   89 ++++++++++++++++-------------------
 drivers/staging/xgifb/vgatypes.h    |   16 +------
 4 files changed, 105 insertions(+), 122 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index c7ad6cd..403b5d4 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -440,10 +440,10 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 		DPRINTK("XGIfb: Set offset 0x%lx to 0x%lx\n", offset, *value);
 
 	if (!init) {
-		init = TRUE;
+		init = 1;
 		pdev = pci_get_device(PCI_VENDOR_ID_XG, xgi_video_info.chip_id, pdev);
 		if (pdev) {
-			valid_pdev = TRUE;
+			valid_pdev = 1;
 			pci_dev_put(pdev);
 		}
 	}
@@ -451,7 +451,7 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 	if (!valid_pdev) {
 		printk(KERN_DEBUG "XGIfb: Can't find XGI %d VGA device.\n",
 				xgi_video_info.chip_id);
-		return FALSE;
+		return 0;
 	}
 
 	if (set == 0)
@@ -459,7 +459,7 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 	else
 		pci_write_config_dword(pdev, offset, (u32)(*value));
 
-	return TRUE;
+	return 1;
 }
 
 /*BOOLEAN XGIfb_query_north_bridge_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
@@ -470,7 +470,7 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 	u16 nbridge_id = 0;
 
 	if (!init) {
-		init = TRUE;
+		init = 1;
 		switch (xgi_video_info.chip) {
 		case XGI_540:
 			nbridge_id = PCI_DEVICE_ID_XG_540;
@@ -497,13 +497,13 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 
 		pdev = pci_find_device(PCI_VENDOR_ID_SI, nbridge_id, pdev);
 		if (pdev)
-			valid_pdev = TRUE;
+			valid_pdev = 1;
 	}
 
 	if (!valid_pdev) {
 		printk(KERN_DEBUG "XGIfb: Can't find XGI %d North Bridge device.\n",
 				nbridge_id);
-		return FALSE;
+		return 0;
 	}
 
 	if (set == 0)
@@ -511,7 +511,7 @@ XGIfb_query_VGA_config_space(PXGI_HW_DEVICE_INFO pXGIhw_ext,
 	else
 		pci_write_config_dword(pdev, offset, (u32)(*value));
 
-	return TRUE;
+	return 1;
 }
 */
 /* ------------------ Internal helper routines ----------------- */
@@ -953,14 +953,14 @@ static BOOLEAN XGIfb_bridgeisslave(void)
 {
    unsigned char usScratchP1_00;
 
-   if(xgi_video_info.hasVB == HASVB_NONE) return FALSE;
+   if (xgi_video_info.hasVB == HASVB_NONE)
+	   return 0;
 
    inXGIIDXREG(XGIPART1,0x00,usScratchP1_00);
-   if( (usScratchP1_00 & 0x50) == 0x10)  {
-	   return TRUE;
-   } else {
-           return FALSE;
-   }
+   if ((usScratchP1_00 & 0x50) == 0x10)
+	   return 1;
+   else
+	   return 0;
 }
 
 static BOOLEAN XGIfbcheckvretracecrt1(void)
@@ -968,24 +968,30 @@ static BOOLEAN XGIfbcheckvretracecrt1(void)
    unsigned char temp;
 
    inXGIIDXREG(XGICR,0x17,temp);
-   if(!(temp & 0x80)) return FALSE;
+   if (!(temp & 0x80))
+	   return 0;
 
 
    inXGIIDXREG(XGISR,0x1f,temp);
-   if(temp & 0xc0) return FALSE;
-
+   if (temp & 0xc0)
+	   return 0;
 
-   if(inXGIREG(XGIINPSTAT) & 0x08) return TRUE;
-   else 			   return FALSE;
+   if (inXGIREG(XGIINPSTAT) & 0x08)
+	   return 1;
+   else
+	   return 0;
 }
 
 static BOOLEAN XGIfbcheckvretracecrt2(void)
 {
    unsigned char temp;
-   if(xgi_video_info.hasVB == HASVB_NONE) return FALSE;
+   if (xgi_video_info.hasVB == HASVB_NONE)
+	   return 0;
    inXGIIDXREG(XGIPART1, 0x30, temp);
-   if(temp & 0x02) return FALSE;
-   else 	   return TRUE;
+   if (temp & 0x02)
+	   return 0;
+   else
+	   return 1;
 }
 
 static BOOLEAN XGIfb_CheckVBRetrace(void)
@@ -1989,9 +1995,9 @@ static int XGIfb_has_VB(void)
 		break;
 	   default:
 		xgi_video_info.hasVB = HASVB_NONE;
-		return FALSE;
+		return 0;
 	}
-	return TRUE;
+	return 1;
 }
 
 
@@ -2645,7 +2651,7 @@ static void XGIfb_pre_setmode(void)
 static void XGIfb_post_setmode(void)
 {
 	u8 reg;
-	BOOLEAN doit = TRUE;
+	BOOLEAN doit = 1;
 #if 0	/* TW: Wrong: Is not in MMIO space, but in RAM */
 	/* Backup mode number to MMIO space */
 	if(xgi_video_info.mmio_vbase) {
@@ -2659,11 +2665,11 @@ static void XGIfb_post_setmode(void)
 	if (xgi_video_info.video_bpp == 8) {
 		/* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */
 		if ((xgi_video_info.hasVB == HASVB_LVDS) || (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
-			doit = FALSE;
+			doit = 0;
 		}
 		/* TW: We can't switch off CRT1 on 301B-DH in 8bpp Modes if using LCD */
 		if  (xgi_video_info.disp_state & DISPTYPE_LCD)  {
-	        	doit = FALSE;
+			doit = 0;
 	        }
 	}
 
@@ -2672,14 +2678,15 @@ static void XGIfb_post_setmode(void)
 		inXGIIDXREG(XGIPART1, 0x00, reg);
 
 
-		if((reg & 0x50) == 0x10) {
-			doit = FALSE;
-		}
+		if ((reg & 0x50) == 0x10)
+			doit = 0;
 
-	} else XGIfb_crt1off = 0;
+
+	} else
+		XGIfb_crt1off = 0;
 
 	inXGIIDXREG(XGICR, 0x17, reg);
-	if((XGIfb_crt1off) && (doit))
+	if ((XGIfb_crt1off) && (doit))
 		reg &= ~0x80;
 	else
 		reg |= 0x80;
@@ -3027,7 +3034,7 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		   case XG20:
 		   case XG21:
                    case XG27:
-                   XGIhw_ext.bIntegratedMMEnabled = TRUE;
+			   XGIhw_ext.bIntegratedMMEnabled = 1;
 			break;
 
 		   default:
@@ -3316,14 +3323,14 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	          inXGIIDXREG(XGICR,0x38,tmp);
 		      if((tmp & 0x03) == 0x03)
 		      {
-//		          XGI_Pr.XGI_UseLCDA = TRUE;
+/*		          XGI_Pr.XGI_UseLCDA = 1; */
 		      }else
 		      {
 		     //  Currently on LCDA? (Some newer BIOSes set D0 in CR35)
 		         inXGIIDXREG(XGICR,0x35,tmp);
 		         if(tmp & 0x01)
 		         {
-//		              XGI_Pr.XGI_UseLCDA = TRUE;
+/*		              XGI_Pr.XGI_UseLCDA = 1; */
 		           }else
 		           {
 		               inXGIIDXREG(XGICR,0x30,tmp);
@@ -3332,7 +3339,7 @@ int __devinit xgifb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		                   inXGIIDXREG(XGIPART1,0x13,tmp);
 			               if(tmp & 0x04)
 			               {
-//			                XGI_Pr.XGI_UseLCDA = TRUE;
+/*			                XGI_Pr.XGI_UseLCDA = 1; */
 			               }
 		               }
 		           }
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index c5c7284..da8f84f 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -148,18 +148,16 @@ BOOLEAN XGIInitNew( PXGI_HW_DEVICE_INFO HwDeviceExtension )
 
 
    /* if ( pVBInfo->ROMAddr == 0 ) */
-   /* return( FALSE ) ; */
+   /* return( 0 ) ; */
 
-    if ( pVBInfo->FBAddr == 0 )
-{
+    if (pVBInfo->FBAddr == 0) {
        printk("\n pVBInfo->FBAddr == 0 ");
-       return( FALSE ) ;
-}
+       return 0;
+    }
 printk("1");
-    if ( pVBInfo->BaseAddr == 0 )
-{
-       printk("\npVBInfo->BaseAddr == 0 ");
-        return( FALSE ) ;
+if (pVBInfo->BaseAddr == 0) {
+	printk("\npVBInfo->BaseAddr == 0 ");
+	return 0;
 }
 printk("2");
 
@@ -169,9 +167,8 @@ printk("2");
 printk("3");
 
 if ( !HwDeviceExtension->bIntegratedMMEnabled )
-{
-        return( FALSE ) ;	/* alan */
-}
+	return 0;	/* alan */
+
 printk("4");
 
  //   VBIOSVersion[ 4 ] = 0x0 ;
@@ -422,15 +419,14 @@ printk("18");
         XGINew_SetReg1( pVBInfo->P3d4 , 0x83 , 0x00 ) ;
 printk("181");
 
-    if ( HwDeviceExtension->bSkipSense == FALSE )
-    {
-printk("182");
+if (HwDeviceExtension->bSkipSense == 0) {
+	printk("182");
 
         XGI_SenseCRT1(pVBInfo) ;
 
-printk("183");
+	printk("183");
         /* XGINew_DetectMonitor( HwDeviceExtension ) ; */
-pVBInfo->IF_DEF_CH7007 = 0;
+	pVBInfo->IF_DEF_CH7007 = 0;
         if ( ( HwDeviceExtension->jChipType == XG21 ) && (pVBInfo->IF_DEF_CH7007) )
         {
 printk("184");
@@ -466,8 +462,7 @@ printk("19");
 
         XGINew_SetDRAMDefaultRegister340( HwDeviceExtension ,  pVBInfo->P3d4,  pVBInfo ) ;
 
-        if ( HwDeviceExtension->bSkipDramSizing == TRUE )
-        {
+	if (HwDeviceExtension->bSkipDramSizing == 1) {
             pSR = HwDeviceExtension->pSR ;
             if ( pSR!=NULL )
             {
@@ -547,7 +542,7 @@ XGINew_SetReg1( pVBInfo->P3d4 , 0x8c , 0x87);
 XGINew_SetReg1( pVBInfo->P3c4 , 0x14 , 0x31);
 printk("25");
 
-    return( TRUE ) ;
+return 1;
 } /* end of init */
 
 
@@ -2608,10 +2603,10 @@ void XGINew_SetMemoryClock( PXGI_HW_DEVICE_INFO HwDeviceExtension, PVB_DEVICE_IN
 /* --------------------------------------------------------------------- */
 BOOLEAN ChkLFB( PVB_DEVICE_INFO pVBInfo )
 {
-    if ( LFBDRAMTrap & XGINew_GetReg1( pVBInfo->P3d4 , 0x78 ) )
-        return( TRUE ) ;
-    else
-        return( FALSE );
+	if (LFBDRAMTrap & XGINew_GetReg1(pVBInfo->P3d4 , 0x78))
+		return 1;
+	else
+		return 0;
 }
 
 
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index dc4e186..a0ccce0 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -510,15 +510,9 @@ BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo )
     }	/* !XG20 */
     else
     {
-
-
-        if ( pVBInfo->IF_DEF_LVDS == 1 )
-        {
-            if ( !XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo) )
-            {
-              return FALSE;
-            }
-        }
+	    if (pVBInfo->IF_DEF_LVDS == 1)
+		    if (!XGI_XG21CheckLVDSMode(ModeNo , ModeIdIndex, pVBInfo))
+			    return 0;
 
         if ( ModeNo <= 0x13 )
         {
@@ -577,7 +571,7 @@ BOOLEAN XGISetModeNew( PXGI_HW_DEVICE_INFO HwDeviceExtension , USHORT ModeNo )
     XGI_LockCRT2( HwDeviceExtension, pVBInfo ) ;
 }
 
-    return( TRUE ) ;
+    return 1;
 }
 
 
@@ -3987,10 +3981,10 @@ BOOLEAN XGI_SearchModeID( USHORT ModeNo , USHORT *ModeIdIndex, PVB_DEVICE_INFO p
         /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->SModeIDTable)/sizeof(XGI_StStruct);(*ModeIdIndex)++) */
         for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
         {
-            if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == ModeNo )
-                break ;
-            if ( pVBInfo->SModeIDTable[ *ModeIdIndex ].St_ModeID == 0xFF )
-                return( FALSE ) ;
+		if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == ModeNo)
+			break;
+		if (pVBInfo->SModeIDTable[*ModeIdIndex].St_ModeID == 0xFF)
+			return 0;
         }
 
         if ( ModeNo == 0x07 )
@@ -4005,16 +3999,16 @@ BOOLEAN XGI_SearchModeID( USHORT ModeNo , USHORT *ModeIdIndex, PVB_DEVICE_INFO p
         /* for (*ModeIdIndex=0;*ModeIdIndex<sizeof(pVBInfo->EModeIDTable)/sizeof(XGI_ExtStruct);(*ModeIdIndex)++) */
         for( *ModeIdIndex = 0 ; ; ( *ModeIdIndex )++ )
         {
-            if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == ModeNo )
-                break ;
-            if ( pVBInfo->EModeIDTable[ *ModeIdIndex ].Ext_ModeID == 0xFF )
-                return( FALSE ) ;
+		if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == ModeNo)
+			break;
+		if (pVBInfo->EModeIDTable[*ModeIdIndex].Ext_ModeID == 0xFF)
+			return 0;
         }
     }
 
 #endif
 
-    return( TRUE ) ;
+    return 1;
 }
 
 
@@ -4039,7 +4033,7 @@ BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT Mode
 /*  if ( ( HwDeviceExtension->jChipType == XGI_650 ) ||
          ( HwDeviceExtension->jChipType == XGI_650M ) )
     {
-        return( TRUE ) ;
+	return 1;
     } */
 
     if ( ModeNo <= 0x13 )
@@ -4097,10 +4091,10 @@ BOOLEAN XGINew_CheckMemorySize(PXGI_HW_DEVICE_INFO HwDeviceExtension,USHORT Mode
             temp <<= 1 ;
         }
     }
-    if ( temp < memorysize )
-        return( FALSE ) ;
+    if (temp < memorysize)
+	    return 0;
     else
-        return( TRUE ) ;
+	    return 1;
 }
 
 
@@ -7736,7 +7730,7 @@ void* XGI_GetTVPtr (USHORT BX,USHORT ModeNo,USHORT ModeIdIndex,USHORT RefreshRat
 /* --------------------------------------------------------------------- */
 /* Function : XGI_BacklightByDrv */
 /* Input : */
-/* Output : TRUE -> Skip backlight control */
+/* Output : 1 -> Skip backlight control */
 /* Description : */
 /* --------------------------------------------------------------------- */
 BOOLEAN XGI_BacklightByDrv( PVB_DEVICE_INFO pVBInfo )
@@ -7744,10 +7738,10 @@ BOOLEAN XGI_BacklightByDrv( PVB_DEVICE_INFO pVBInfo )
     UCHAR tempah ;
 
     tempah = ( UCHAR )XGINew_GetReg1( pVBInfo->P3d4 , 0x3A ) ;
-    if ( tempah & BacklightControlBit )
-        return TRUE ;
+    if (tempah & BacklightControlBit)
+	    return 1;
     else
-        return FALSE ;
+	    return 0;
 }
 
 
@@ -8055,10 +8049,10 @@ BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO
 
     lvdstableindex = XGI_GetLVDSOEMTableIndex( pVBInfo );
     if ( xres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSHDE) )
-      return FALSE;
+	    return 0;
 
     if ( yres > (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE) )
-      return FALSE;
+	    return 0;
 
     if ( ModeNo > 0x13 )
     {
@@ -8066,13 +8060,12 @@ BOOLEAN XGI_XG21CheckLVDSMode(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO
            ( yres != (pVBInfo->XG21_LVDSCapList[lvdstableindex].LVDSVDE)) )
       {
           colordepth = XGI_GetColorDepth( ModeNo , ModeIdIndex, pVBInfo ) ;
-          if ( colordepth > 2 )
-          {
-            return FALSE;
-          }
+	  if (colordepth > 2)
+		  return 0;
+
       }
     }
-    return TRUE;
+    return 1;
 }
 
 void XGI_SetXG21FPBits(PVB_DEVICE_INFO pVBInfo)
@@ -8463,8 +8456,8 @@ void XGI_SetXG27LVDSPara(USHORT ModeNo,USHORT ModeIdIndex, PVB_DEVICE_INFO pVBIn
 /* --------------------------------------------------------------------- */
 /* Function : XGI_IsLCDON */
 /* Input : */
-/* Output : FALSE : Skip PSC Control */
-/* TRUE: Disable PSC */
+/* Output : 0 : Skip PSC Control */
+/* 1: Disable PSC */
 /* Description : */
 /* --------------------------------------------------------------------- */
 BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo)
@@ -8473,11 +8466,11 @@ BOOLEAN XGI_IsLCDON(PVB_DEVICE_INFO pVBInfo)
 
     tempax = pVBInfo->VBInfo ;
     if ( tempax & SetCRT2ToDualEdge )
-        return FALSE ;
+	    return 0;
     else if ( tempax & ( DisableCRT2Display | SwitchToCRT2 | SetSimuScanMode ) )
-        return TRUE ;
+	    return 1;
 
-    return FALSE ;
+    return 0;
 }
 
 
@@ -8518,7 +8511,7 @@ void XGI_DisablePWD( PVB_DEVICE_INFO pVBInfo )
 /* --------------------------------------------------------------------- */
 /* Function : XGI_DisableChISLCD */
 /* Input : */
-/* Output : FALSE -> Not LCD Mode */
+/* Output : 0 -> Not LCD Mode */
 /* Description : */
 /* --------------------------------------------------------------------- */
 BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo)
@@ -8532,16 +8525,16 @@ BOOLEAN XGI_DisableChISLCD(PVB_DEVICE_INFO pVBInfo)
     if ( tempbx & ( EnableChA | DisableChA ) )
     {
         if ( !( tempah & 0x08 ) )		/* Chk LCDA Mode */
-            return FALSE ;
+		return 0 ;
     }
 
     if ( !( tempbx & ( EnableChB | DisableChB ) ) )
-        return FALSE ;
+	    return 0;
 
     if ( tempah & 0x01 )       /* Chk LCDB Mode */
-        return TRUE ;
+	    return 1;
 
-    return FALSE ;
+    return 0;
 }
 
 
@@ -8563,16 +8556,16 @@ BOOLEAN XGI_EnableChISLCD(PVB_DEVICE_INFO pVBInfo)
     if ( tempbx & ( EnableChA | DisableChA ) )
     {
         if ( !( tempah & 0x08 ) )		/* Chk LCDA Mode */
-            return FALSE ;
+		return 0;
     }
 
     if ( !( tempbx & ( EnableChB | DisableChB ) ) )
-        return FALSE ;
+	    return 0;
 
     if ( tempah & 0x01 )       /* Chk LCDB Mode */
-        return TRUE ;
+	    return 1;
 
-    return FALSE ;
+    return 0;
 }
 
 
diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 83fea8e..c1c7985 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -4,18 +4,6 @@
 
 #include <linux/ioctl.h>
 
-#ifndef FALSE
-#define FALSE   0
-#endif
-
-#ifndef TRUE
-#define TRUE    1
-#endif
-
-#ifndef NULL
-#define NULL    0
-#endif
-
 #ifndef CHAR
 typedef char CHAR;
 #endif
@@ -186,12 +174,12 @@ struct _XGI_HW_DEVICE_INFO
     PXGI_DSReg  pSR;             /* restore SR registers in initial function. */
                                  /* end data :(idx, val) =  (FF, FF). */
                                  /* Note : restore SR registers if  */
-                                 /* bSkipDramSizing = TRUE */
+                                 /* bSkipDramSizing = 1 */
 
     PXGI_DSReg  pCR;             /* restore CR registers in initial function. */
                                  /* end data :(idx, val) =  (FF, FF) */
                                  /* Note : restore cR registers if  */
-                                 /* bSkipDramSizing = TRUE */
+                                 /* bSkipDramSizing = 1 */
 /*
 #endif
 */
-- 
1.7.1




More information about the devel mailing list