[PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@xxxxxxxxxx>
---
 drivers/staging/xgifb/vb_setmode.c |   81 ++++++++++++++++--------------------
 1 file changed, 36 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 3e0d668..f41e595 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -5993,59 +5993,50 @@ static void XGI_SetCRT2ModeRegs(unsigned short ModeNo,
 	tempah = 0x08;
 	tempbl = 0xf0;
 
-	if (pVBInfo->VBInfo & DisableCRT2Display) {
-		xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
-	} else {
+	do {
+		if (pVBInfo->VBInfo & DisableCRT2Display)
+			break;
+
 		tempah = 0x00;
 		tempbl = 0xff;
 
-		if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV
-				| SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
-			if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
-			    (!(pVBInfo->VBInfo & SetSimuScanMode))) {
-				tempbl &= 0xf7;
-				tempah |= 0x01;
-				xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e,
-						tempbl, tempah);
-			} else {
-				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
-					tempbl &= 0xf7;
-					tempah |= 0x01;
-				}
+		if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV |
+					 SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
+			break;
 
-				if (pVBInfo->VBInfo &
-				    (SetCRT2ToRAMDAC |
-				     SetCRT2ToTV |
-				     SetCRT2ToLCD)) {
-					tempbl &= 0xf8;
-					tempah = 0x01;
+		if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
+		    (!(pVBInfo->VBInfo & SetSimuScanMode))) {
+			tempbl &= 0xf7;
+			tempah |= 0x01;
+			break;
+		}
 
-					if (!(pVBInfo->VBInfo & SetInSlaveMode))
-						tempah |= 0x02;
+		if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+			tempbl &= 0xf7;
+			tempah |= 0x01;
+		}
 
-					if (!(pVBInfo->VBInfo &
-					      SetCRT2ToRAMDAC)) {
-						tempah = tempah ^ 0x05;
-						if (!(pVBInfo->VBInfo &
-						      SetCRT2ToLCD))
-							tempah = tempah ^ 0x01;
-					}
+		if (!(pVBInfo->VBInfo &
+		      (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)))
+			break;
 
-					if (!(pVBInfo->VBInfo &
-					      SetCRT2ToDualEdge))
-						tempah |= 0x08;
-					xgifb_reg_and_or(pVBInfo->Part1Port,
-							0x2e, tempbl, tempah);
-				} else {
-					xgifb_reg_and_or(pVBInfo->Part1Port,
-							0x2e, tempbl, tempah);
-				}
-			}
-		} else {
-			xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl,
-					tempah);
+		tempbl &= 0xf8;
+		tempah = 0x01;
+
+		if (!(pVBInfo->VBInfo & SetInSlaveMode))
+			tempah |= 0x02;
+
+		if (!(pVBInfo->VBInfo & SetCRT2ToRAMDAC)) {
+			tempah = tempah ^ 0x05;
+			if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+				tempah = tempah ^ 0x01;
 		}
-	}
+
+		if (!(pVBInfo->VBInfo & SetCRT2ToDualEdge))
+			tempah |= 0x08;
+
+	} while (0);
+	xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
 
 	if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD
 			| XGI_SetCRT2ToLCDA)) {
-- 
1.7.9.5

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux