All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] Several cleanings and style fixes
@ 2012-07-05 14:45 Miguel Gómez
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
                   ` (19 more replies)
  0 siblings, 20 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Hi!

The goal of this round of patches is to perform a cleaning of the code and
to remove the style problems found on it.

The first patch removes a lot of comments and commented code, leaving only
those that seem interesting to understand the code.
Then there are some patches removing useless structures and pieces of code
that I found during the comment revision.
And also a patch improving some debug strings that I had pending from my
previous round of patches.

Patches 10 to 17 rework some conditions in some places of the code to fix
style errors related to excessive indentation. And patch 18 fixes the remaining
style errors.

Finally patch 19 removes a useless condition.

After this round of pathches, there are no style errors in the code that
are reported by checkpatch.

Regards!

Miguel Gómez (19):
  Staging: xgifb: Comment cleaning.
  Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
  Staging: xgifb: Remove LCDA detection in xgifb_probe().
  Staging: xgifb: Remove unused struct _chswtable.
  Staging: xgifb: Improve debug strings.
  Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
  Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
  Staging: xgifb: Remove unneeded var and condition in
    XGIfb_search_vesamode().
  Staging: xgifb: Remove useless always true condition.
  Staging: xgifb: Rework conditions in XGI_SetATTRegs().
  Staging: xgifb: Refactor XGI_AjustCRT2Rate().
  Staging: xgifb: Refactor XGI_GetVBType().
  Staging: xgifb: Rework conditions in XGI_GetVBInfo().
  Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
  Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  Staging: xgifb: Rework conditions in XGI_EnableBridge().
  Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
  Staging: xgifb: Fix coding style.
  Staging: xgifb: Remove useless condition.

 drivers/staging/xgifb/XGI_main.h    |   14 -
 drivers/staging/xgifb/XGI_main_26.c |  245 ++----------
 drivers/staging/xgifb/XGIfb.h       |    8 +-
 drivers/staging/xgifb/vb_def.h      |    3 -
 drivers/staging/xgifb/vb_init.c     |  166 +-------
 drivers/staging/xgifb/vb_init.h     |    1 -
 drivers/staging/xgifb/vb_setmode.c  |  742 ++++++++++++++++-------------------
 drivers/staging/xgifb/vb_struct.h   |    3 -
 drivers/staging/xgifb/vb_table.h    |   55 +--
 drivers/staging/xgifb/vb_util.h     |    1 -
 drivers/staging/xgifb/vgatypes.h    |   37 --
 11 files changed, 437 insertions(+), 838 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 17:24   ` Aaro Koskinen
                     ` (2 more replies)
  2012-07-05 14:45 ` [PATCH 02/19] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
                   ` (18 subsequent siblings)
  19 siblings, 3 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Remove commented code and useless comments. Leave only those with relevant
hints to the code.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main.h    |    4 -
 drivers/staging/xgifb/XGI_main_26.c |  131 +++--------------------------
 drivers/staging/xgifb/XGIfb.h       |    8 +-
 drivers/staging/xgifb/vb_def.h      |    3 -
 drivers/staging/xgifb/vb_init.c     |  155 ++++-------------------------------
 drivers/staging/xgifb/vb_init.h     |    1 -
 drivers/staging/xgifb/vb_setmode.c  |   26 +++---
 drivers/staging/xgifb/vb_struct.h   |    3 -
 drivers/staging/xgifb/vb_table.h    |   35 +++-----
 drivers/staging/xgifb/vb_util.h     |    1 -
 drivers/staging/xgifb/vgatypes.h    |    3 -
 11 files changed, 55 insertions(+), 315 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index be6bb7d..1686c5a 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -68,9 +68,6 @@ static int XGIfb_crt2type = -1;
 /* PR: Tv plug type (for overriding autodetection) */
 static int XGIfb_tvplug = -1;
 
-/* TW: For ioctl XGIFB_GET_INFO */
-/* XGIfb_info XGIfbinfo; */
-
 #define MD_XGI315 1
 
 /* mode table */
@@ -240,7 +237,6 @@ static const struct _chswtable {
 	{ 0,      0,      ""       , ""       }
 };
 
-/* Eden Chen */
 static const struct _XGI_TV_filter {
 	u8 filter[9][4];
 } XGI_TV_filter[] = {
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index fe9061d..511890b 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1,9 +1,3 @@
-/*
- * XG20, XG21, XG40, XG42 frame buffer device
- * for Linux kernels  2.5.x, 2.6.x
- * Base on TW's sis fbdev code.
- */
-
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #include <linux/module.h>
@@ -36,36 +30,6 @@ static void dumpVGAReg(void)
 	u8 i, reg;
 
 	xgifb_reg_set(XGISR, 0x05, 0x86);
-	/*
-	xgifb_reg_set(XGISR, 0x08, 0x4f);
-	xgifb_reg_set(XGISR, 0x0f, 0x20);
-	xgifb_reg_set(XGISR, 0x11, 0x4f);
-	xgifb_reg_set(XGISR, 0x13, 0x45);
-	xgifb_reg_set(XGISR, 0x14, 0x51);
-	xgifb_reg_set(XGISR, 0x1e, 0x41);
-	xgifb_reg_set(XGISR, 0x1f, 0x0);
-	xgifb_reg_set(XGISR, 0x20, 0xa1);
-	xgifb_reg_set(XGISR, 0x22, 0xfb);
-	xgifb_reg_set(XGISR, 0x26, 0x22);
-	xgifb_reg_set(XGISR, 0x3e, 0x07);
-	*/
-
-	/* xgifb_reg_set(XGICR, 0x19, 0x00); */
-	/* xgifb_reg_set(XGICR, 0x1a, 0x3C); */
-	/* xgifb_reg_set(XGICR, 0x22, 0xff); */
-	/* xgifb_reg_set(XGICR, 0x3D, 0x10); */
-
-	/* xgifb_reg_set(XGICR, 0x4a, 0xf3); */
-
-	/* xgifb_reg_set(XGICR, 0x57, 0x0); */
-	/* xgifb_reg_set(XGICR, 0x7a, 0x2c); */
-
-	/* xgifb_reg_set(XGICR, 0x82, 0xcc); */
-	/* xgifb_reg_set(XGICR, 0x8c, 0x0); */
-	/*
-	xgifb_reg_set(XGICR, 0x99, 0x1);
-	xgifb_reg_set(XGICR, 0x41, 0x40);
-	*/
 
 	for (i = 0; i < 0x4f; i++) {
 		reg = xgifb_reg_get(XGISR, i);
@@ -78,30 +42,6 @@ static void dumpVGAReg(void)
 		pr_debug("\no 3d4 %x", i);
 		pr_debug("\ni 3d5 => %x", reg);
 	}
-	/*
-	xgifb_reg_set(XGIPART1,0x2F,1);
-	for (i=1; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART1, i);
-		pr_debug("\no d004 %x", i);
-		pr_debug("\ni d005 => %x", reg);
-	}
-
-	for (i=0; i < 0x50; i++) {
-		 reg = xgifb_reg_get(XGIPART2, i);
-		 pr_debug("\no d010 %x", i);
-		 pr_debug("\ni d011 => %x", reg);
-	}
-	for (i=0; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART3, i);
-		pr_debug("\no d012 %x",i);
-		pr_debug("\ni d013 => %x",reg);
-	}
-	for (i=0; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART4, i);
-		pr_debug("\no d014 %x",i);
-		pr_debug("\ni d015 => %x",reg);
-	}
-	*/
 }
 #else
 static inline void dumpVGAReg(void)
@@ -215,15 +155,6 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
 			| ((unsigned short) (sr_data & 0x01) << 10);
 	A = VT + 2;
 
-	/* cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10]; */
-
-	/* Vertical display enable end */
-	/*
-	VDE = (cr_data & 0xff) |
-		((unsigned short) (cr_data2 & 0x02) << 7) |
-		((unsigned short) (cr_data2 & 0x40) << 3) |
-		((unsigned short) (sr_data & 0x02) << 9);
-	*/
 	VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes - 1;
 	E = VDE + 1;
 
@@ -590,7 +521,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
 				if (XGIbios_mode[myindex].yres != 576)
 					return -1;
 			}
-			/*  TW: LVDS/CHRONTEL does not support 720 */
+			/* LVDS/CHRONTEL does not support 720 */
 			if (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL ||
 			    xgifb_info->hasVB == HASVB_CHRONTEL) {
 				return -1;
@@ -794,26 +725,21 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
 {
 	u8 reg;
 	unsigned char doit = 1;
-	/*
-	xgifb_reg_set(XGISR,IND_SIS_PASSWORD,SIS_PASSWORD);
-	xgifb_reg_set(XGICR, 0x13, 0x00);
-	xgifb_reg_and_or(XGISR,0x0E, 0xF0, 0x01);
-	*test*
-	*/
+
 	if (xgifb_info->video_bpp == 8) {
-		/* TW: We can't switch off CRT1 on LVDS/Chrontel
+		/* We can't switch off CRT1 on LVDS/Chrontel
 		 * in 8bpp Modes */
 		if ((xgifb_info->hasVB == HASVB_LVDS) ||
 		    (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
 			doit = 0;
 		}
-		/* TW: We can't switch off CRT1 on 301B-DH
+		/* We can't switch off CRT1 on 301B-DH
 		 * in 8bpp Modes if using LCD */
 		if (xgifb_info->display2 == XGIFB_DISP_LCD)
 			doit = 0;
 	}
 
-	/* TW: We can't switch off CRT1 if bridge is in slave mode */
+	/* We can't switch off CRT1 if bridge is in slave mode */
 	if (xgifb_info->hasVB != HASVB_NONE) {
 		reg = xgifb_reg_get(XGIPART1, 0x00);
 
@@ -1038,7 +964,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
 	int old_mode;
-	/* unsigned char reg, reg1; */
 
 	info->var.xres_virtual = var->xres_virtual;
 	info->var.yres_virtual = var->yres_virtual;
@@ -1049,8 +974,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
 		vtotal <<= 2;
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
-		/* vtotal <<= 1; */
-		/* var->yres <<= 1; */
 	}
 
 	if (!htotal || !vtotal) {
@@ -1388,16 +1311,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		xgifb_info->refresh_rate = 60;
 	}
 
-	/*
-	if ((var->pixclock) && (htotal)) {
-		drate = 1E12 / var->pixclock;
-		hrate = drate / htotal;
-		refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
-	} else {
-		refresh_rate = 60;
-	}
-	*/
-	/* TW: Calculation wrong for 1024x600 - force it to 60Hz */
+	/* Calculation wrong for 1024x600 - force it to 60Hz */
 	if ((var->xres == 1024) && (var->yres == 600))
 		refresh_rate = 60;
 
@@ -1446,8 +1360,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		}
 	}
 
-	/* TW: TODO: Check the refresh rate */
-
 	/* Adapt RGB settings */
 	XGIfb_bpp_to_var(xgifb_info, var);
 
@@ -1462,16 +1374,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 			var->xres_virtual = var->xres;
 		if (var->yres != var->yres_virtual)
 			var->yres_virtual = var->yres;
-	} /* else { */
-		/* TW: Now patch yres_virtual if we use panning */
-		/* May I do this? */
-		/* var->yres_virtual = xgifb_info->heapstart /
-			(var->xres * (var->bits_per_pixel >> 3)); */
-		/* if (var->yres_virtual <= var->yres) { */
-		/* TW: Paranoia check */
-		/* var->yres_virtual = var->yres; */
-		/* } */
-	/* } */
+	}
 
 	/* Truncate offsets to maximum if too high */
 	if (var->xoffset > var->xres_virtual - var->xres)
@@ -1553,7 +1456,6 @@ static struct fb_ops XGIfb_ops = {
 	.fb_fillrect = cfb_fillrect,
 	.fb_copyarea = cfb_copyarea,
 	.fb_imageblit = cfb_imageblit,
-	/* .fb_mmap = XGIfb_mmap, */
 };
 
 /* ---------------- Chip generation dependent routines ---------------- */
@@ -1630,9 +1532,6 @@ static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info)
 	}
 
 	xgifb_info->video_size = xgifb_info->video_size * ChannelNum;
-	/* PLiad fixed for benchmarking and fb set */
-	/* xgifb_info->video_size = 0x200000; */ /* 1024x768x16 */
-	/* xgifb_info->video_size = 0x1000000; */ /* benchmark */
 
 	pr_info("SR14=%x DramSzie %x ChannelNum %x\n",
 	       reg,
@@ -1680,7 +1579,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 	}
 
 	if (XGIfb_tvplug != -1)
-		/* PR/TW: Override with option */
+		/* Override with option */
 		xgifb_info->TV_plug = XGIfb_tvplug;
 	else if (cr32 & SIS_VB_HIVISION) {
 		xgifb_info->TV_type = TVMODE_HIVISION;
@@ -1700,7 +1599,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 			xgifb_info->TV_type = TVMODE_NTSC;
 	}
 
-	/* TW: Copy forceCRT1 option to CRT1off if option is given */
+	/* Copy forceCRT1 option to CRT1off if option is given */
 	if (XGIfb_forcecrt1 != -1) {
 		if (XGIfb_forcecrt1)
 			XGIfb_crt1off = 0;
@@ -1794,7 +1693,7 @@ static int __init XGIfb_setup(char *options)
 			XGIfb_search_tvstd(this_opt + 7);
 		} else if (!strncmp(this_opt, "dstn", 4)) {
 			enable_dstn = 1;
-			/* TW: DSTN overrules forcecrt2type */
+			/* DSTN overrules forcecrt2type */
 			XGIfb_crt2type = XGIFB_DISP_LCD;
 		} else if (!strncmp(this_opt, "noypan", 6)) {
 			XGIfb_ypan = 0;
@@ -1981,13 +1880,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 			dev_info(&pdev->dev,
 				 "XGI301LV bridge detected (revision 0x%02x)\n",
 				 reg);
-		}
-		/* else if (reg >= 0xB0) {
-			hw_info->ujVBChipID = VB_CHIP_301B;
-			reg1 = xgifb_reg_get(XGIPART4, 0x23);
-			pr_debug("XGIfb: XGI301B bridge detected\n");
-		} */
-		else {
+		} else {
 			hw_info->ujVBChipID = VB_CHIP_301;
 			dev_info(&pdev->dev, "XGI301 bridge detected\n");
 		}
@@ -2104,7 +1997,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		goto error_1;
 	}
 
-	/* yilin set default refresh rate */
+	/* set default refresh rate */
 	xgifb_info->refresh_rate = refresh_rate;
 	if (xgifb_info->refresh_rate == 0)
 		xgifb_info->refresh_rate = 60;
diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h
index 741bba3..8054798 100644
--- a/drivers/staging/xgifb/XGIfb.h
+++ b/drivers/staging/xgifb/XGIfb.h
@@ -30,13 +30,13 @@ enum xgi_tvtype {
 	TVMODE_NTSC = 0,
 	TVMODE_PAL,
 	TVMODE_HIVISION,
-	TVTYPE_PALM,	/* vicki@030226 */
-	TVTYPE_PALN,	/* vicki@030226 */
-	TVTYPE_NTSCJ,	/* vicki@030226 */
+	TVTYPE_PALM,
+	TVTYPE_PALN,
+	TVTYPE_NTSCJ,
 	TVMODE_TOTAL
 };
 
-enum xgi_tv_plug { /* vicki@030226 */
+enum xgi_tv_plug {
 	TVPLUG_UNKNOWN = 0,
 	TVPLUG_COMPOSITE = 1,
 	TVPLUG_SVIDEO = 2,
diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h
index 5b987a6..69078d9 100644
--- a/drivers/staging/xgifb/vb_def.h
+++ b/drivers/staging/xgifb/vb_def.h
@@ -1,5 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/initdef.h
- * ,v 1.4 2000/12/02 01:16:17 dawes Exp $*/
 #ifndef _VB_DEF_
 #define _VB_DEF_
 #include "../../video/sis/initdef.h"
@@ -12,7 +10,6 @@
 #define SetCHTVOverScan         0x8000
 
 #define Panel_320x480            0x07 /*fstn*/
-/* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
 #define PanelResInfo            0x1F /* CR36 Panel Type/LCDResInfo */
 #define Panel_1024x768x75        0x22
 #define Panel_1280x1024x75       0x23
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 7c555a7..6bb0206 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1,4 +1,4 @@
-#include <linux/delay.h> /* udelay */
+#include <linux/delay.h>
 #include <linux/vmalloc.h>
 
 #include "XGIfb.h"
@@ -132,10 +132,8 @@ static void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension,
 		      0x30,
 		      pVBInfo->ECLKData[pVBInfo->ram_type].SR30);
 
-	/* [Vicent] 2004/07/07,
-	 * When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
-	/* [Hsuan] 2004/08/20,
-	 * Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
+	/* When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
+	/* Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
 	 * Set SR32 D[1:0] = 10b */
 	if (HwDeviceExtension->jChipType == XG42) {
 		if ((pVBInfo->MCLKData[pVBInfo->ram_type].SR28 == 0x1C) &&
@@ -160,7 +158,6 @@ static void XGINew_DDRII_Bootup_XG27(
 	XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
 
 	/* Set Double Frequency */
-	/* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */
 	xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */
 
 	udelay(200);
@@ -192,7 +189,6 @@ static void XGINew_DDRII_Bootup_XG27(
 	udelay(30);
 	xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
 	xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */
-	/* udelay(15); */
 
 	xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */
 	udelay(60);
@@ -252,7 +248,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(P3c4, 0x16, 0x05);
 	xgifb_reg_set(P3c4, 0x16, 0x85);
 
-	/* xgifb_reg_set(P3c4, 0x18, 0x52); */ /* MRS1 */
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x02);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
@@ -264,7 +259,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */
 	udelay(100);
 
-	/* xgifb_reg_set(P3c4 ,0x18, 0x52); */ /* MRS2 */
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
@@ -290,14 +284,12 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4,
 	xgifb_reg_set(P3c4,
 		      0x18,
 		      pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */
-	/* xgifb_reg_set(P3c4, 0x18, 0x31); */
 	xgifb_reg_set(P3c4, 0x19, 0x01);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
 	xgifb_reg_set(P3c4, 0x16, 0x83);
 	mdelay(1);
 	xgifb_reg_set(P3c4, 0x1B, 0x03);
 	udelay(500);
-	/* xgifb_reg_set(P3c4, 0x18, 0x31); */
 	xgifb_reg_set(P3c4,
 		      0x18,
 		      pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */
@@ -546,7 +538,6 @@ static void XGINew_SetDRAMDefaultRegister340(
 	xgifb_reg_set(P3d4, 0x87, 0x00); /* CR87 */
 	xgifb_reg_set(P3d4, 0xCF, XG40_CRCF); /* CRCF */
 	if (pVBInfo->ram_type) {
-		/* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
 		xgifb_reg_set(P3c4, 0x17, 0x80); /* SR17 DDRII */
 		if (HwDeviceExtension->jChipType == XG27)
 			xgifb_reg_set(P3c4, 0x17, 0x02); /* SR17 DDRII */
@@ -597,19 +588,12 @@ static unsigned short XGINew_SetDRAMSize20Reg(
 
 		memsize = data >> 4;
 
-		/* [2004/03/25] Vicent, Fix DRAM Sizing Error */
+		/* Fix DRAM Sizing Error */
 		xgifb_reg_set(pVBInfo->P3c4,
 			      0x14,
 			      (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) |
 				(data & 0xF0));
 		udelay(15);
-
-		/* data |= pVBInfo->ram_channel << 2; */
-		/* data |= (pVBInfo->ram_bus / 64) << 1; */
-		/* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
-
-		/* should delay */
-		/* XGINew_SetDRAMModeRegister340(pVBInfo); */
 	}
 	return memsize;
 }
@@ -628,8 +612,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr,
 		writel(Position, fbaddr + Position);
 	}
 
-	udelay(500); /* [Vicent] 2004/04/16.
-			Fix #1759 Memory Size error in Multi-Adapter. */
+	udelay(500); /* Fix #1759 Memory Size error in Multi-Adapter. */
 
 	Position = 0;
 
@@ -925,9 +908,6 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info,
 	xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF));
 	XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
 
-	/* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */
-	/* data |= 0x20 ; */
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */
 	XGINew_DDRSizing340(HwDeviceExtension, pVBInfo);
 	data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
 	/* enable read cache */
@@ -1308,16 +1288,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	struct vb_device_info VBINF;
 	struct vb_device_info *pVBInfo = &VBINF;
 	unsigned char i, temp = 0, temp1;
-	/* VBIOSVersion[5]; */
-
-	/* unsigned long j, k; */
 
 	pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
 
 	pVBInfo->BaseAddr = xgifb_info->vga_base;
 
-	/* Newdebugcode(0x99); */
-
 	if (pVBInfo->FBAddr == NULL) {
 		dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n");
 		return 0;
@@ -1331,10 +1306,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	pVBInfo->ISXPDOS = 0;
 
-	/* VBIOSVersion[4] = 0x0; */
-
-	/* 09/07/99 modify by domao */
-
 	pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
 	pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
 	pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
@@ -1353,7 +1324,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	pVBInfo->Part4Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14;
 	pVBInfo->Part5Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14 + 2;
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20)
 		/* Run XGI_GetVBType before InitTo330Pointer */
 		XGI_GetVBType(pVBInfo);
 
@@ -1361,7 +1332,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	xgifb_read_vbios(pdev, pVBInfo);
 
-	/* 1.Openkey */
+	/* Openkey */
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
 	/* GetXG21Sense (GPIO) */
@@ -1371,7 +1342,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	if (HwDeviceExtension->jChipType == XG27)
 		XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo);
 
-	/* 2.Reset Extended register */
+	/* Reset Extended register */
 
 	for (i = 0x06; i < 0x20; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
@@ -1379,31 +1350,20 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	for (i = 0x21; i <= 0x27; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
 
-	/* for(i = 0x06; i <= 0x27; i++) */
-	/* xgifb_reg_set(pVBInfo->P3c4, i, 0); */
-
 	for (i = 0x31; i <= 0x3B; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
 
-	/* [Hsuan] 2004/08/20 Auto over driver for XG42 */
+	/* Auto over driver for XG42 */
 	if (HwDeviceExtension->jChipType == XG42)
 		xgifb_reg_set(pVBInfo->P3c4, 0x3B, 0xC0);
 
-	/* for (i = 0x30; i <= 0x3F; i++) */
-	/* xgifb_reg_set(pVBInfo->P3d4, i, 0); */
-
 	for (i = 0x79; i <= 0x7C; i++)
-		xgifb_reg_set(pVBInfo->P3d4, i, 0); /* shampoo 0208 */
+		xgifb_reg_set(pVBInfo->P3d4, i, 0);
 
 	if (HwDeviceExtension->jChipType >= XG20)
 		xgifb_reg_set(pVBInfo->P3d4, 0x97, pVBInfo->XGINew_CR97);
 
-	/* 3.SetMemoryClock
-
-	pVBInfo->ram_type = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
-	*/
-
-	/* 4.SetDefExt1Regs begin */
+	/* SetDefExt1Regs begin */
 	xgifb_reg_set(pVBInfo->P3c4, 0x07, XGI330_SR07);
 	if (HwDeviceExtension->jChipType == XG27) {
 		xgifb_reg_set(pVBInfo->P3c4, 0x40, XG27_SR40);
@@ -1411,62 +1371,16 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	}
 	xgifb_reg_set(pVBInfo->P3c4, 0x11, 0x0F);
 	xgifb_reg_set(pVBInfo->P3c4, 0x1F, XGI330_SR1F);
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */
-	/* alan, 2001/6/26 Frame buffer can read/write SR20 */
+	/* Frame buffer can read/write SR20 */
 	xgifb_reg_set(pVBInfo->P3c4, 0x20, 0xA0);
-	/* Hsuan, 2006/01/01 H/W request for slow corner chip */
+	/* H/W request for slow corner chip */
 	xgifb_reg_set(pVBInfo->P3c4, 0x36, 0x70);
-	if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */
+	if (HwDeviceExtension->jChipType == XG27)
 		xgifb_reg_set(pVBInfo->P3c4, 0x36, XG27_SR36);
 
-	/* SR11 = 0x0F; */
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */
-
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		u32 Temp;
 
-		/* Set AGP Rate */
-		/*
-		temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
-		temp1 &= 0x02;
-		if (temp1 == 0x02) {
-			outl(0x80000000, 0xcf8);
-			ChipsetID = inl(0x0cfc);
-			outl(0x8000002C, 0xcf8);
-			VendorID = inl(0x0cfc);
-			VendorID &= 0x0000FFFF;
-			outl(0x8001002C, 0xcf8);
-			GraphicVendorID = inl(0x0cfc);
-			GraphicVendorID &= 0x0000FFFF;
-
-			if (ChipsetID == 0x7301039)
-				xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x09);
-
-			ChipsetID &= 0x0000FFFF;
-
-			if ((ChipsetID == 0x700E) ||
-			    (ChipsetID == 0x1022) ||
-			    (ChipsetID == 0x1106) ||
-			    (ChipsetID == 0x10DE)) {
-				if (ChipsetID == 0x1106) {
-					if ((VendorID == 0x1019) &&
-					    (GraphicVendorID == 0x1019))
-						xgifb_reg_set(pVBInfo->P3d4,
-							      0x5F,
-							      0x0D);
-					else
-						xgifb_reg_set(pVBInfo->P3d4,
-							      0x5F,
-							      0x0B);
-				} else {
-					xgifb_reg_set(pVBInfo->P3d4,
-						      0x5F,
-						      0x0B);
-				}
-			}
-		}
-		*/
-
 		/* Set AGP customize registers (in SetDefAGPRegs) Start */
 		for (i = 0x47; i <= 0x4C; i++)
 			xgifb_reg_set(pVBInfo->P3d4,
@@ -1482,12 +1396,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 			xgifb_reg_set(pVBInfo->P3d4,
 				      i,
 				      pVBInfo->AGPReg[8 + i - 0x74]);
-		/* Set AGP customize registers (in SetDefAGPRegs) End */
-		/* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */
-		/*        outl(0x80000000, 0xcf8); */
-		/*        ChipsetID = inl(0x0cfc); */
-		/*        if (ChipsetID == 0x25308086) */
-		/*            xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */
 
 		pci_read_config_dword(pdev, 0x50, &Temp);
 		Temp >>= 20;
@@ -1502,10 +1410,10 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	xgifb_reg_set(pVBInfo->P3c4, 0x24, XGI330_SR24);
 	xgifb_reg_set(pVBInfo->P3c4, 0x25, XGI330_SR25);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		/* Set VB */
 		XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
-		/* alan, disable VideoCapture */
+		/* disable VideoCapture */
 		xgifb_reg_and_or(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00);
 		xgifb_reg_set(pVBInfo->Part1Port, 0x00, 0x00);
 		/* chk if BCLK>=100MHz */
@@ -1535,10 +1443,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	}
 	xgifb_reg_set(pVBInfo->P3c4, 0x33, XGI330_SR33);
 
-	/*
-	 SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4);	*/
-
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		if (XGI_BridgeIsOn(pVBInfo) == 1) {
 			if (pVBInfo->IF_DEF_LVDS == 0) {
 				xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C);
@@ -1557,7 +1462,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	XGI_SenseCRT1(pVBInfo);
 
-	/* XGINew_DetectMonitor(HwDeviceExtension); */
 	if (HwDeviceExtension->jChipType == XG21) {
 
 		xgifb_reg_and_or(pVBInfo->P3d4,
@@ -1585,32 +1489,9 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo);
 
-	/* SetDefExt2Regs begin */
-	/*
-	AGP = 1;
-	temp = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x3A);
-	temp &= 0x30;
-	if (temp == 0x30)
-		AGP = 0;
-
-	if (AGP == 0)
-		pVBInfo->SR21 &= 0xEF;
-
-	xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21);
-	if (AGP == 1)
-		pVBInfo->SR22 &= 0x20;
-	xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22);
-	*/
-	/* base = 0x80000000; */
-	/* OutPortLong(0xcf8, base); */
-	/* Temp = (InPortLong(0xcfc) & 0xFFFF); */
-	/* if (Temp == 0x1039) { */
 	xgifb_reg_set(pVBInfo->P3c4,
 		      0x22,
 		      (unsigned char) ((pVBInfo->SR22) & 0xFE));
-	/* } else { */
-	/*	xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); */
-	/* } */
 
 	xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21);
 
diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h
index a27b4fe..be5589c 100644
--- a/drivers/staging/xgifb/vb_init.h
+++ b/drivers/staging/xgifb/vb_init.h
@@ -3,4 +3,3 @@
 extern unsigned char XGIInitNew(struct pci_dev *pdev);
 extern struct XGI21_LVDSCapStruct  XGI21_LCDCapList[13];
 #endif
-
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 479362e..3ba3c48 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -1859,7 +1859,6 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
 		i++;
 	}
 
-	/* 07/05/22 */
 	if (table == 0x04) {
 		switch (tempdi[i].DATAPTR) {
 		case 0:
@@ -2519,7 +2518,7 @@ static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
 		temp &= 0x0f;
 
 		if (!(temp == 0x08)) {
-			/* Check ChannelA by Part1_13 [2003/10/03] */
+			/* Check ChannelA */
 			tempax = xgifb_reg_get(pVBInfo->Part1Port, 0x13);
 			if (tempax & 0x04)
 				tempcl = tempcl | ActiveLCD;
@@ -2675,7 +2674,6 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
 		}
 
 		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			/* [Billy] 07/05/04 */
 			if (((pVBInfo->IF_DEF_LVDS == 0) &&
 			    ((pVBInfo->VBType & VB_SIS301LV) ||
 			    (pVBInfo->VBType & VB_SIS302LV) ||
@@ -2927,7 +2925,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
 	if (tempbx == 0)
 		tempbx = Panel_1024x768; /* default */
 
-	/* LCD75 [2003/8/22] Vicent */
+	/* LCD75 */
 	if ((tempbx == Panel_1024x768) || (tempbx == Panel_1280x1024)) {
 		if (pVBInfo->VBInfo & DriverMode) {
 			tempax = xgifb_reg_get(pVBInfo->P3d4, 0x33);
@@ -4591,7 +4589,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
 		}
 	}
 
-	/* [ycchen] 01/14/03 Modify for 301C PALM Support */
+	/* Modify for 301C PALM Support */
 	if (pVBInfo->VBType & VB_XGI301C) {
 		if (pVBInfo->TVInfo & TVSetPALM)
 			xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08,
@@ -6245,8 +6243,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
 		    (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 600)) {
 			index++;
 		}
-		/* Alan 10/19/2007;
-		 * do the similar adjustment like XGISearchCRT1Rate() */
+		/* do the similar adjustment like XGISearchCRT1Rate() */
 		if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024) &&
 		    (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 768)) {
 			index++;
@@ -6354,7 +6351,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	int i;
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
-	/* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
+	/* to fix XG42 single LCD sense to CRT+LCD */
 	xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A);
 	xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
 			pVBInfo->P3d4, 0x53) | 0x02));
@@ -6419,7 +6416,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	else
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
 
-	/* alan, avoid display something, set BLACK DAC if not restore DAC */
+	/* avoid display something, set BLACK DAC if not restore DAC */
 	outb(0x00, pVBInfo->P3c8);
 
 	for (i = 0; i < 256; i++) {
@@ -6432,7 +6429,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
 	xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31);
 
-	/* [2004/05/11] Vicent */
 	xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
 			pVBInfo->P3d4, 0x53) & 0xFD));
 	xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
@@ -6653,7 +6649,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 	pVBInfo->IF_DEF_LVDS = 0;
 	pVBInfo->IF_DEF_LCDA = 1;
 
-	if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType >= XG20) {
 		pVBInfo->IF_DEF_YPbPr = 0;
 		pVBInfo->IF_DEF_HiVision = 0;
 		pVBInfo->IF_DEF_CRT2Monitor = 0;
@@ -6695,7 +6691,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 		}
 	}
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_GetVBType(pVBInfo);
 
 	InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
@@ -6703,12 +6699,12 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 		ModeNo = ModeNo & 0x7F;
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
 
 	XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
 		XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
 		XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -6779,7 +6775,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 
 	XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		XGI_LockCRT2(HwDeviceExtension, pVBInfo);
 	}
 
diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h
index aea760a..22c8eb9 100644
--- a/drivers/staging/xgifb/vb_struct.h
+++ b/drivers/staging/xgifb/vb_struct.h
@@ -28,7 +28,6 @@ struct XGI_Ext2Struct {
 	unsigned char  ModeID;
 	unsigned short XRes;
 	unsigned short YRes;
-	/* unsigned short ROM_OFFSET; */
 };
 
 struct XGI_ECLKDataStruct {
@@ -167,7 +166,6 @@ struct vb_device_info {
 	unsigned short   LCDHRS, LCDVRS, LCDHDES, LCDVDES;
 
 	unsigned short   ModeType;
-	/* ,IF_DEF_FSTN; add for dstn */
 	unsigned short   IF_DEF_LVDS, IF_DEF_TRUMPION, IF_DEF_DSTN;
 	unsigned short   IF_DEF_CRT2Monitor;
 	unsigned short   IF_DEF_LCDA, IF_DEF_YPbPr;
@@ -225,7 +223,6 @@ struct vb_device_info {
 	struct SiS_StandTable_S  *StandTable;
 	struct XGI_ExtStruct         *EModeIDTable;
 	struct XGI_Ext2Struct        *RefIndex;
-	/* XGINew_CRT1TableStruct *CRT1Table; */
 	struct XGI_CRT1TableStruct    *XGINEWUB_CRT1Table;
 	struct SiS_VCLKData    *VCLKData;
 	struct SiS_VBVCLKData  *VBVCLKData;
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 75da7c3..ca8c68d 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1,6 +1,5 @@
 #ifndef _VB_TABLE_
 #define _VB_TABLE_
-/* yilin modify for xgi20 */
 static struct SiS_MCLKData XGI340New_MCLKData[] = {
 	{0x16, 0x01, 0x01, 166},
 	{0x19, 0x02, 0x01, 124},
@@ -23,7 +22,6 @@ static struct SiS_MCLKData XGI27New_MCLKData[] = {
 	{0x5c, 0x23, 0x01, 166}
 };
 
-/* yilin modify for xgi20 */
 static struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
 	{0x5c, 0x23, 0x01, 166},
 	{0x55, 0x84, 0x01, 123},
@@ -424,13 +422,9 @@ static struct SiS_LCDData  XGI_StLCD1024x768Data[] = {
 };
 
 static struct SiS_LCDData  XGI_ExtLCD1024x768Data[] = {
-	/* { 12, 5, 896, 512,1344, 806}, // alan 09/12/2003 */
 	{42, 25, 1536, 419, 1344, 806},
-	/* { 12, 5, 896, 510,1344, 806}, // alan 09/12/2003 */
 	{48, 25, 1536, 369, 1344, 806},
-	/* { 32, 15,1008, 505,1344, 806}, // alan 09/12/2003 */
 	{42, 25, 1536, 419, 1344, 806},
-	/* { 32, 15,1008, 514,1344, 806}, // alan 09/12/2003 */
 	{48, 25, 1536, 369, 1344, 806},
 	{12, 5,  896,  500, 1344, 806},
 	{42, 25, 1024, 625, 1344, 806},
@@ -504,14 +498,10 @@ static struct SiS_LCDData xgifb_lcd_1400x1050[] = {
 };
 
 static struct SiS_LCDData  XGI_ExtLCD1600x1200Data[] = {
-	{4,  1,  1620, 420,  2160, 1250}, /* { 3,1,2160,425,2160,1250 },
-					  // 00 (320x200,320x400,
-					  //	 640x200,640x400)
-					  //	 // alan 10/14/2003 */
+	{4,  1,  1620, 420,  2160, 1250}, /* 00 (320x200,320x400,
+						 640x200,640x400)*/
 	{27, 7,  1920, 375,  2160, 1250}, /* 01 (320x350,640x350) */
-	{4,  1,  1620, 420,  2160, 1250}, /* { 3,1,2160,425,2160,1250 },
-					  // 02 (360x400,720x400)
-					  // // alan 10/14/2003 */
+	{4,  1,  1620, 420,  2160, 1250}, /* 02 (360x400,720x400)*/
 	{27, 7,  1920, 375,  2160, 1250}, /* 03 (720x350) */
 	{27, 4,  800,  500,  2160, 1250}, /* 04 (640x480x60Hz) */
 	{4,  1,  1080, 625,  2160, 1250}, /* 05 (800x600x60Hz) */
@@ -615,8 +605,7 @@ static struct SiS_LCDData  XGI_NoScalingDatax75[] = {
 	{1, 1, 1056, 625,  1056, 625},  /* ; 05 (800x600x75Hz) */
 	{1, 1, 1312, 800,  1312, 800},  /* ; 06 (1024x768x75Hz) */
 	{1, 1, 1688, 1066, 1688, 1066}, /* ; 07 (1280x1024x75Hz) */
-	{1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz)
-					   ;;[ycchen] 12/19/02 */
+	{1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz)*/
 	{1, 1, 2160, 1250, 2160, 1250}, /* ; 09 (1600x1200x75Hz) */
 	{1, 1, 1688, 806,  1688, 806}   /* ; 0A (1280x768x75Hz) */
 };
@@ -823,8 +812,7 @@ static struct XGI330_LCDDataDesStruct2  XGI_NoScalingDesData[] = {
 	{9, 849,  627, 600,  128,  4}, /* 05 (800x600x60Hz) */
 	{9, 1057, 805, 770,  0136, 6}, /* 06 (1024x768x60Hz) */
 	{9, 1337, 0,   1025, 112,  3}, /* 07 (1280x1024x60Hz) */
-	{9, 1457, 0,   1051, 112,  3}, /* 08 (1400x1050x60Hz) },
-					//;[ycchen] 12/19/02 */
+	{9, 1457, 0,   1051, 112,  3}, /* 08 (1400x1050x60Hz)*/
 	{9, 1673, 0,   1201, 192,  3}, /* 09 (1600x1200x60Hz) */
 	{9, 1337, 0,   771,  112,  6}  /* 0A (1280x768x60Hz) */
 };
@@ -910,8 +898,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] =  {
 	{9, 825,  0,   601,  80,  3}, /* ; 05 (800x600x75Hz) */
 	{9, 1049, 0,   769,  96,  3}, /* ; 06 (1024x768x75Hz) */
 	{9, 1305, 0,   1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */
-	{9, 1457, 0,   1051, 112, 3}, /* ; 08 (1400x1050x60Hz)
-					 ;;[ycchen] 12/19/02 */
+	{9, 1457, 0,   1051, 112, 3}, /* ; 08 (1400x1050x60Hz)*/
 	{9, 1673, 0,   1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */
 	{9, 1337, 0,   771,  112, 6}  /* ; 0A (1280x768x60Hz) */
 };
@@ -1308,7 +1295,7 @@ static struct SiS_LVDSData XGI_LVDSNoScalingData[] = {
 	{1056,  628, 1056,  628}, /* 05 (800x600x60Hz) */
 	{1344,  806, 1344,  806}, /* 06 (1024x768x60Hz) */
 	{1688, 1066, 1688, 1066}, /* 07 (1280x1024x60Hz) */
-	{1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) ;;[ycchen] 12/19/02 */
+	{1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) */
 	{2160, 1250, 2160, 1250}, /* 09 (1600x1200x60Hz) */
 	{1688,  806, 1688,  806}  /* 0A (1280x768x60Hz) */
 };
@@ -1469,8 +1456,7 @@ static struct XGI330_LCDDataDesStruct2  XGI_LVDSNoScalingDesData[] = {
 	{0,  840,  627,  600, 128, 4}, /* 05 (800x600x60Hz) */
 	{0, 1048,  805,  770, 136, 6}, /* 06 (1024x768x60Hz) */
 	{0, 1328,    0, 1025, 112, 3}, /* 07 (1280x1024x60Hz) */
-	{0, 1438,    0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)
-					;;[ycchen] 12/19/02 */
+	{0, 1438,    0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)*/
 	{0, 1664,    0, 1201, 192, 3}, /* 09 (1600x1200x60Hz) */
 	{0, 1328,    0, 0771, 112, 6}  /* 0A (1280x768x60Hz) */
 };
@@ -1518,7 +1504,7 @@ static struct SiS_LVDSData XGI_LVDS1280x1024Des_1x75[] = {
 };
 
 /* The Display setting for DE Mode Panel */
-/* [ycchen] 02/18/03 Set DE as default */
+/* Set DE as default */
 static struct SiS_LVDSData XGI_LVDS1280x1024Des_2x75[] = {
 	{1368,  976, 752,  711}, /* ; 00 (320x200,320x400,640x200,640x400) */
 	{1368,  976, 729,  688}, /* ; 01 (320x350,640x350) */
@@ -1541,8 +1527,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = {
 	{0,  816,   0,  601,  80, 3}, /* ; 05 (800x600x75Hz) */
 	{0, 1040,   0,  769,  96, 3}, /* ; 06 (1024x768x75Hz) */
 	{0, 1296,   0, 1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */
-	{0, 1448,   0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz)
-					 ;;[ycchen] 12/19/02 */
+	{0, 1448,   0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz) */
 	{0, 1664,   0, 1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */
 	{0, 1328,   0,  771, 112, 6}  /* ; 0A (1280x768x75Hz) */
 };
diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h
index 9161de1..ff40247 100644
--- a/drivers/staging/xgifb/vb_util.h
+++ b/drivers/staging/xgifb/vb_util.h
@@ -6,4 +6,3 @@ extern void xgifb_reg_or(unsigned long, u8, unsigned);
 extern void xgifb_reg_and(unsigned long, u8, unsigned);
 extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned);
 #endif
-
diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 7fc0719..839acb40 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -79,7 +79,4 @@ struct xgi_hw_device_info {
 	unsigned long ulCRT2LCDType; /* defined in the data structure type */
 };
 
-/* Additional IOCTL for communication xgifb <> X driver        */
-/* If changing this, xgifb.h must also be changed (for xgifb) */
 #endif
-
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 02/19] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 03/19] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

LCD_TYPEs are taken from drivers/video/sis/sis.h, so this enumeration is not
needed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vgatypes.h |   34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 839acb40..cfd421c 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -21,40 +21,6 @@ enum XGI_VB_CHIP_TYPE {
 };
 #endif
 
-
-#define XGI_LCD_TYPE
-/* Since the merge with video/sis the LCD_TYPEs are used from
- drivers/video/sis/sis.h . Nevertheless we keep this (for the moment) for
- future reference until the code is merged completely and we are sure
- nothing of this should be added to the sis.h header */
-#ifndef XGI_LCD_TYPE
-enum XGI_LCD_TYPE {
-	LCD_INVALID = 0,
-	LCD_320x480,       /* FSTN, DSTN */
-	LCD_640x480,
-	LCD_640x480_2,     /* FSTN, DSTN */
-	LCD_640x480_3,     /* FSTN, DSTN */
-	LCD_800x600,
-	LCD_848x480,
-	LCD_1024x600,
-	LCD_1024x768,
-	LCD_1152x768,
-	LCD_1152x864,
-	LCD_1280x720,
-	LCD_1280x768,
-	LCD_1280x800,
-	LCD_1280x960,
-	LCD_1280x1024,
-	LCD_1400x1050,
-	LCD_1600x1200,
-	LCD_1680x1050,
-	LCD_1920x1440,
-	LCD_2048x1536,
-	LCD_CUSTOM,
-	LCD_UNKNOWN
-};
-#endif
-
 struct xgi_hw_device_info {
 	unsigned long ulExternalChip; /* NO VB or other video bridge*/
 				      /* if ujVBChipID = VB_CHIP_UNKNOWN, */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 03/19] Staging: xgifb: Remove LCDA detection in xgifb_probe().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
  2012-07-05 14:45 ` [PATCH 02/19] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 04/19] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

The piece of code that checks for LCDA in xgifb_probe() just checks for some
register values but doesn't really do anything in response to them (the actions
that should be executed are commented).
As nothing is really being done, the code can be safely removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 511890b..b3e8983 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1942,36 +1942,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		}
 	}
 
-	if ((hw_info->ujVBChipID == VB_CHIP_302B) ||
-			(hw_info->ujVBChipID == VB_CHIP_301LV) ||
-			(hw_info->ujVBChipID == VB_CHIP_302LV)) {
-		int tmp;
-		tmp = xgifb_reg_get(XGICR, 0x34);
-		if (tmp <= 0x13) {
-			/* Currently on LCDA?
-			 *(Some BIOSes leave CR38) */
-			tmp = xgifb_reg_get(XGICR, 0x38);
-			if ((tmp & 0x03) == 0x03) {
-				/* XGI_Pr.XGI_UseLCDA = 1; */
-			} else {
-				/* Currently on LCDA?
-				 *(Some newer BIOSes set D0 in CR35) */
-				tmp = xgifb_reg_get(XGICR, 0x35);
-				if (tmp & 0x01) {
-					/* XGI_Pr.XGI_UseLCDA = 1; */
-				} else {
-					tmp = xgifb_reg_get(XGICR,
-							    0x30);
-					if (tmp & 0x20) {
-						tmp = xgifb_reg_get(
-							XGIPART1, 0x13);
-					}
-				}
-			}
-		}
-
-	}
-
 	xgifb_info->mode_idx = -1;
 
 	if (mode)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 04/19] Staging: xgifb: Remove unused struct _chswtable.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (2 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 03/19] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 05/19] Staging: xgifb: Improve debug strings Miguel Gómez
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Struct _chswtable and the variable mychswtable are not used anywhere, so remove
them.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main.h |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index 1686c5a..c033da4 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -227,16 +227,6 @@ static const struct _XGI_vrate {
 	{0, 0, 0, 0}
 };
 
-static const struct _chswtable {
-	int subsysVendor;
-	int subsysCard;
-	char *vendorName;
-	char *cardName;
-} mychswtable[] = {
-	{ 0x1631, 0x1002, "Mitachi", "0x1002" },
-	{ 0,      0,      ""       , ""       }
-};
-
 static const struct _XGI_TV_filter {
 	u8 filter[9][4];
 } XGI_TV_filter[] = {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 05/19] Staging: xgifb: Improve debug strings.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (3 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 04/19] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 17:42   ` Aaro Koskinen
  2012-07-05 14:45 ` [PATCH 06/19] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
                   ` (14 subsequent siblings)
  19 siblings, 1 reply; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   34 +++++++++++++++++-----------------
 drivers/staging/xgifb/vb_init.c     |    4 ++--
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index b3e8983..818e248 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -33,14 +33,14 @@ static void dumpVGAReg(void)
 
 	for (i = 0; i < 0x4f; i++) {
 		reg = xgifb_reg_get(XGISR, i);
-		pr_debug("\no 3c4 %x", i);
-		pr_debug("\ni 3c5 => %x", reg);
+		pr_debug("o 3c4 %x\n", i);
+		pr_debug("i 3c5 => %x\n", reg);
 	}
 
 	for (i = 0; i < 0xF0; i++) {
 		reg = xgifb_reg_get(XGICR, i);
-		pr_debug("\no 3d4 %x", i);
-		pr_debug("\ni 3d5 => %x", reg);
+		pr_debug("o 3d4 %x\n", i);
+		pr_debug("i 3d5 => %x\n", reg);
 	}
 }
 #else
@@ -585,7 +585,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				break;
 			} else if (XGIfb_vrate[i].refresh > rate) {
 				if ((XGIfb_vrate[i].refresh - rate) <= 3) {
-					pr_debug("XGIfb: Adjusting rate from %d up to %d\n",
+					pr_debug("Adjusting rate from %d up to %d\n",
 						 rate, XGIfb_vrate[i].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i].idx;
@@ -594,7 +594,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				} else if (((rate - XGIfb_vrate[i - 1].refresh)
 						<= 2) && (XGIfb_vrate[i].idx
 						!= 1)) {
-					pr_debug("XGIfb: Adjusting rate from %d down to %d\n",
+					pr_debug("Adjusting rate from %d down to %d\n",
 						 rate, XGIfb_vrate[i-1].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i - 1].idx;
@@ -603,7 +603,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				}
 				break;
 			} else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
-				pr_debug("XGIfb: Adjusting rate from %d down to %d\n",
+				pr_debug("Adjusting rate from %d down to %d\n",
 					 rate, XGIfb_vrate[i].refresh);
 				xgifb_info->rate_idx = XGIfb_vrate[i].idx;
 				break;
@@ -977,7 +977,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	}
 
 	if (!htotal || !vtotal) {
-		pr_debug("XGIfb: Invalid 'var' information\n");
+		pr_debug("Invalid 'var' information\n");
 		return -EINVAL;
 	} pr_debug("var->pixclock=%d, htotal=%d, vtotal=%d\n",
 			var->pixclock, htotal, vtotal);
@@ -1053,7 +1053,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 
 		XGIfb_post_setmode(xgifb_info);
 
-		pr_debug("XGIfb: Set new mode: %dx%dx%d-%d\n",
+		pr_debug("Set new mode: %dx%dx%d-%d\n",
 			 XGIbios_mode[xgifb_info->mode_idx].xres,
 			 XGIbios_mode[xgifb_info->mode_idx].yres,
 			 XGIbios_mode[xgifb_info->mode_idx].bpp,
@@ -1099,7 +1099,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 			break;
 		default:
 			xgifb_info->video_cmap_len = 16;
-			pr_err("Unsupported depth %d",
+			pr_err("Unsupported depth %d\n",
 			       xgifb_info->video_bpp);
 			break;
 		}
@@ -1293,7 +1293,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 				+ var->vsync_len;
 
 	if (!(htotal) || !(vtotal)) {
-		pr_debug("XGIfb: no valid timing data\n");
+		pr_debug("No valid timing data\n");
 		return -EINVAL;
 	}
 
@@ -1651,7 +1651,7 @@ static int __init xgifb_optval(char *fullopt, int validx)
 	unsigned long lres;
 
 	if (kstrtoul(fullopt + validx, 0, &lres) < 0 || lres > INT_MAX) {
-		pr_err("xgifb: invalid value for option: %s\n", fullopt);
+		pr_err("Invalid value for option: %s\n", fullopt);
 		return 0;
 	}
 	return lres;
@@ -1664,7 +1664,7 @@ static int __init XGIfb_setup(char *options)
 	if (!options || !*options)
 		return 0;
 
-	pr_info("xgifb: options: %s\n", options);
+	pr_info("Options: %s\n", options);
 
 	while ((this_opt = strsep(&options, ",")) != NULL) {
 
@@ -1757,7 +1757,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD);
 
 	if (reg1 != 0xa1) { /*I/O error */
-		dev_err(&pdev->dev, "I/O error!!!");
+		dev_err(&pdev->dev, "I/O error!!!\n");
 		ret = -EIO;
 		goto error_disable;
 	}
@@ -1807,7 +1807,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	if (!request_mem_region(xgifb_info->video_base,
 				xgifb_info->video_size,
 				"XGIfb FB")) {
-		dev_err(&pdev->dev, "unable request memory size %x\n",
+		dev_err(&pdev->dev, "Unable request memory size %x\n",
 		       xgifb_info->video_size);
 		dev_err(&pdev->dev,
 			"Fatal error: Unable to reserve frame buffer memory. "
@@ -1963,7 +1963,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	}
 
 	if (xgifb_info->mode_idx < 0) {
-		dev_err(&pdev->dev, "no supported video mode found\n");
+		dev_err(&pdev->dev, "No supported video mode found\n");
 		goto error_1;
 	}
 
@@ -2075,7 +2075,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	xgifb_info->mtrr = mtrr_add(xgifb_info->video_base,
 		xgifb_info->video_size, MTRR_TYPE_WRCOMB, 1);
 	if (xgifb_info->mtrr >= 0)
-		dev_info(&pdev->dev, "added MTRR\n");
+		dev_info(&pdev->dev, "Added MTRR\n");
 #endif
 
 	if (register_framebuffer(fb_info) < 0) {
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 6bb0206..64935fa 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -951,7 +951,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev,
 	pVBInfo->IF_DEF_LVDS = 0;
 	vbios = xgifb_copy_rom(pdev, &vbios_size);
 	if (vbios == NULL) {
-		dev_err(&pdev->dev, "video BIOS not available\n");
+		dev_err(&pdev->dev, "Video BIOS not available\n");
 		return;
 	}
 	if (vbios_size <= 0x65)
@@ -1006,7 +1006,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev,
 	pVBInfo->IF_DEF_LVDS = 1;
 	return;
 error:
-	dev_err(&pdev->dev, "video BIOS corrupted\n");
+	dev_err(&pdev->dev, "Video BIOS corrupted\n");
 	vfree(vbios);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 06/19] Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (4 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 05/19] Staging: xgifb: Improve debug strings Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 07/19] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

The switch performs no action so it can be removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 818e248..367e581 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1546,16 +1546,6 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 
 	xgifb_info->TV_plug = xgifb_info->TV_type = 0;
 
-	switch (xgifb_info->hasVB) {
-	case HASVB_LVDS_CHRONTEL:
-	case HASVB_CHRONTEL:
-		break;
-	case HASVB_301:
-	case HASVB_302:
-		/* XGI_Sense30x(); */ /* Yi-Lin TV Sense? */
-		break;
-	}
-
 	cr32 = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR32);
 
 	if ((cr32 & SIS_CRT1) && !XGIfb_crt1off)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 07/19] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (5 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 06/19] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 08/19] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Simplify the code and make it more readable.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 367e581..b360ad3 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -256,28 +256,19 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
 
 static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
 {
+	int i = 0;
 
-	int found_mode = 0;
-	int XGIfb_mode_idx = 0;
-
-	found_mode = 0;
-	while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0)
-			&& (XGIbios_mode[XGIfb_mode_idx].xres
-					<= xgifb_info->lvds_data.LVDSHDE)) {
-		if ((XGIbios_mode[XGIfb_mode_idx].xres
-				== xgifb_info->lvds_data.LVDSHDE)
-				&& (XGIbios_mode[XGIfb_mode_idx].yres
-					== xgifb_info->lvds_data.LVDSVDE)
-				&& (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) {
-			found_mode = 1;
-			break;
+	while ((XGIbios_mode[i].mode_no != 0)
+	       && (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) {
+		if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE)
+		    && (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE)
+		    && (XGIbios_mode[i].bpp == 8)) {
+			return i;
 		}
-		XGIfb_mode_idx++;
+		i++;
 	}
-	if (!found_mode)
-		XGIfb_mode_idx = -1;
 
-	return XGIfb_mode_idx;
+	return -1;
 }
 
 static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 08/19] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (6 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 07/19] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 09/19] Staging: xgifb: Remove useless always true condition Miguel Gómez
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index b360ad3..8ae9402 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -299,7 +299,7 @@ invalid_mode:
 static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
 				  unsigned int vesamode)
 {
-	int i = 0, j = 0;
+	int i = 0;
 
 	if (vesamode == 0)
 		goto invalid;
@@ -310,15 +310,13 @@ static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
 		if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
 		    (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
 			xgifb_info->mode_idx = i;
-			j = 1;
-			break;
+			return;
 		}
 		i++;
 	}
 
 invalid:
-	if (!j)
-		pr_info("Invalid VESA mode 0x%x'\n", vesamode);
+	pr_info("Invalid VESA mode 0x%x'\n", vesamode);
 }
 
 static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 09/19] Staging: xgifb: Remove useless always true condition.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (7 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 08/19] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 10/19] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_init.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 64935fa..ae10153 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1185,13 +1185,11 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
 {
 	unsigned char Temp;
 
-#if 1
 	if (pVBInfo->IF_DEF_LVDS) { /* For XG21 LVDS */
 		xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
 		/* LVDS on chip */
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0);
 	} else {
-#endif
 		/* Enable GPIOA/B read  */
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03);
 		Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0;
@@ -1214,9 +1212,7 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
 			/* Disable read GPIOF */
 			xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20);
 		}
-#if 1
 	}
-#endif
 }
 
 static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 10/19] Staging: xgifb: Rework conditions in XGI_SetATTRegs().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (8 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 09/19] Staging: xgifb: Remove useless always true condition Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 11/19] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 3ba3c48..4b49705 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -161,18 +161,15 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
 
 	for (i = 0; i <= 0x13; i++) {
 		ARdata = pVBInfo->StandTable->ATTR[i];
-		if (modeflag & Charx8Dot) { /* ifndef Dot9 */
-			if (i == 0x13) {
-				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+
+		if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */
+			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+				ARdata = 0;
+			} else {
+				if ((pVBInfo->VBInfo &
+				     (SetCRT2ToTV | SetCRT2ToLCD)) &&
+				    (pVBInfo->VBInfo & SetInSlaveMode))
 					ARdata = 0;
-				} else {
-					if (pVBInfo->VBInfo & (SetCRT2ToTV
-							| SetCRT2ToLCD)) {
-						if (pVBInfo->VBInfo &
-						    SetInSlaveMode)
-							ARdata = 0;
-					}
-				}
 			}
 		}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 11/19] Staging: xgifb: Refactor XGI_AjustCRT2Rate().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (9 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 10/19] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 12/19] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Refactor some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   73 ++++++++++++------------------------
 1 file changed, 25 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 4b49705..03edf36 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -250,48 +250,30 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
 		if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
 			tempax |= SupportLCD;
 
-			if (pVBInfo->LCDResInfo != Panel_1280x1024) {
-				if (pVBInfo->LCDResInfo != Panel_1280x960) {
-					if (pVBInfo->LCDInfo &
-					    LCDNonExpanding) {
-						if (resinfo >= 9) {
-							tempax = 0;
-							return 0;
-						}
-					}
-				}
-			}
+			if (pVBInfo->LCDResInfo != Panel_1280x1024 &&
+			    pVBInfo->LCDResInfo != Panel_1280x960 &&
+			    (pVBInfo->LCDInfo & LCDNonExpanding) &&
+			    resinfo >= 9)
+				return 0;
 		}
 
 		if (pVBInfo->VBInfo & SetCRT2ToHiVision) { /* for HiTV */
 			if ((pVBInfo->VBType & VB_SIS301LV) &&
 			    (pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
 				tempax |= SupportYPbPr750p;
-				if (pVBInfo->VBInfo & SetInSlaveMode) {
-					if (resinfo == 4)
-						return 0;
-
-					if (resinfo == 3)
-						return 0;
-
-					if (resinfo > 7)
-						return 0;
-				}
+				if ((pVBInfo->VBInfo & SetInSlaveMode) &&
+				    ((resinfo == 3) ||
+				     (resinfo == 4) ||
+				     (resinfo > 7)))
+					return 0;
 			} else {
 				tempax |= SupportHiVision;
-				if (pVBInfo->VBInfo & SetInSlaveMode) {
-					if (resinfo == 4)
+				if ((pVBInfo->VBInfo & SetInSlaveMode) &&
+				    ((resinfo == 4) ||
+				     (resinfo == 3 &&
+				      (pVBInfo->SetFlag & TVSimuMode)) ||
+				     (resinfo > 7)))
 						return 0;
-
-					if (resinfo == 3) {
-						if (pVBInfo->SetFlag
-								& TVSimuMode)
-							return 0;
-					}
-
-					if (resinfo > 7)
-						return 0;
-				}
 			}
 		} else {
 			if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
@@ -301,23 +283,18 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
 					       SetCRT2ToHiVision)) {
 				tempax |= SupportTV;
 
-				if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B
-						| VB_SIS301LV | VB_SIS302LV
-						| VB_XGI301C)) {
+				if (pVBInfo->VBType & (VB_SIS301B |
+						       VB_SIS302B |
+						       VB_SIS301LV |
+						       VB_SIS302LV |
+						       VB_XGI301C))
 					tempax |= SupportTV1024;
-				}
 
-				if (!(pVBInfo->VBInfo & TVSetPAL)) {
-					if (modeflag & NoSupportSimuTV) {
-						if (pVBInfo->VBInfo &
-						    SetInSlaveMode) {
-							if (!(pVBInfo->VBInfo &
-							      SetNotSimuMode)) {
-								return 0;
-							}
-						}
-					}
-				}
+				if (!(pVBInfo->VBInfo & TVSetPAL) &&
+				    (modeflag & NoSupportSimuTV) &&
+				    (pVBInfo->VBInfo & SetInSlaveMode) &&
+				    (!(pVBInfo->VBInfo & SetNotSimuMode)))
+					return 0;
 			}
 		}
 	} else { /* for LVDS */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 12/19] Staging: xgifb: Refactor XGI_GetVBType().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (10 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 11/19] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 13/19] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Refactor XGI_GetVBType() to reduce indentation and fix style warnings.

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

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 03edf36..251145e 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -2559,42 +2559,45 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
 {
 	unsigned short flag, tempbx, tempah;
 
-	if (pVBInfo->IF_DEF_LVDS == 0) {
-		tempbx = VB_SIS302B;
-		flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
-		if (flag != 0x02) {
-			tempbx = VB_SIS301;
-			flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
-			if (flag >= 0xB0) {
-				tempbx = VB_SIS301B;
-				if (flag >= 0xC0) {
-					tempbx = VB_XGI301C;
-					if (flag >= 0xD0) {
-						tempbx = VB_SIS301LV;
-						if (flag >= 0xE0) {
-							tempbx = VB_SIS302LV;
-							tempah = xgifb_reg_get(
-							    pVBInfo->Part4Port,
-							    0x39);
-							if (tempah != 0xFF)
-								tempbx =
-								    VB_XGI301C;
-						}
-					}
-				}
+	if (pVBInfo->IF_DEF_LVDS != 0)
+		return;
 
-				if (tempbx & (VB_SIS301B | VB_SIS302B)) {
-					flag = xgifb_reg_get(
-							pVBInfo->Part4Port,
-							0x23);
+	tempbx = VB_SIS302B;
+	flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
+	if (flag == 0x02)
+		goto finish;
 
-					if (!(flag & 0x02))
-						tempbx = tempbx | VB_NoLCD;
-				}
-			}
-		}
-		pVBInfo->VBType = tempbx;
+	tempbx = VB_SIS301;
+	flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
+	if (flag < 0xB0)
+		goto finish;
+
+	tempbx = VB_SIS301B;
+	if (flag < 0xC0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_XGI301C;
+	if (flag < 0xD0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_SIS301LV;
+	if (flag < 0xE0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_SIS302LV;
+	tempah = xgifb_reg_get(pVBInfo->Part4Port, 0x39);
+	if (tempah != 0xFF)
+		tempbx = VB_XGI301C;
+
+bigger_than_0xB0:
+	if (tempbx & (VB_SIS301B | VB_SIS302B)) {
+		flag = xgifb_reg_get(pVBInfo->Part4Port, 0x23);
+		if (!(flag & 0x02))
+			tempbx = tempbx | VB_NoLCD;
 	}
+
+finish:
+	pVBInfo->VBType = tempbx;
 }
 
 static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 13/19] Staging: xgifb: Rework conditions in XGI_GetVBInfo().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (11 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 12/19] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 14/19] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |  287 ++++++++++++++++++------------------
 1 file changed, 142 insertions(+), 145 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 251145e..9dfc2de 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -2611,186 +2611,183 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
 	pVBInfo->ModeType = modeflag & ModeTypeMask;
 	tempbx = 0;
 
-	if (pVBInfo->VBType & 0xFFFF) {
-		/* Check Display Device */
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
-		tempbx = tempbx | temp;
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
-		push = temp;
-		push = push << 8;
-		tempax = temp << 8;
-		tempbx = tempbx | tempax;
-		temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
-				| SetInSlaveMode | DisableCRT2Display);
-		temp = 0xFFFF ^ temp;
-		tempbx &= temp;
-
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+	if (!(pVBInfo->VBType & 0xFFFF))
+		return;
 
-		if (pVBInfo->IF_DEF_LCDA == 1) {
-
-			if ((HwDeviceExtension->jChipType >= XG20) ||
-			    (HwDeviceExtension->jChipType >= XG40)) {
-				if (pVBInfo->IF_DEF_LVDS == 0) {
-					if (pVBInfo->VBType &
-					    (VB_SIS302B |
-					     VB_SIS301LV |
-					     VB_SIS302LV |
-					     VB_XGI301C)) {
-						if (temp & EnableDualEdge) {
-							tempbx |=
-							    SetCRT2ToDualEdge;
-
-							if (temp & SetToLCDA)
-								tempbx |=
-								  XGI_SetCRT2ToLCDA;
-						}
-					}
+	/* Check Display Device */
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
+	tempbx = tempbx | temp;
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
+	push = temp;
+	push = push << 8;
+	tempax = temp << 8;
+	tempbx = tempbx | tempax;
+	temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
+		| SetInSlaveMode | DisableCRT2Display);
+	temp = 0xFFFF ^ temp;
+	tempbx &= temp;
+
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+
+	if (pVBInfo->IF_DEF_LCDA == 1) {
+
+		if (((HwDeviceExtension->jChipType >= XG20) ||
+		     (HwDeviceExtension->jChipType >= XG40)) &&
+		    (pVBInfo->IF_DEF_LVDS == 0)) {
+			if (pVBInfo->VBType &
+			    (VB_SIS302B |
+			     VB_SIS301LV |
+			     VB_SIS302LV |
+			     VB_XGI301C)) {
+				if (temp & EnableDualEdge) {
+					tempbx |= SetCRT2ToDualEdge;
+					if (temp & SetToLCDA)
+						tempbx |= XGI_SetCRT2ToLCDA;
 				}
 			}
 		}
+	}
 
-		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			if (((pVBInfo->IF_DEF_LVDS == 0) &&
-			    ((pVBInfo->VBType & VB_SIS301LV) ||
-			    (pVBInfo->VBType & VB_SIS302LV) ||
-			    (pVBInfo->VBType & VB_XGI301C)))) {
-				if (temp & SetYPbPr) {
-					if (pVBInfo->IF_DEF_HiVision == 1) {
-						/* shampoo add for new
-						 * scratch */
-						temp = xgifb_reg_get(
-								pVBInfo->P3d4,
-								0x35);
-						temp &= YPbPrMode;
-						tempbx |= SetCRT2ToHiVision;
-
-						if (temp != YPbPrMode1080i) {
-							tempbx &=
-							 (~SetCRT2ToHiVision);
-							tempbx |=
-							 SetCRT2ToYPbPr525750;
-						}
+	if (pVBInfo->IF_DEF_YPbPr == 1) {
+		if (((pVBInfo->IF_DEF_LVDS == 0) &&
+		     ((pVBInfo->VBType & VB_SIS301LV) ||
+		      (pVBInfo->VBType & VB_SIS302LV) ||
+		      (pVBInfo->VBType & VB_XGI301C)))) {
+			if (temp & SetYPbPr) {
+				if (pVBInfo->IF_DEF_HiVision == 1) {
+					/* shampoo add for new
+					 * scratch */
+					temp = xgifb_reg_get(
+						pVBInfo->P3d4,
+						0x35);
+					temp &= YPbPrMode;
+					tempbx |= SetCRT2ToHiVision;
+
+					if (temp != YPbPrMode1080i) {
+						tempbx &=
+							(~SetCRT2ToHiVision);
+						tempbx |=
+							SetCRT2ToYPbPr525750;
 					}
 				}
 			}
 		}
+	}
 
-		tempax = push; /* restore CR31 */
+	tempax = push; /* restore CR31 */
 
-		if (pVBInfo->IF_DEF_LVDS == 0) {
-			if (pVBInfo->IF_DEF_YPbPr == 1) {
-				if (pVBInfo->IF_DEF_HiVision == 1)
-					temp = 0x09FC;
-				else
-					temp = 0x097C;
-			} else {
-				if (pVBInfo->IF_DEF_HiVision == 1)
-					temp = 0x01FC;
-				else
-					temp = 0x017C;
-			}
-		} else { /* 3nd party chip */
-			temp = SetCRT2ToLCD;
-		}
-
-		if (!(tempbx & temp)) {
-			tempax |= DisableCRT2Display;
-			tempbx = 0;
-		}
-
-		if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
-			if (!(pVBInfo->VBType & VB_NoLCD)) {
-				if (tempbx & XGI_SetCRT2ToLCDA) {
-					if (tempbx & SetSimuScanMode)
-						tempbx &= (~(SetCRT2ToLCD |
-							   SetCRT2ToRAMDAC |
-							   SwitchCRT2));
-					else
-						tempbx &= (~(SetCRT2ToLCD |
-							     SetCRT2ToRAMDAC |
-							     SetCRT2ToTV |
-							     SwitchCRT2));
-				}
-			}
+	if (pVBInfo->IF_DEF_LVDS == 0) {
+		if (pVBInfo->IF_DEF_YPbPr == 1) {
+			if (pVBInfo->IF_DEF_HiVision == 1)
+				temp = 0x09FC;
+			else
+				temp = 0x097C;
+		} else {
+			if (pVBInfo->IF_DEF_HiVision == 1)
+				temp = 0x01FC;
+			else
+				temp = 0x017C;
 		}
+	} else { /* 3nd party chip */
+		temp = SetCRT2ToLCD;
+	}
 
-		/* shampoo add */
-		/* for driver abnormal */
-		if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
-			if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
-				if (tempbx & SetCRT2ToRAMDAC) {
-					tempbx &= (0xFF00 |
-						   SetCRT2ToRAMDAC |
-						   SwitchCRT2 |
-						   SetSimuScanMode);
-					tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
-				}
-			} else {
-				tempbx &= (~(SetCRT2ToRAMDAC |
-					   SetCRT2ToLCD |
-					   SetCRT2ToTV));
+	if (!(tempbx & temp)) {
+		tempax |= DisableCRT2Display;
+		tempbx = 0;
+	}
+
+	if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
+		if (!(pVBInfo->VBType & VB_NoLCD)) {
+			if (tempbx & XGI_SetCRT2ToLCDA) {
+				if (tempbx & SetSimuScanMode)
+					tempbx &= (~(SetCRT2ToLCD |
+						     SetCRT2ToRAMDAC |
+						     SwitchCRT2));
+				else
+					tempbx &= (~(SetCRT2ToLCD |
+						     SetCRT2ToRAMDAC |
+						     SetCRT2ToTV |
+						     SwitchCRT2));
 			}
 		}
+	}
 
-		if (!(pVBInfo->VBType & VB_NoLCD)) {
-			if (tempbx & SetCRT2ToLCD) {
+	/* shampoo add */
+	/* for driver abnormal */
+	if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
+		if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
+			if (tempbx & SetCRT2ToRAMDAC) {
 				tempbx &= (0xFF00 |
-					   SetCRT2ToLCD |
+					   SetCRT2ToRAMDAC |
 					   SwitchCRT2 |
 					   SetSimuScanMode);
 				tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
 			}
+		} else {
+			tempbx &= (~(SetCRT2ToRAMDAC |
+				     SetCRT2ToLCD |
+				     SetCRT2ToTV));
 		}
+	}
 
-		if (tempbx & SetCRT2ToSCART) {
+	if (!(pVBInfo->VBType & VB_NoLCD)) {
+		if (tempbx & SetCRT2ToLCD) {
 			tempbx &= (0xFF00 |
-				   SetCRT2ToSCART |
+				   SetCRT2ToLCD |
 				   SwitchCRT2 |
 				   SetSimuScanMode);
 			tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
 		}
+	}
 
-		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			if (tempbx & SetCRT2ToYPbPr525750)
-				tempbx &= (0xFF00 |
-					   SwitchCRT2 |
-					   SetSimuScanMode);
-		}
+	if (tempbx & SetCRT2ToSCART) {
+		tempbx &= (0xFF00 |
+			   SetCRT2ToSCART |
+			   SwitchCRT2 |
+			   SetSimuScanMode);
+		tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
+	}
 
-		if (pVBInfo->IF_DEF_HiVision == 1) {
-			if (tempbx & SetCRT2ToHiVision)
-				tempbx &= (0xFF00 |
-					   SetCRT2ToHiVision |
-					   SwitchCRT2 |
-					   SetSimuScanMode);
-		}
+	if (pVBInfo->IF_DEF_YPbPr == 1) {
+		if (tempbx & SetCRT2ToYPbPr525750)
+			tempbx &= (0xFF00 |
+				   SwitchCRT2 |
+				   SetSimuScanMode);
+	}
 
-		if (tempax & DisableCRT2Display) { /* Set Display Device Info */
-			if (!(tempbx & (SwitchCRT2 | SetSimuScanMode)))
-				tempbx = DisableCRT2Display;
-		}
+	if (pVBInfo->IF_DEF_HiVision == 1) {
+		if (tempbx & SetCRT2ToHiVision)
+			tempbx &= (0xFF00 |
+				   SetCRT2ToHiVision |
+				   SwitchCRT2 |
+				   SetSimuScanMode);
+	}
 
-		if (!(tempbx & DisableCRT2Display)) {
-			if ((!(tempbx & DriverMode)) ||
-			    (!(modeflag & CRT2Mode))) {
-				if (pVBInfo->IF_DEF_LCDA == 1) {
-					if (!(tempbx & XGI_SetCRT2ToLCDA))
-						tempbx |= (SetInSlaveMode |
-							   SetSimuScanMode);
-				}
-			}
+	if (tempax & DisableCRT2Display) { /* Set Display Device Info */
+		if (!(tempbx & (SwitchCRT2 | SetSimuScanMode)))
+			tempbx = DisableCRT2Display;
+	}
 
-			/* LCD+TV can't support in slave mode
-			 * (Force LCDA+TV->LCDB) */
-			if ((tempbx & SetInSlaveMode) &&
-			    (tempbx & XGI_SetCRT2ToLCDA)) {
-				tempbx ^= (SetCRT2ToLCD |
-					  XGI_SetCRT2ToLCDA |
-					  SetCRT2ToDualEdge);
-				pVBInfo->SetFlag |= ReserveTVOption;
+	if (!(tempbx & DisableCRT2Display)) {
+		if ((!(tempbx & DriverMode)) ||
+		    (!(modeflag & CRT2Mode))) {
+			if (pVBInfo->IF_DEF_LCDA == 1) {
+				if (!(tempbx & XGI_SetCRT2ToLCDA))
+					tempbx |= (SetInSlaveMode |
+						   SetSimuScanMode);
 			}
 		}
+
+		/* LCD+TV can't support in slave mode
+		 * (Force LCDA+TV->LCDB) */
+		if ((tempbx & SetInSlaveMode) &&
+		    (tempbx & XGI_SetCRT2ToLCDA)) {
+			tempbx ^= (SetCRT2ToLCD |
+				   XGI_SetCRT2ToLCDA |
+				   SetCRT2ToDualEdge);
+			pVBInfo->SetFlag |= ReserveTVOption;
+		}
 	}
 
 	pVBInfo->VBInfo = tempbx;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 14/19] Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (12 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 13/19] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:45 ` [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Use a goto to remove one level of indentation, fixing style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   61 ++++++++++++++++++------------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 9dfc2de..a7ba99f 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -3263,46 +3263,47 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo,
 	if (modeflag & DoubleScanMode)
 		yres *= 2;
 
-	if (pVBInfo->VBInfo & SetCRT2ToLCD) {
-		if (pVBInfo->IF_DEF_LVDS == 0) {
-			if (pVBInfo->LCDResInfo == Panel_1600x1200) {
-				if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
-					if (yres == 1024)
-						yres = 1056;
-				}
+	if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+		goto exit;
+
+	if (pVBInfo->IF_DEF_LVDS == 0) {
+		if (pVBInfo->LCDResInfo == Panel_1600x1200) {
+			if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
+				if (yres == 1024)
+					yres = 1056;
 			}
+		}
 
-			if (pVBInfo->LCDResInfo == Panel_1280x1024) {
-				if (yres == 400)
-					yres = 405;
-				else if (yres == 350)
-					yres = 360;
+		if (pVBInfo->LCDResInfo == Panel_1280x1024) {
+			if (yres == 400)
+				yres = 405;
+			else if (yres == 350)
+				yres = 360;
 
-				if (pVBInfo->LCDInfo & XGI_LCDVESATiming) {
-					if (yres == 360)
-						yres = 375;
-				}
+			if (pVBInfo->LCDInfo & XGI_LCDVESATiming) {
+				if (yres == 360)
+					yres = 375;
 			}
+		}
 
-			if (pVBInfo->LCDResInfo == Panel_1024x768) {
-				if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
-					if (!(pVBInfo->LCDInfo
-							& LCDNonExpanding)) {
-						if (yres == 350)
-							yres = 357;
-						else if (yres == 400)
-							yres = 420;
-						else if (yres == 480)
-							yres = 525;
-					}
+		if (pVBInfo->LCDResInfo == Panel_1024x768) {
+			if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
+				if (!(pVBInfo->LCDInfo & LCDNonExpanding)) {
+					if (yres == 350)
+						yres = 357;
+					else if (yres == 400)
+						yres = 420;
+					else if (yres == 480)
+						yres = 525;
 				}
 			}
 		}
-
-		if (xres == 720)
-			xres = 640;
 	}
 
+	if (xres == 720)
+		xres = 640;
+
+exit:
 	pVBInfo->VGAHDE = xres;
 	pVBInfo->HDE = xres;
 	pVBInfo->VGAVDE = yres;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (13 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 14/19] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 18:00   ` Aaro Koskinen
  2012-07-06  6:51   ` Dan Carpenter
  2012-07-05 14:45 ` [PATCH 16/19] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
                   ` (4 subsequent siblings)
  19 siblings, 2 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   29 ++++++++++++-----------------
 1 file changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index a7ba99f..b439f59 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -4039,23 +4039,18 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
 	}
 
 	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-		if (pVBInfo->VBType & VB_SIS301LV) {
-			if (pVBInfo->TVInfo & TVSetHiVision) {
-				tempbx -= 10;
-			} else {
-				if (pVBInfo->TVInfo & TVSimuMode) {
-					if (pVBInfo->TVInfo & TVSetPAL) {
-						if (pVBInfo->VBType &
-						    VB_SIS301LV) {
-							if (!(pVBInfo->TVInfo &
-							    (TVSetYPbPr525p |
-							    TVSetYPbPr750p |
-							    TVSetHiVision)))
-								tempbx += 40;
-						} else {
-							tempbx += 40;
-						}
-					}
+		if ((pVBInfo->VBType & VB_SIS301LV) &&
+		    !(pVBInfo->TVInfo & TVSetHiVision)) {
+			if ((pVBInfo->TVInfo & TVSimuMode) &&
+			    (pVBInfo->TVInfo & TVSetPAL)) {
+				if (pVBInfo->VBType & VB_SIS301LV) {
+					if (!(pVBInfo->TVInfo &
+					      (TVSetYPbPr525p |
+					       TVSetYPbPr750p |
+					       TVSetHiVision)))
+						tempbx += 40;
+				} else {
+					tempbx += 40;
 				}
 			}
 		} else {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 16/19] Staging: xgifb: Rework conditions in XGI_EnableBridge().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (14 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
@ 2012-07-05 14:45 ` Miguel Gómez
  2012-07-05 14:46 ` [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:45 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   44 +++++++++++++++---------------------
 1 file changed, 18 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index b439f59..3e0d668 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -6475,32 +6475,24 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
 		if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
 			tempah = 0xc0;
 
-			if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
-				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
-					if (pVBInfo->VBInfo &
-					    SetCRT2ToDualEdge) {
-						tempah = tempah & 0x40;
-						if (pVBInfo->VBInfo &
-						    XGI_SetCRT2ToLCDA)
-							tempah = tempah ^ 0xC0;
-
-						if (pVBInfo->SetFlag &
-						    DisableChB)
-							tempah &= 0xBF;
-
-						if (pVBInfo->SetFlag &
-						    DisableChA)
-							tempah &= 0x7F;
-
-						if (pVBInfo->SetFlag &
-						    EnableChB)
-							tempah |= 0x40;
-
-						if (pVBInfo->SetFlag &
-						    EnableChA)
-							tempah |= 0x80;
-					}
-				}
+			if (!(pVBInfo->VBInfo & SetSimuScanMode) &&
+			    (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
+			    (pVBInfo->VBInfo & SetCRT2ToDualEdge)) {
+				tempah = tempah & 0x40;
+				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)
+					tempah = tempah ^ 0xC0;
+
+				if (pVBInfo->SetFlag & DisableChB)
+					tempah &= 0xBF;
+
+				if (pVBInfo->SetFlag &  DisableChA)
+					tempah &= 0x7F;
+
+				if (pVBInfo->SetFlag &  EnableChB)
+					tempah |= 0x40;
+
+				if (pVBInfo->SetFlag &  EnableChA)
+					tempah |= 0x80;
 			}
 		}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (15 preceding siblings ...)
  2012-07-05 14:45 ` [PATCH 16/19] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
@ 2012-07-05 14:46 ` Miguel Gómez
  2012-07-05 14:46 ` [PATCH 18/19] Staging: xgifb: Fix coding style Miguel Gómez
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:46 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 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


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 18/19] Staging: xgifb: Fix coding style.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (16 preceding siblings ...)
  2012-07-05 14:46 ` [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
@ 2012-07-05 14:46 ` Miguel Gómez
  2012-07-05 14:46 ` [PATCH 19/19] Staging: xgifb: Remove useless condition Miguel Gómez
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:46 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Fix small coding style warnings in several files.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    3 +-
 drivers/staging/xgifb/vb_init.c     |    3 +-
 drivers/staging/xgifb/vb_setmode.c  |   55 ++++++++++++++++++++---------------
 drivers/staging/xgifb/vb_table.h    |   20 ++++++-------
 4 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 8ae9402..895e408 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -584,7 +584,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 						<= 2) && (XGIfb_vrate[i].idx
 						!= 1)) {
 					pr_debug("Adjusting rate from %d down to %d\n",
-						 rate, XGIfb_vrate[i-1].refresh);
+						 rate,
+						 XGIfb_vrate[i-1].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i - 1].idx;
 					xgifb_info->refresh_rate =
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index ae10153..80dba6a 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1042,9 +1042,8 @@ static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
 
 	if (tempbx & tempcx) {
 		CR3CData = xgifb_reg_get(pVBInfo->P3d4, 0x3c);
-		if (!(CR3CData & DisplayDeviceFromCMOS)) {
+		if (!(CR3CData & DisplayDeviceFromCMOS))
 			tempcx = 0x1FF0;
-		}
 	} else {
 		tempcx = 0x1FF0;
 	}
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index f41e595..629ac30 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -945,23 +945,25 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 
 	if (pVBInfo->IF_DEF_LVDS == 0) {
 		CRT2Index = CRT2Index >> 6; /*  for LCD */
-		if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/
+		if (pVBInfo->VBInfo &
+		    (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/
 			if (pVBInfo->LCDResInfo != Panel_1024x768)
-				VCLKIndex =  VCLK108_2_315 + 5; /* LCDXlat2VCLK */
+				VCLKIndex =  VCLK108_2_315 + 5; /*LCDXlat2VCLK*/
 			else
 				VCLKIndex = VCLK65_315 + 2; /* LCDXlat1VCLK */
 		} else if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-			if (pVBInfo->SetFlag & RPLLDIV2XO) {
+			if (pVBInfo->SetFlag & RPLLDIV2XO)
 				VCLKIndex = TVCLKBASE_315_25 + HiTVVCLKDIV2;
-			} else {
+			else
 				VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK;
-			}
 
 			if (pVBInfo->SetFlag & TVSimuMode) {
 				if (modeflag & Charx8Dot) {
-					VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK;
+					VCLKIndex = TVCLKBASE_315_25 +
+							HiTVSimuVCLK;
 				} else {
-					VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK;
+					VCLKIndex = TVCLKBASE_315_25 +
+							HiTVTextVCLK;
 				}
 			}
 
@@ -978,11 +980,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 					VCLKIndex = YPbPr525iVCLK;
 			}
 		} else if (pVBInfo->VBInfo & SetCRT2ToTV) {
-			if (pVBInfo->SetFlag & RPLLDIV2XO) {
+			if (pVBInfo->SetFlag & RPLLDIV2XO)
 				VCLKIndex = TVCLKBASE_315_25 + TVVCLKDIV2;
-			} else {
+			else
 				VCLKIndex = TVCLKBASE_315_25 + TVVCLK;
-			}
 		} else { /* for CRT2 */
 			/* di+Ext_CRTVCLK */
 			VCLKIndex = pVBInfo->RefIndex[RefreshRateTableIndex].
@@ -994,7 +995,8 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 		    (pVBInfo->LCDResInfo == Panel_320x480))
 			VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
 		else
-			VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK  */
+			VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK,
+						       LVDSXlat3VCLK  */
 	}
 
 	return VCLKIndex;
@@ -1928,7 +1930,8 @@ static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
 				pVBInfo->HDE = 1024;
 				pVBInfo->VDE = 768;
 			} else if ((pVBInfo->LCDResInfo == Panel_1280x1024) ||
-				   (pVBInfo->LCDResInfo == Panel_1280x1024x75)) {
+				   (pVBInfo->LCDResInfo ==
+					Panel_1280x1024x75)) {
 				pVBInfo->HDE = 1280;
 				pVBInfo->VDE = 1024;
 			} else if (pVBInfo->LCDResInfo == Panel_1400x1050) {
@@ -2385,7 +2388,8 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
 				if (pVBInfo->TVInfo & TVSimuMode) {
 					tempal = TVCLKBASE_315 + HiTVSimuVCLK;
 					if (!(modeflag & Charx8Dot))
-						tempal = TVCLKBASE_315 + HiTVTextVCLK;
+						tempal = TVCLKBASE_315 +
+								HiTVTextVCLK;
 
 				}
 				return tempal;
@@ -2431,8 +2435,8 @@ static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
 {
 	if (pVBInfo->VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B
 			| VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) {
-		if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) && (pVBInfo->SetFlag
-				& ProgrammingCRT2)) {
+		if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) &&
+		    (pVBInfo->SetFlag & ProgrammingCRT2)) {
 			*di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
 			*di_1 = XGI_VBVCLKData[tempal].SR2C;
 		}
@@ -2948,7 +2952,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
 		if ((pVBInfo->LCDResInfo == Panel_1400x1050) && (pVBInfo->VBInfo
 				& SetCRT2ToLCD) && (resinfo == 9) &&
 				(!(tempbx & EnableScalingLCD)))
-			/* set to center in 1280x1024 LCDB for Panel_1400x1050 */
+			/*set to center in 1280x1024 LCDB for Panel_1400x1050*/
 			tempbx |= SetLCDtoNonExpanding;
 	}
 
@@ -5454,7 +5458,8 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info,
 			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
 				if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
 					tempah = 0x7F; /* Disable Channel A */
-					if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA))
+					if (!(pVBInfo->VBInfo &
+					      XGI_SetCRT2ToLCDA))
 						/* Disable Channel B */
 						tempah = 0xBF;
 
@@ -5473,9 +5478,10 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info,
 		xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah);
 
 		if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) {
-			if (((pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
-					|| (XGI_DisableChISLCD(pVBInfo))
-					|| (XGI_IsLCDON(pVBInfo)))
+			if (((pVBInfo->VBInfo &
+			      (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
+			    || (XGI_DisableChISLCD(pVBInfo))
+			    || (XGI_IsLCDON(pVBInfo)))
 				/* LVDS Driver power down */
 				xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80);
 		}
@@ -5641,7 +5647,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
 
 			if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
 				tempbl = tempbl >> 4;
-			if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
+			if (pVBInfo->VBInfo &
+			    (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
 				tempbh = XGI301LCDDelay;
 
 				if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA))
@@ -5658,7 +5665,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
 				tempah |= tempbl;
 			}
 
-			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { /* Channel A */
+			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+				/* Channel A */
 				tempah &= 0x0F;
 				tempah |= tempbh;
 			}
@@ -6728,9 +6736,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 
 	XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) {
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_LockCRT2(HwDeviceExtension, pVBInfo);
-	}
 
 	return 1;
 }
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index ca8c68d..e8467ca 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1838,9 +1838,9 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] = {
 	{Panel_1024x768x75, 0x0019, 0x0001, 12}, /* XGI_ExtLCD1024x768x75Data */
 	{Panel_1024x768x75, 0x0019, 0x0000, 13}, /* XGI_StLCD1024x768x75Data */
 	{Panel_1024x768x75, 0x0018, 0x0010, 14}, /* XGI_CetLCD1024x768x75Data */
-	{Panel_1280x1024x75, 0x0019, 0x0001, 15}, /* XGI_ExtLCD1280x1024x75Data*/
-	{Panel_1280x1024x75, 0x0019, 0x0000, 16}, /* XGI_StLCD1280x1024x75Data */
-	{Panel_1280x1024x75, 0x0018, 0x0010, 17}, /* XGI_CetLCD1280x1024x75Data*/
+	{Panel_1280x1024x75, 0x0019, 0x0001, 15}, /*XGI_ExtLCD1280x1024x75Data*/
+	{Panel_1280x1024x75, 0x0019, 0x0000, 16}, /*XGI_StLCD1280x1024x75Data */
+	{Panel_1280x1024x75, 0x0018, 0x0010, 17}, /*XGI_CetLCD1280x1024x75Data*/
 	{PanelRef75Hz, 0x0008, 0x0008, 18}, /* XGI_NoScalingDatax75 */
 	{0xFF, 0x0000, 0x0000, 0} /* End of table */
 };
@@ -1859,9 +1859,9 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] = {
 	{Panel_1600x1200, 0x0019, 0x0001, 10}, /* XGI_ExtLCDDes1600x1200Data */
 	{Panel_1600x1200, 0x0019, 0x0000, 11}, /* XGI_StLCDDes1600x1200Data */
 	{PanelRef60Hz, 0x0008, 0x0008, 12}, /* XGI_NoScalingDesData */
-	{Panel_1024x768x75, 0x0019, 0x0001, 13}, /*XGI_ExtLCDDes1024x768x75Data*/
-	{Panel_1024x768x75, 0x0019, 0x0000, 14}, /* XGI_StLCDDes1024x768x75Data*/
-	{Panel_1024x768x75, 0x0018, 0x0010, 15}, /*XGI_CetLCDDes1024x768x75Data*/
+	{Panel_1024x768x75, 0x0019, 0x0001, 13},/*XGI_ExtLCDDes1024x768x75Data*/
+	{Panel_1024x768x75, 0x0019, 0x0000, 14},/*XGI_StLCDDes1024x768x75Data*/
+	{Panel_1024x768x75, 0x0018, 0x0010, 15},/*XGI_CetLCDDes1024x768x75Data*/
 	/* XGI_ExtLCDDes1280x1024x75Data */
 	{Panel_1280x1024x75, 0x0019, 0x0001, 16},
 	/* XGI_StLCDDes1280x1024x75Data */
@@ -1898,8 +1898,8 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] = {
 	{PanelRef60Hz, 0x0008, 0x0008, 7}, /* XGI_LVDSNoScalingData */
 	{Panel_1024x768x75, 0x0018, 0x0000, 8}, /* XGI_LVDS1024x768Data_1x75 */
 	{Panel_1024x768x75, 0x0018, 0x0010, 9}, /* XGI_LVDS1024x768Data_2x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0000, 10}, /* XGI_LVDS1280x1024Data_1x75*/
-	{Panel_1280x1024x75, 0x0018, 0x0010, 11},  /*XGI_LVDS1280x1024Data_2x75*/
+	{Panel_1280x1024x75, 0x0018, 0x0000, 10}, /*XGI_LVDS1280x1024Data_1x75*/
+	{Panel_1280x1024x75, 0x0018, 0x0010, 11}, /*XGI_LVDS1280x1024Data_2x75*/
 	{PanelRef75Hz, 0x0008, 0x0008, 12}, /* XGI_LVDSNoScalingDatax75 */
 	{0xFF, 0x0000, 0x0000, 0}
 };
@@ -1917,8 +1917,8 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] = {
 	{Panel_1024x768x75, 0x0018, 0x0000, 9}, /* XGI_LVDS1024x768Des_1x75 */
 	{Panel_1024x768x75, 0x0618, 0x0410, 10}, /* XGI_LVDS1024x768Des_3x75 */
 	{Panel_1024x768x75, 0x0018, 0x0010, 11}, /* XGI_LVDS1024x768Des_2x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0000, 12}, /* XGI_LVDS1280x1024Des_1x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0010, 13}, /* XGI_LVDS1280x1024Des_2x75 */
+	{Panel_1280x1024x75, 0x0018, 0x0000, 12}, /* XGI_LVDS1280x1024Des_1x75*/
+	{Panel_1280x1024x75, 0x0018, 0x0010, 13}, /* XGI_LVDS1280x1024Des_2x75*/
 	{PanelRef75Hz, 0x0008, 0x0008, 14}, /* XGI_LVDSNoScalingDesDatax75 */
 	{0xFF, 0x0000, 0x0000, 0}
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 19/19] Staging: xgifb: Remove useless condition.
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (17 preceding siblings ...)
  2012-07-05 14:46 ` [PATCH 18/19] Staging: xgifb: Fix coding style Miguel Gómez
@ 2012-07-05 14:46 ` Miguel Gómez
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
  19 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-05 14:46 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Remove last if branch in XGIfb_do_set_var(), as it has no action assigned.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 895e408..c29a5fc 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -963,8 +963,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 		vtotal <<= 1;
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
 		vtotal <<= 2;
-	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
-	}
 
 	if (!htotal || !vtotal) {
 		pr_debug("Invalid 'var' information\n");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
@ 2012-07-05 17:24   ` Aaro Koskinen
  2012-07-06  8:00     ` Miguel Gómez
  2012-07-05 17:35   ` Joe Perches
  2012-07-05 20:35   ` Dan Carpenter
  2 siblings, 1 reply; 56+ messages in thread
From: Aaro Koskinen @ 2012-07-05 17:24 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi,

On Thu, Jul 05, 2012 at 04:45:44PM +0200, Miguel Gómez wrote:
> Remove commented code and useless comments. Leave only those with relevant
> hints to the code.
> 
> Signed-off-by: Miguel Gómez <magomez@igalia.com>

Some minor comments below:

> -/*
> - * XG20, XG21, XG40, XG42 frame buffer device
> - * for Linux kernels  2.5.x, 2.6.x
> - * Base on TW's sis fbdev code.

A lot of code was copy-pasted from Thomas Winischhofer's sisfb driver,
I'm not sure if it's OK to remove the credit...?

> -		/* TW: We can't switch off CRT1 on LVDS/Chrontel
> +		/* We can't switch off CRT1 on LVDS/Chrontel
>  		 * in 8bpp Modes */
>  		if ((xgifb_info->hasVB == HASVB_LVDS) ||
>  		    (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
>  			doit = 0;
>  		}
> -		/* TW: We can't switch off CRT1 on 301B-DH
> +		/* We can't switch off CRT1 on 301B-DH
>                * in 8bpp Modes if using LCD */

These could be also fixed according to multiline comment style at the
same go.

> diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h
> index a27b4fe..be5589c 100644
> --- a/drivers/staging/xgifb/vb_init.h
> +++ b/drivers/staging/xgifb/vb_init.h
> @@ -3,4 +3,3 @@
>  extern unsigned char XGIInitNew(struct pci_dev *pdev);
>  extern struct XGI21_LVDSCapStruct  XGI21_LCDCapList[13];
>  #endif
> -
[...]
> diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h
> index 9161de1..ff40247 100644
> --- a/drivers/staging/xgifb/vb_util.h
> +++ b/drivers/staging/xgifb/vb_util.h
> @@ -6,4 +6,3 @@ extern void xgifb_reg_or(unsigned long, u8, unsigned);
>  extern void xgifb_reg_and(unsigned long, u8, unsigned);
>  extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned);
>  #endif
> -

These changes are not really "comment cleaning".

A.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
  2012-07-05 17:24   ` Aaro Koskinen
@ 2012-07-05 17:35   ` Joe Perches
  2012-07-06  8:02     ` Miguel Gómez
  2012-07-05 20:35   ` Dan Carpenter
  2 siblings, 1 reply; 56+ messages in thread
From: Joe Perches @ 2012-07-05 17:35 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter, devel, linux-kernel

On Thu, 2012-07-05 at 16:45 +0200, Miguel Gómez wrote:
> Remove commented code and useless comments. Leave only those with relevant
> hints to the code.

[]

> diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
[]
> @@ -1,9 +1,3 @@
> -/*
> - * XG20, XG21, XG40, XG42 frame buffer device
> - * for Linux kernels  2.5.x, 2.6.x
> - * Base on TW's sis fbdev code.
> - */

Maybe the comment removal is a bit aggressive.
Perhaps two of these are relevant comments.

> diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
[]
> @@ -79,7 +79,4 @@ struct xgi_hw_device_info {
>  	unsigned long ulCRT2LCDType; /* defined in the data structure type */
>  };
>  
> -/* Additional IOCTL for communication xgifb <> X driver        */
> -/* If changing this, xgifb.h must also be changed (for xgifb) */
>  #endif
> -

Maybe this too.

>From a quick glance, the rest of the patches look like
nice cleanups.

btw: most kernel code uses logical line continuations
at the end of the line not at the beginning of the next
line.

ie:
	if (foo &&
	    bar)
not
	if (foo
	    && bar)

cheers, Joe


^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 05/19] Staging: xgifb: Improve debug strings.
  2012-07-05 14:45 ` [PATCH 05/19] Staging: xgifb: Improve debug strings Miguel Gómez
@ 2012-07-05 17:42   ` Aaro Koskinen
  2012-07-06  8:09     ` Miguel Gómez
  0 siblings, 1 reply; 56+ messages in thread
From: Aaro Koskinen @ 2012-07-05 17:42 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi,

On Thu, Jul 05, 2012 at 04:45:48PM +0200, Miguel Gómez wrote:
>  	if (!htotal || !vtotal) {
> -		pr_debug("XGIfb: Invalid 'var' information\n");
> +		pr_debug("Invalid 'var' information\n");
[...]
> -		pr_err("xgifb: invalid value for option: %s\n", fullopt);
> +		pr_err("Invalid value for option: %s\n", fullopt);
[...]
> -	pr_info("xgifb: options: %s\n", options);
> +	pr_info("Options: %s\n", options);

Can you really remove the driver prefix?

>  	if (reg1 != 0xa1) { /*I/O error */
> -		dev_err(&pdev->dev, "I/O error!!!");
> +		dev_err(&pdev->dev, "I/O error!!!\n");

Those exclamation marks are just redundant noise.

> -		dev_err(&pdev->dev, "unable request memory size %x\n",
> +		dev_err(&pdev->dev, "Unable request memory size %x\n",
[...]
> -		dev_err(&pdev->dev, "no supported video mode found\n");
> +		dev_err(&pdev->dev, "No supported video mode found\n");
[...]
> -		dev_info(&pdev->dev, "added MTRR\n");
> +		dev_info(&pdev->dev, "Added MTRR\n");
[...]
> -		dev_err(&pdev->dev, "video BIOS not available\n");
> +		dev_err(&pdev->dev, "Video BIOS not available\n");
[...]
> -	dev_err(&pdev->dev, "video BIOS corrupted\n");
> +	dev_err(&pdev->dev, "Video BIOS corrupted\n");

What is the improvement?

A.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-05 14:45 ` [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
@ 2012-07-05 18:00   ` Aaro Koskinen
  2012-07-06  8:12     ` Miguel Gómez
  2012-07-06  6:51   ` Dan Carpenter
  1 sibling, 1 reply; 56+ messages in thread
From: Aaro Koskinen @ 2012-07-05 18:00 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi,

On Thu, Jul 05, 2012 at 04:45:58PM +0200, Miguel Gómez wrote:
> +		if ((pVBInfo->VBType & VB_SIS301LV) &&
> +		    !(pVBInfo->TVInfo & TVSetHiVision)) {
> +			if ((pVBInfo->TVInfo & TVSimuMode) &&
> +			    (pVBInfo->TVInfo & TVSetPAL)) {
> +				if (pVBInfo->VBType & VB_SIS301LV) {
> +					if (!(pVBInfo->TVInfo &
> +					      (TVSetYPbPr525p |
> +					       TVSetYPbPr750p |
> +					       TVSetHiVision)))
> +						tempbx += 40;
> +				} else {
> +					tempbx += 40;

I think this could be simplified even more - both branches end up doing
the same?!

A.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
  2012-07-05 17:24   ` Aaro Koskinen
  2012-07-05 17:35   ` Joe Perches
@ 2012-07-05 20:35   ` Dan Carpenter
  2012-07-06  8:14     ` Miguel Gómez
  2 siblings, 1 reply; 56+ messages in thread
From: Dan Carpenter @ 2012-07-05 20:35 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel

This is sent as:

Content-Transfer-Encoding: base64

Which sucks...

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-05 14:45 ` [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
  2012-07-05 18:00   ` Aaro Koskinen
@ 2012-07-06  6:51   ` Dan Carpenter
  2012-07-06  9:04     ` Miguel Gómez
  1 sibling, 1 reply; 56+ messages in thread
From: Dan Carpenter @ 2012-07-06  6:51 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel

On Thu, Jul 05, 2012 at 04:45:58PM +0200, Miguel Gómez wrote:
> Rework some conditions to reduce indentation and fix style warnings.
> 
> Signed-off-by: Miguel Gómez <magomez@igalia.com>
> ---
>  drivers/staging/xgifb/vb_setmode.c |   29 ++++++++++++-----------------
>  1 file changed, 12 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> index a7ba99f..b439f59 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -4039,23 +4039,18 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
>  	}
>  
>  	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
> -		if (pVBInfo->VBType & VB_SIS301LV) {
> -			if (pVBInfo->TVInfo & TVSetHiVision) {
> -				tempbx -= 10;

We drop this -= 10 in the final.  It seems accidental.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 17:24   ` Aaro Koskinen
@ 2012-07-06  8:00     ` Miguel Gómez
  0 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  8:00 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi!

> Some minor comments below:
>
>> -/*
>> - * XG20, XG21, XG40, XG42 frame buffer device
>> - * for Linux kernels  2.5.x, 2.6.x
>> - * Base on TW's sis fbdev code.
>
> A lot of code was copy-pasted from Thomas Winischhofer's sisfb driver,
> I'm not sure if it's OK to remove the credit...?

You're right. I'll keep the credit.

>> -		/* TW: We can't switch off CRT1 on LVDS/Chrontel
>> +		/* We can't switch off CRT1 on LVDS/Chrontel
>>   		 * in 8bpp Modes */
>>   		if ((xgifb_info->hasVB == HASVB_LVDS) ||
>>   		    (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
>>   			doit = 0;
>>   		}
>> -		/* TW: We can't switch off CRT1 on 301B-DH
>> +		/* We can't switch off CRT1 on 301B-DH
>>                 * in 8bpp Modes if using LCD */
>
> These could be also fixed according to multiline comment style at the
> same go.

Written down for the next version ;)

>> diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h
>> index a27b4fe..be5589c 100644
>> --- a/drivers/staging/xgifb/vb_init.h
>> +++ b/drivers/staging/xgifb/vb_init.h
>> @@ -3,4 +3,3 @@
>>   extern unsigned char XGIInitNew(struct pci_dev *pdev);
>>   extern struct XGI21_LVDSCapStruct  XGI21_LCDCapList[13];
>>   #endif
>> -
> [...]
>> diff --git a/drivers/staging/xgifb/vb_util.h b/drivers/staging/xgifb/vb_util.h
>> index 9161de1..ff40247 100644
>> --- a/drivers/staging/xgifb/vb_util.h
>> +++ b/drivers/staging/xgifb/vb_util.h
>> @@ -6,4 +6,3 @@ extern void xgifb_reg_or(unsigned long, u8, unsigned);
>>   extern void xgifb_reg_and(unsigned long, u8, unsigned);
>>   extern void xgifb_reg_and_or(unsigned long, u8, unsigned, unsigned);
>>   #endif
>> -
>
> These changes are not really "comment cleaning".

Mmmm no they aren't... seems I committed them by mistake while I was 
berserker cleaning XD... I'll remove them.

-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 17:35   ` Joe Perches
@ 2012-07-06  8:02     ` Miguel Gómez
  0 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  8:02 UTC (permalink / raw)
  To: Joe Perches
  Cc: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter, devel, linux-kernel

Hi!

>> diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
> []
>> @@ -1,9 +1,3 @@
>> -/*
>> - * XG20, XG21, XG40, XG42 frame buffer device
>> - * for Linux kernels  2.5.x, 2.6.x
>> - * Base on TW's sis fbdev code.
>> - */
>
> Maybe the comment removal is a bit aggressive.
> Perhaps two of these are relevant comments.
>
>> diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
> []
>> @@ -79,7 +79,4 @@ struct xgi_hw_device_info {
>>   	unsigned long ulCRT2LCDType; /* defined in the data structure type */
>>   };
>>
>> -/* Additional IOCTL for communication xgifb <> X driver        */
>> -/* If changing this, xgifb.h must also be changed (for xgifb) */
>>   #endif
>> -
>
> Maybe this too.

Yes, true, Point taken :)

>  From a quick glance, the rest of the patches look like
> nice cleanups.
>
> btw: most kernel code uses logical line continuations
> at the end of the line not at the beginning of the next
> line.
>
> ie:
> 	if (foo &&
> 	    bar)
> not
> 	if (foo
> 	    && bar)

Thanks for the tip! I wasn't really sure about the preferred way to do it.

Regards!

-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 05/19] Staging: xgifb: Improve debug strings.
  2012-07-05 17:42   ` Aaro Koskinen
@ 2012-07-06  8:09     ` Miguel Gómez
  0 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  8:09 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi!

> On Thu, Jul 05, 2012 at 04:45:48PM +0200, Miguel Gómez wrote:
>>   	if (!htotal || !vtotal) {
>> -		pr_debug("XGIfb: Invalid 'var' information\n");
>> +		pr_debug("Invalid 'var' information\n");
> [...]
>> -		pr_err("xgifb: invalid value for option: %s\n", fullopt);
>> +		pr_err("Invalid value for option: %s\n", fullopt);
> [...]
>> -	pr_info("xgifb: options: %s\n", options);
>> +	pr_info("Options: %s\n", options);
>
> Can you really remove the driver prefix?

As the pr format is defined as

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

it will include the module name for free.

>>   	if (reg1 != 0xa1) { /*I/O error */
>> -		dev_err(&pdev->dev, "I/O error!!!");
>> +		dev_err(&pdev->dev, "I/O error!!!\n");
>
> Those exclamation marks are just redundant noise.

Written down for the next round ;)

>> -		dev_err(&pdev->dev, "unable request memory size %x\n",
>> +		dev_err(&pdev->dev, "Unable request memory size %x\n",
> [...]
>> -		dev_err(&pdev->dev, "no supported video mode found\n");
>> +		dev_err(&pdev->dev, "No supported video mode found\n");
> [...]
>> -		dev_info(&pdev->dev, "added MTRR\n");
>> +		dev_info(&pdev->dev, "Added MTRR\n");
> [...]
>> -		dev_err(&pdev->dev, "video BIOS not available\n");
>> +		dev_err(&pdev->dev, "Video BIOS not available\n");
> [...]
>> -	dev_err(&pdev->dev, "video BIOS corrupted\n");
>> +	dev_err(&pdev->dev, "Video BIOS corrupted\n");
>
> What is the improvement?

Capitalizing the first letter, just to keep coherency. It's not the most 
important change in the world, but it's nice :)

Regards!

-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-05 18:00   ` Aaro Koskinen
@ 2012-07-06  8:12     ` Miguel Gómez
  0 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  8:12 UTC (permalink / raw)
  To: Aaro Koskinen; +Cc: arnaud.patard, gregkh, dan.carpenter, devel, linux-kernel

Hi!

> On Thu, Jul 05, 2012 at 04:45:58PM +0200, Miguel Gómez wrote:
>> +		if ((pVBInfo->VBType & VB_SIS301LV) &&
>> +		    !(pVBInfo->TVInfo & TVSetHiVision)) {
>> +			if ((pVBInfo->TVInfo & TVSimuMode) &&
>> +			    (pVBInfo->TVInfo & TVSetPAL)) {
>> +				if (pVBInfo->VBType & VB_SIS301LV) {
>> +					if (!(pVBInfo->TVInfo &
>> +					      (TVSetYPbPr525p |
>> +					       TVSetYPbPr750p |
>> +					       TVSetHiVision)))
>> +						tempbx += 40;
>> +				} else {
>> +					tempbx += 40;
>
> I think this could be simplified even more - both branches end up doing
> the same?!

I'll give it a look again :)

Regards!


-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 01/19] Staging: xgifb: Comment cleaning.
  2012-07-05 20:35   ` Dan Carpenter
@ 2012-07-06  8:14     ` Miguel Gómez
  0 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  8:14 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel

> This is sent as:
>
> Content-Transfer-Encoding: base64
>
> Which sucks...

... weird... not sure why send-email decided to use base64 instead of 
8bit... when I finish with the proposed changes I'll send the whole 
round again removing that base64.

Regards! :)

-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-06  6:51   ` Dan Carpenter
@ 2012-07-06  9:04     ` Miguel Gómez
  2012-07-06 10:27       ` Dan Carpenter
  0 siblings, 1 reply; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06  9:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: arnaud.patard, gregkh, aaro.koskinen, devel, linux-kernel

> On Thu, Jul 05, 2012 at 04:45:58PM +0200, Miguel Gómez wrote:
>> Rework some conditions to reduce indentation and fix style warnings.
>>
>> Signed-off-by: Miguel Gómez <magomez@igalia.com>
>> ---
>>   drivers/staging/xgifb/vb_setmode.c |   29 ++++++++++++-----------------
>>   1 file changed, 12 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
>> index a7ba99f..b439f59 100644
>> --- a/drivers/staging/xgifb/vb_setmode.c
>> +++ b/drivers/staging/xgifb/vb_setmode.c
>> @@ -4039,23 +4039,18 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
>>   	}
>>
>>   	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
>> -		if (pVBInfo->VBType & VB_SIS301LV) {
>> -			if (pVBInfo->TVInfo & TVSetHiVision) {
>> -				tempbx -= 10;
>
> We drop this -= 10 in the final.  It seems accidental.

Nope, it's done on purpose. I've joined 2 conditions that were like this

if (pVBInfo->VBType & VB_SIS301LV) {
	if (pVBInfo->TVInfo & TVSetHiVision) {
		tempbx -= 10;
	} else {
		/* internal stuff */
	}
} else {
	tempbx -= 10;
}

into a single one like this

if ((pVBInfo->VBType & VB_SIS301LV) &&
     !(pVBInfo->TVInfo & TVSetHiVision)) {
	/* internal stuff */
} else {
	tempbx -= 10;
}

That's why one of the else branches has been removed.


-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-06  9:04     ` Miguel Gómez
@ 2012-07-06 10:27       ` Dan Carpenter
  0 siblings, 0 replies; 56+ messages in thread
From: Dan Carpenter @ 2012-07-06 10:27 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: devel, gregkh, linux-kernel, arnaud.patard, aaro.koskinen

On Fri, Jul 06, 2012 at 11:04:15AM +0200, Miguel Gómez wrote:
> >On Thu, Jul 05, 2012 at 04:45:58PM +0200, Miguel Gómez wrote:
> >>Rework some conditions to reduce indentation and fix style warnings.
> >>
> >>Signed-off-by: Miguel Gómez <magomez@igalia.com>
> >>---
> >>  drivers/staging/xgifb/vb_setmode.c |   29 ++++++++++++-----------------
> >>  1 file changed, 12 insertions(+), 17 deletions(-)
> >>
> >>diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> >>index a7ba99f..b439f59 100644
> >>--- a/drivers/staging/xgifb/vb_setmode.c
> >>+++ b/drivers/staging/xgifb/vb_setmode.c
> >>@@ -4039,23 +4039,18 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
> >>  	}
> >>
> >>  	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
> >>-		if (pVBInfo->VBType & VB_SIS301LV) {
> >>-			if (pVBInfo->TVInfo & TVSetHiVision) {
> >>-				tempbx -= 10;
> >
> >We drop this -= 10 in the final.  It seems accidental.
> 
> Nope, it's done on purpose.

Ah.  You are right.  Sorry for the noise.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 00/19 v2] Several cleanings and style fixes
  2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
                   ` (18 preceding siblings ...)
  2012-07-05 14:46 ` [PATCH 19/19] Staging: xgifb: Remove useless condition Miguel Gómez
@ 2012-07-06 10:40 ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 01/19 v2] Staging: xgifb: Comment cleaning Miguel Gómez
                     ` (18 more replies)
  19 siblings, 19 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Hi!

Second version of the patches round containing suggestions made
to the first version:

* patch 0001:
** keep some useful comments.
** format a couple of multiline comments
** don't remove empty lines in vb_util.h and vb_init.h

* patch 0005:
** remove exclamation marks from a string

* patch 0015
** simplify a bit more by joining another couple of conditions

* patch 0017
** replace do-while with gotos

* patch 0018
** move some comments to previous line instead of modifying them

Also, I'm sending all of the patches again because they were encoded in
base64 instead of 8bit.

Regards!

Miguel Gómez (19):
  Staging: xgifb: Comment cleaning.
  Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
  Staging: xgifb: Remove LCDA detection in xgifb_probe().
  Staging: xgifb: Remove unused struct _chswtable.
  Staging: xgifb: Improve debug strings.
  Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
  Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
  Staging: xgifb: Remove unneeded var and condition in
    XGIfb_search_vesamode().
  Staging: xgifb: Remove useless always true condition.
  Staging: xgifb: Rework conditions in XGI_SetATTRegs().
  Staging: xgifb: Refactor XGI_AjustCRT2Rate().
  Staging: xgifb: Refactor XGI_GetVBType().
  Staging: xgifb: Rework conditions in XGI_GetVBInfo().
  Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
  Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  Staging: xgifb: Rework conditions in XGI_EnableBridge().
  Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
  Staging: xgifb: Fix coding style.
  Staging: xgifb: Remove useless condition.

 drivers/staging/xgifb/XGI_main.h    |   14 -
 drivers/staging/xgifb/XGI_main_26.c |  247 +++---------
 drivers/staging/xgifb/XGIfb.h       |    8 +-
 drivers/staging/xgifb/vb_def.h      |    3 -
 drivers/staging/xgifb/vb_init.c     |  166 +-------
 drivers/staging/xgifb/vb_setmode.c  |  747 ++++++++++++++++-------------------
 drivers/staging/xgifb/vb_struct.h   |    3 -
 drivers/staging/xgifb/vb_table.h    |   65 ++-
 drivers/staging/xgifb/vgatypes.h    |   34 --
 9 files changed, 455 insertions(+), 832 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 56+ messages in thread

* [PATCH 01/19 v2] Staging: xgifb: Comment cleaning.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 02/19 v2] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
                     ` (17 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Remove commented code and useless comments. Leave only those with relevant
hints to the code.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main.h    |    4 -
 drivers/staging/xgifb/XGI_main_26.c |  133 ++++--------------------------
 drivers/staging/xgifb/XGIfb.h       |    8 +-
 drivers/staging/xgifb/vb_def.h      |    3 -
 drivers/staging/xgifb/vb_init.c     |  155 ++++-------------------------------
 drivers/staging/xgifb/vb_setmode.c  |   26 +++---
 drivers/staging/xgifb/vb_struct.h   |    3 -
 drivers/staging/xgifb/vb_table.h    |   35 +++-----
 8 files changed, 61 insertions(+), 306 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index be6bb7d..1686c5a 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -68,9 +68,6 @@ static int XGIfb_crt2type = -1;
 /* PR: Tv plug type (for overriding autodetection) */
 static int XGIfb_tvplug = -1;
 
-/* TW: For ioctl XGIFB_GET_INFO */
-/* XGIfb_info XGIfbinfo; */
-
 #define MD_XGI315 1
 
 /* mode table */
@@ -240,7 +237,6 @@ static const struct _chswtable {
 	{ 0,      0,      ""       , ""       }
 };
 
-/* Eden Chen */
 static const struct _XGI_TV_filter {
 	u8 filter[9][4];
 } XGI_TV_filter[] = {
diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index fe9061d..b226458 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -36,36 +36,6 @@ static void dumpVGAReg(void)
 	u8 i, reg;
 
 	xgifb_reg_set(XGISR, 0x05, 0x86);
-	/*
-	xgifb_reg_set(XGISR, 0x08, 0x4f);
-	xgifb_reg_set(XGISR, 0x0f, 0x20);
-	xgifb_reg_set(XGISR, 0x11, 0x4f);
-	xgifb_reg_set(XGISR, 0x13, 0x45);
-	xgifb_reg_set(XGISR, 0x14, 0x51);
-	xgifb_reg_set(XGISR, 0x1e, 0x41);
-	xgifb_reg_set(XGISR, 0x1f, 0x0);
-	xgifb_reg_set(XGISR, 0x20, 0xa1);
-	xgifb_reg_set(XGISR, 0x22, 0xfb);
-	xgifb_reg_set(XGISR, 0x26, 0x22);
-	xgifb_reg_set(XGISR, 0x3e, 0x07);
-	*/
-
-	/* xgifb_reg_set(XGICR, 0x19, 0x00); */
-	/* xgifb_reg_set(XGICR, 0x1a, 0x3C); */
-	/* xgifb_reg_set(XGICR, 0x22, 0xff); */
-	/* xgifb_reg_set(XGICR, 0x3D, 0x10); */
-
-	/* xgifb_reg_set(XGICR, 0x4a, 0xf3); */
-
-	/* xgifb_reg_set(XGICR, 0x57, 0x0); */
-	/* xgifb_reg_set(XGICR, 0x7a, 0x2c); */
-
-	/* xgifb_reg_set(XGICR, 0x82, 0xcc); */
-	/* xgifb_reg_set(XGICR, 0x8c, 0x0); */
-	/*
-	xgifb_reg_set(XGICR, 0x99, 0x1);
-	xgifb_reg_set(XGICR, 0x41, 0x40);
-	*/
 
 	for (i = 0; i < 0x4f; i++) {
 		reg = xgifb_reg_get(XGISR, i);
@@ -78,30 +48,6 @@ static void dumpVGAReg(void)
 		pr_debug("\no 3d4 %x", i);
 		pr_debug("\ni 3d5 => %x", reg);
 	}
-	/*
-	xgifb_reg_set(XGIPART1,0x2F,1);
-	for (i=1; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART1, i);
-		pr_debug("\no d004 %x", i);
-		pr_debug("\ni d005 => %x", reg);
-	}
-
-	for (i=0; i < 0x50; i++) {
-		 reg = xgifb_reg_get(XGIPART2, i);
-		 pr_debug("\no d010 %x", i);
-		 pr_debug("\ni d011 => %x", reg);
-	}
-	for (i=0; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART3, i);
-		pr_debug("\no d012 %x",i);
-		pr_debug("\ni d013 => %x",reg);
-	}
-	for (i=0; i < 0x50; i++) {
-		reg = xgifb_reg_get(XGIPART4, i);
-		pr_debug("\no d014 %x",i);
-		pr_debug("\ni d015 => %x",reg);
-	}
-	*/
 }
 #else
 static inline void dumpVGAReg(void)
@@ -215,15 +161,6 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
 			| ((unsigned short) (sr_data & 0x01) << 10);
 	A = VT + 2;
 
-	/* cr_data = XGI_Pr->XGINEWUB_CRT1Table[index].CR[10]; */
-
-	/* Vertical display enable end */
-	/*
-	VDE = (cr_data & 0xff) |
-		((unsigned short) (cr_data2 & 0x02) << 7) |
-		((unsigned short) (cr_data2 & 0x40) << 3) |
-		((unsigned short) (sr_data & 0x02) << 9);
-	*/
 	VDE = XGI_Pr->RefIndex[RefreshRateTableIndex].YRes - 1;
 	E = VDE + 1;
 
@@ -590,7 +527,7 @@ static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
 				if (XGIbios_mode[myindex].yres != 576)
 					return -1;
 			}
-			/*  TW: LVDS/CHRONTEL does not support 720 */
+			/* LVDS/CHRONTEL does not support 720 */
 			if (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL ||
 			    xgifb_info->hasVB == HASVB_CHRONTEL) {
 				return -1;
@@ -794,26 +731,25 @@ static void XGIfb_post_setmode(struct xgifb_video_info *xgifb_info)
 {
 	u8 reg;
 	unsigned char doit = 1;
-	/*
-	xgifb_reg_set(XGISR,IND_SIS_PASSWORD,SIS_PASSWORD);
-	xgifb_reg_set(XGICR, 0x13, 0x00);
-	xgifb_reg_and_or(XGISR,0x0E, 0xF0, 0x01);
-	*test*
-	*/
+
 	if (xgifb_info->video_bpp == 8) {
-		/* TW: We can't switch off CRT1 on LVDS/Chrontel
-		 * in 8bpp Modes */
+		/*
+		 * We can't switch off CRT1 on LVDS/Chrontel
+		 * in 8bpp Modes
+		 */
 		if ((xgifb_info->hasVB == HASVB_LVDS) ||
 		    (xgifb_info->hasVB == HASVB_LVDS_CHRONTEL)) {
 			doit = 0;
 		}
-		/* TW: We can't switch off CRT1 on 301B-DH
-		 * in 8bpp Modes if using LCD */
+		/*
+		 * We can't switch off CRT1 on 301B-DH
+		 * in 8bpp Modes if using LCD
+		 */
 		if (xgifb_info->display2 == XGIFB_DISP_LCD)
 			doit = 0;
 	}
 
-	/* TW: We can't switch off CRT1 if bridge is in slave mode */
+	/* We can't switch off CRT1 if bridge is in slave mode */
 	if (xgifb_info->hasVB != HASVB_NONE) {
 		reg = xgifb_reg_get(XGIPART1, 0x00);
 
@@ -1038,7 +974,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	unsigned int drate = 0, hrate = 0;
 	int found_mode = 0;
 	int old_mode;
-	/* unsigned char reg, reg1; */
 
 	info->var.xres_virtual = var->xres_virtual;
 	info->var.yres_virtual = var->yres_virtual;
@@ -1049,8 +984,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
 		vtotal <<= 2;
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
-		/* vtotal <<= 1; */
-		/* var->yres <<= 1; */
 	}
 
 	if (!htotal || !vtotal) {
@@ -1388,16 +1321,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		xgifb_info->refresh_rate = 60;
 	}
 
-	/*
-	if ((var->pixclock) && (htotal)) {
-		drate = 1E12 / var->pixclock;
-		hrate = drate / htotal;
-		refresh_rate = (unsigned int) (hrate / vtotal * 2 + 0.5);
-	} else {
-		refresh_rate = 60;
-	}
-	*/
-	/* TW: Calculation wrong for 1024x600 - force it to 60Hz */
+	/* Calculation wrong for 1024x600 - force it to 60Hz */
 	if ((var->xres == 1024) && (var->yres == 600))
 		refresh_rate = 60;
 
@@ -1446,8 +1370,6 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 		}
 	}
 
-	/* TW: TODO: Check the refresh rate */
-
 	/* Adapt RGB settings */
 	XGIfb_bpp_to_var(xgifb_info, var);
 
@@ -1462,16 +1384,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 			var->xres_virtual = var->xres;
 		if (var->yres != var->yres_virtual)
 			var->yres_virtual = var->yres;
-	} /* else { */
-		/* TW: Now patch yres_virtual if we use panning */
-		/* May I do this? */
-		/* var->yres_virtual = xgifb_info->heapstart /
-			(var->xres * (var->bits_per_pixel >> 3)); */
-		/* if (var->yres_virtual <= var->yres) { */
-		/* TW: Paranoia check */
-		/* var->yres_virtual = var->yres; */
-		/* } */
-	/* } */
+	}
 
 	/* Truncate offsets to maximum if too high */
 	if (var->xoffset > var->xres_virtual - var->xres)
@@ -1553,7 +1466,6 @@ static struct fb_ops XGIfb_ops = {
 	.fb_fillrect = cfb_fillrect,
 	.fb_copyarea = cfb_copyarea,
 	.fb_imageblit = cfb_imageblit,
-	/* .fb_mmap = XGIfb_mmap, */
 };
 
 /* ---------------- Chip generation dependent routines ---------------- */
@@ -1630,9 +1542,6 @@ static int XGIfb_get_dram_size(struct xgifb_video_info *xgifb_info)
 	}
 
 	xgifb_info->video_size = xgifb_info->video_size * ChannelNum;
-	/* PLiad fixed for benchmarking and fb set */
-	/* xgifb_info->video_size = 0x200000; */ /* 1024x768x16 */
-	/* xgifb_info->video_size = 0x1000000; */ /* benchmark */
 
 	pr_info("SR14=%x DramSzie %x ChannelNum %x\n",
 	       reg,
@@ -1680,7 +1589,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 	}
 
 	if (XGIfb_tvplug != -1)
-		/* PR/TW: Override with option */
+		/* Override with option */
 		xgifb_info->TV_plug = XGIfb_tvplug;
 	else if (cr32 & SIS_VB_HIVISION) {
 		xgifb_info->TV_type = TVMODE_HIVISION;
@@ -1700,7 +1609,7 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 			xgifb_info->TV_type = TVMODE_NTSC;
 	}
 
-	/* TW: Copy forceCRT1 option to CRT1off if option is given */
+	/* Copy forceCRT1 option to CRT1off if option is given */
 	if (XGIfb_forcecrt1 != -1) {
 		if (XGIfb_forcecrt1)
 			XGIfb_crt1off = 0;
@@ -1794,7 +1703,7 @@ static int __init XGIfb_setup(char *options)
 			XGIfb_search_tvstd(this_opt + 7);
 		} else if (!strncmp(this_opt, "dstn", 4)) {
 			enable_dstn = 1;
-			/* TW: DSTN overrules forcecrt2type */
+			/* DSTN overrules forcecrt2type */
 			XGIfb_crt2type = XGIFB_DISP_LCD;
 		} else if (!strncmp(this_opt, "noypan", 6)) {
 			XGIfb_ypan = 0;
@@ -1981,13 +1890,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 			dev_info(&pdev->dev,
 				 "XGI301LV bridge detected (revision 0x%02x)\n",
 				 reg);
-		}
-		/* else if (reg >= 0xB0) {
-			hw_info->ujVBChipID = VB_CHIP_301B;
-			reg1 = xgifb_reg_get(XGIPART4, 0x23);
-			pr_debug("XGIfb: XGI301B bridge detected\n");
-		} */
-		else {
+		} else {
 			hw_info->ujVBChipID = VB_CHIP_301;
 			dev_info(&pdev->dev, "XGI301 bridge detected\n");
 		}
@@ -2104,7 +2007,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		goto error_1;
 	}
 
-	/* yilin set default refresh rate */
+	/* set default refresh rate */
 	xgifb_info->refresh_rate = refresh_rate;
 	if (xgifb_info->refresh_rate == 0)
 		xgifb_info->refresh_rate = 60;
diff --git a/drivers/staging/xgifb/XGIfb.h b/drivers/staging/xgifb/XGIfb.h
index 741bba3..8054798 100644
--- a/drivers/staging/xgifb/XGIfb.h
+++ b/drivers/staging/xgifb/XGIfb.h
@@ -30,13 +30,13 @@ enum xgi_tvtype {
 	TVMODE_NTSC = 0,
 	TVMODE_PAL,
 	TVMODE_HIVISION,
-	TVTYPE_PALM,	/* vicki@030226 */
-	TVTYPE_PALN,	/* vicki@030226 */
-	TVTYPE_NTSCJ,	/* vicki@030226 */
+	TVTYPE_PALM,
+	TVTYPE_PALN,
+	TVTYPE_NTSCJ,
 	TVMODE_TOTAL
 };
 
-enum xgi_tv_plug { /* vicki@030226 */
+enum xgi_tv_plug {
 	TVPLUG_UNKNOWN = 0,
 	TVPLUG_COMPOSITE = 1,
 	TVPLUG_SVIDEO = 2,
diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h
index 5b987a6..69078d9 100644
--- a/drivers/staging/xgifb/vb_def.h
+++ b/drivers/staging/xgifb/vb_def.h
@@ -1,5 +1,3 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/xgi/initdef.h
- * ,v 1.4 2000/12/02 01:16:17 dawes Exp $*/
 #ifndef _VB_DEF_
 #define _VB_DEF_
 #include "../../video/sis/initdef.h"
@@ -12,7 +10,6 @@
 #define SetCHTVOverScan         0x8000
 
 #define Panel_320x480            0x07 /*fstn*/
-/* [ycchen] 02/12/03 Modify for Multi-Sync. LCD Support */
 #define PanelResInfo            0x1F /* CR36 Panel Type/LCDResInfo */
 #define Panel_1024x768x75        0x22
 #define Panel_1280x1024x75       0x23
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 7c555a7..6bb0206 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1,4 +1,4 @@
-#include <linux/delay.h> /* udelay */
+#include <linux/delay.h>
 #include <linux/vmalloc.h>
 
 #include "XGIfb.h"
@@ -132,10 +132,8 @@ static void XGINew_SetMemoryClock(struct xgi_hw_device_info *HwDeviceExtension,
 		      0x30,
 		      pVBInfo->ECLKData[pVBInfo->ram_type].SR30);
 
-	/* [Vicent] 2004/07/07,
-	 * When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
-	/* [Hsuan] 2004/08/20,
-	 * Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
+	/* When XG42 ECLK = MCLK = 207MHz, Set SR32 D[1:0] = 10b */
+	/* Modify SR32 value, when MCLK=207MHZ, ELCK=250MHz,
 	 * Set SR32 D[1:0] = 10b */
 	if (HwDeviceExtension->jChipType == XG42) {
 		if ((pVBInfo->MCLKData[pVBInfo->ram_type].SR28 == 0x1C) &&
@@ -160,7 +158,6 @@ static void XGINew_DDRII_Bootup_XG27(
 	XGINew_SetMemoryClock(HwDeviceExtension, pVBInfo);
 
 	/* Set Double Frequency */
-	/* xgifb_reg_set(P3d4, 0x97, 0x11); *//* CR97 */
 	xgifb_reg_set(P3d4, 0x97, pVBInfo->XGINew_CR97); /* CR97 */
 
 	udelay(200);
@@ -192,7 +189,6 @@ static void XGINew_DDRII_Bootup_XG27(
 	udelay(30);
 	xgifb_reg_set(P3c4, 0x16, 0x00); /* Set SR16 */
 	xgifb_reg_set(P3c4, 0x16, 0x80); /* Set SR16 */
-	/* udelay(15); */
 
 	xgifb_reg_set(P3c4, 0x1B, 0x04); /* Set SR1B */
 	udelay(60);
@@ -252,7 +248,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(P3c4, 0x16, 0x05);
 	xgifb_reg_set(P3c4, 0x16, 0x85);
 
-	/* xgifb_reg_set(P3c4, 0x18, 0x52); */ /* MRS1 */
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x02);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
@@ -264,7 +259,6 @@ static void XGINew_DDR2_MRS_XG20(struct xgi_hw_device_info *HwDeviceExtension,
 	xgifb_reg_set(P3c4, 0x1B, 0x00); /* SR1B */
 	udelay(100);
 
-	/* xgifb_reg_set(P3c4 ,0x18, 0x52); */ /* MRS2 */
 	xgifb_reg_set(P3c4, 0x18, 0x42); /* MRS1 */
 	xgifb_reg_set(P3c4, 0x19, 0x00);
 	xgifb_reg_set(P3c4, 0x16, 0x05);
@@ -290,14 +284,12 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4,
 	xgifb_reg_set(P3c4,
 		      0x18,
 		      pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */
-	/* xgifb_reg_set(P3c4, 0x18, 0x31); */
 	xgifb_reg_set(P3c4, 0x19, 0x01);
 	xgifb_reg_set(P3c4, 0x16, 0x03);
 	xgifb_reg_set(P3c4, 0x16, 0x83);
 	mdelay(1);
 	xgifb_reg_set(P3c4, 0x1B, 0x03);
 	udelay(500);
-	/* xgifb_reg_set(P3c4, 0x18, 0x31); */
 	xgifb_reg_set(P3c4,
 		      0x18,
 		      pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */
@@ -546,7 +538,6 @@ static void XGINew_SetDRAMDefaultRegister340(
 	xgifb_reg_set(P3d4, 0x87, 0x00); /* CR87 */
 	xgifb_reg_set(P3d4, 0xCF, XG40_CRCF); /* CRCF */
 	if (pVBInfo->ram_type) {
-		/* xgifb_reg_set(P3c4, 0x17, 0xC0); */ /* SR17 DDRII */
 		xgifb_reg_set(P3c4, 0x17, 0x80); /* SR17 DDRII */
 		if (HwDeviceExtension->jChipType == XG27)
 			xgifb_reg_set(P3c4, 0x17, 0x02); /* SR17 DDRII */
@@ -597,19 +588,12 @@ static unsigned short XGINew_SetDRAMSize20Reg(
 
 		memsize = data >> 4;
 
-		/* [2004/03/25] Vicent, Fix DRAM Sizing Error */
+		/* Fix DRAM Sizing Error */
 		xgifb_reg_set(pVBInfo->P3c4,
 			      0x14,
 			      (xgifb_reg_get(pVBInfo->P3c4, 0x14) & 0x0F) |
 				(data & 0xF0));
 		udelay(15);
-
-		/* data |= pVBInfo->ram_channel << 2; */
-		/* data |= (pVBInfo->ram_bus / 64) << 1; */
-		/* xgifb_reg_set(pVBInfo->P3c4, 0x14, data); */
-
-		/* should delay */
-		/* XGINew_SetDRAMModeRegister340(pVBInfo); */
 	}
 	return memsize;
 }
@@ -628,8 +612,7 @@ static int XGINew_ReadWriteRest(unsigned short StopAddr,
 		writel(Position, fbaddr + Position);
 	}
 
-	udelay(500); /* [Vicent] 2004/04/16.
-			Fix #1759 Memory Size error in Multi-Adapter. */
+	udelay(500); /* Fix #1759 Memory Size error in Multi-Adapter. */
 
 	Position = 0;
 
@@ -925,9 +908,6 @@ static void XGINew_SetDRAMSize_340(struct xgifb_video_info *xgifb_info,
 	xgifb_reg_set(pVBInfo->P3c4, 0x21, (unsigned short) (data & 0xDF));
 	XGI_DisplayOff(xgifb_info, HwDeviceExtension, pVBInfo);
 
-	/* data = xgifb_reg_get(pVBInfo->P3c4, 0x1); */
-	/* data |= 0x20 ; */
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x01, data); *//* Turn OFF Display */
 	XGINew_DDRSizing340(HwDeviceExtension, pVBInfo);
 	data = xgifb_reg_get(pVBInfo->P3c4, 0x21);
 	/* enable read cache */
@@ -1308,16 +1288,11 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	struct vb_device_info VBINF;
 	struct vb_device_info *pVBInfo = &VBINF;
 	unsigned char i, temp = 0, temp1;
-	/* VBIOSVersion[5]; */
-
-	/* unsigned long j, k; */
 
 	pVBInfo->FBAddr = HwDeviceExtension->pjVideoMemoryAddress;
 
 	pVBInfo->BaseAddr = xgifb_info->vga_base;
 
-	/* Newdebugcode(0x99); */
-
 	if (pVBInfo->FBAddr == NULL) {
 		dev_dbg(&pdev->dev, "pVBInfo->FBAddr == 0\n");
 		return 0;
@@ -1331,10 +1306,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	pVBInfo->ISXPDOS = 0;
 
-	/* VBIOSVersion[4] = 0x0; */
-
-	/* 09/07/99 modify by domao */
-
 	pVBInfo->P3c4 = pVBInfo->BaseAddr + 0x14;
 	pVBInfo->P3d4 = pVBInfo->BaseAddr + 0x24;
 	pVBInfo->P3c0 = pVBInfo->BaseAddr + 0x10;
@@ -1353,7 +1324,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	pVBInfo->Part4Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14;
 	pVBInfo->Part5Port = pVBInfo->BaseAddr + SIS_CRT2_PORT_14 + 2;
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20)
 		/* Run XGI_GetVBType before InitTo330Pointer */
 		XGI_GetVBType(pVBInfo);
 
@@ -1361,7 +1332,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	xgifb_read_vbios(pdev, pVBInfo);
 
-	/* 1.Openkey */
+	/* Openkey */
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
 	/* GetXG21Sense (GPIO) */
@@ -1371,7 +1342,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	if (HwDeviceExtension->jChipType == XG27)
 		XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo);
 
-	/* 2.Reset Extended register */
+	/* Reset Extended register */
 
 	for (i = 0x06; i < 0x20; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
@@ -1379,31 +1350,20 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	for (i = 0x21; i <= 0x27; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
 
-	/* for(i = 0x06; i <= 0x27; i++) */
-	/* xgifb_reg_set(pVBInfo->P3c4, i, 0); */
-
 	for (i = 0x31; i <= 0x3B; i++)
 		xgifb_reg_set(pVBInfo->P3c4, i, 0);
 
-	/* [Hsuan] 2004/08/20 Auto over driver for XG42 */
+	/* Auto over driver for XG42 */
 	if (HwDeviceExtension->jChipType == XG42)
 		xgifb_reg_set(pVBInfo->P3c4, 0x3B, 0xC0);
 
-	/* for (i = 0x30; i <= 0x3F; i++) */
-	/* xgifb_reg_set(pVBInfo->P3d4, i, 0); */
-
 	for (i = 0x79; i <= 0x7C; i++)
-		xgifb_reg_set(pVBInfo->P3d4, i, 0); /* shampoo 0208 */
+		xgifb_reg_set(pVBInfo->P3d4, i, 0);
 
 	if (HwDeviceExtension->jChipType >= XG20)
 		xgifb_reg_set(pVBInfo->P3d4, 0x97, pVBInfo->XGINew_CR97);
 
-	/* 3.SetMemoryClock
-
-	pVBInfo->ram_type = XGINew_GetXG20DRAMType(HwDeviceExtension, pVBInfo);
-	*/
-
-	/* 4.SetDefExt1Regs begin */
+	/* SetDefExt1Regs begin */
 	xgifb_reg_set(pVBInfo->P3c4, 0x07, XGI330_SR07);
 	if (HwDeviceExtension->jChipType == XG27) {
 		xgifb_reg_set(pVBInfo->P3c4, 0x40, XG27_SR40);
@@ -1411,62 +1371,16 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	}
 	xgifb_reg_set(pVBInfo->P3c4, 0x11, 0x0F);
 	xgifb_reg_set(pVBInfo->P3c4, 0x1F, XGI330_SR1F);
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x20, 0x20); */
-	/* alan, 2001/6/26 Frame buffer can read/write SR20 */
+	/* Frame buffer can read/write SR20 */
 	xgifb_reg_set(pVBInfo->P3c4, 0x20, 0xA0);
-	/* Hsuan, 2006/01/01 H/W request for slow corner chip */
+	/* H/W request for slow corner chip */
 	xgifb_reg_set(pVBInfo->P3c4, 0x36, 0x70);
-	if (HwDeviceExtension->jChipType == XG27) /* Alan 12/07/2006 */
+	if (HwDeviceExtension->jChipType == XG27)
 		xgifb_reg_set(pVBInfo->P3c4, 0x36, XG27_SR36);
 
-	/* SR11 = 0x0F; */
-	/* xgifb_reg_set(pVBInfo->P3c4, 0x11, SR11); */
-
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		u32 Temp;
 
-		/* Set AGP Rate */
-		/*
-		temp1 = xgifb_reg_get(pVBInfo->P3c4, 0x3B);
-		temp1 &= 0x02;
-		if (temp1 == 0x02) {
-			outl(0x80000000, 0xcf8);
-			ChipsetID = inl(0x0cfc);
-			outl(0x8000002C, 0xcf8);
-			VendorID = inl(0x0cfc);
-			VendorID &= 0x0000FFFF;
-			outl(0x8001002C, 0xcf8);
-			GraphicVendorID = inl(0x0cfc);
-			GraphicVendorID &= 0x0000FFFF;
-
-			if (ChipsetID == 0x7301039)
-				xgifb_reg_set(pVBInfo->P3d4, 0x5F, 0x09);
-
-			ChipsetID &= 0x0000FFFF;
-
-			if ((ChipsetID == 0x700E) ||
-			    (ChipsetID == 0x1022) ||
-			    (ChipsetID == 0x1106) ||
-			    (ChipsetID == 0x10DE)) {
-				if (ChipsetID == 0x1106) {
-					if ((VendorID == 0x1019) &&
-					    (GraphicVendorID == 0x1019))
-						xgifb_reg_set(pVBInfo->P3d4,
-							      0x5F,
-							      0x0D);
-					else
-						xgifb_reg_set(pVBInfo->P3d4,
-							      0x5F,
-							      0x0B);
-				} else {
-					xgifb_reg_set(pVBInfo->P3d4,
-						      0x5F,
-						      0x0B);
-				}
-			}
-		}
-		*/
-
 		/* Set AGP customize registers (in SetDefAGPRegs) Start */
 		for (i = 0x47; i <= 0x4C; i++)
 			xgifb_reg_set(pVBInfo->P3d4,
@@ -1482,12 +1396,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 			xgifb_reg_set(pVBInfo->P3d4,
 				      i,
 				      pVBInfo->AGPReg[8 + i - 0x74]);
-		/* Set AGP customize registers (in SetDefAGPRegs) End */
-		/* [Hsuan]2004/12/14 AGP Input Delay Adjustment on 850 */
-		/*        outl(0x80000000, 0xcf8); */
-		/*        ChipsetID = inl(0x0cfc); */
-		/*        if (ChipsetID == 0x25308086) */
-		/*            xgifb_reg_set(pVBInfo->P3d4, 0x77, 0xF0); */
 
 		pci_read_config_dword(pdev, 0x50, &Temp);
 		Temp >>= 20;
@@ -1502,10 +1410,10 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	xgifb_reg_set(pVBInfo->P3c4, 0x24, XGI330_SR24);
 	xgifb_reg_set(pVBInfo->P3c4, 0x25, XGI330_SR25);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		/* Set VB */
 		XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
-		/* alan, disable VideoCapture */
+		/* disable VideoCapture */
 		xgifb_reg_and_or(pVBInfo->Part0Port, 0x3F, 0xEF, 0x00);
 		xgifb_reg_set(pVBInfo->Part1Port, 0x00, 0x00);
 		/* chk if BCLK>=100MHz */
@@ -1535,10 +1443,7 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 	}
 	xgifb_reg_set(pVBInfo->P3c4, 0x33, XGI330_SR33);
 
-	/*
-	 SetPowerConsume (HwDeviceExtension, pVBInfo->P3c4);	*/
-
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		if (XGI_BridgeIsOn(pVBInfo) == 1) {
 			if (pVBInfo->IF_DEF_LVDS == 0) {
 				xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C);
@@ -1557,7 +1462,6 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	XGI_SenseCRT1(pVBInfo);
 
-	/* XGINew_DetectMonitor(HwDeviceExtension); */
 	if (HwDeviceExtension->jChipType == XG21) {
 
 		xgifb_reg_and_or(pVBInfo->P3d4,
@@ -1585,32 +1489,9 @@ unsigned char XGIInitNew(struct pci_dev *pdev)
 
 	XGINew_SetDRAMSize_340(xgifb_info, HwDeviceExtension, pVBInfo);
 
-	/* SetDefExt2Regs begin */
-	/*
-	AGP = 1;
-	temp = (unsigned char) xgifb_reg_get(pVBInfo->P3c4, 0x3A);
-	temp &= 0x30;
-	if (temp == 0x30)
-		AGP = 0;
-
-	if (AGP == 0)
-		pVBInfo->SR21 &= 0xEF;
-
-	xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21);
-	if (AGP == 1)
-		pVBInfo->SR22 &= 0x20;
-	xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22);
-	*/
-	/* base = 0x80000000; */
-	/* OutPortLong(0xcf8, base); */
-	/* Temp = (InPortLong(0xcfc) & 0xFFFF); */
-	/* if (Temp == 0x1039) { */
 	xgifb_reg_set(pVBInfo->P3c4,
 		      0x22,
 		      (unsigned char) ((pVBInfo->SR22) & 0xFE));
-	/* } else { */
-	/*	xgifb_reg_set(pVBInfo->P3c4, 0x22, pVBInfo->SR22); */
-	/* } */
 
 	xgifb_reg_set(pVBInfo->P3c4, 0x21, pVBInfo->SR21);
 
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 479362e..3ba3c48 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -1859,7 +1859,6 @@ static void *XGI_GetTVPtr(unsigned short BX, unsigned short ModeNo,
 		i++;
 	}
 
-	/* 07/05/22 */
 	if (table == 0x04) {
 		switch (tempdi[i].DATAPTR) {
 		case 0:
@@ -2519,7 +2518,7 @@ static void XGI_UpdateModeInfo(struct xgi_hw_device_info *HwDeviceExtension,
 		temp &= 0x0f;
 
 		if (!(temp == 0x08)) {
-			/* Check ChannelA by Part1_13 [2003/10/03] */
+			/* Check ChannelA */
 			tempax = xgifb_reg_get(pVBInfo->Part1Port, 0x13);
 			if (tempax & 0x04)
 				tempcl = tempcl | ActiveLCD;
@@ -2675,7 +2674,6 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
 		}
 
 		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			/* [Billy] 07/05/04 */
 			if (((pVBInfo->IF_DEF_LVDS == 0) &&
 			    ((pVBInfo->VBType & VB_SIS301LV) ||
 			    (pVBInfo->VBType & VB_SIS302LV) ||
@@ -2927,7 +2925,7 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
 	if (tempbx == 0)
 		tempbx = Panel_1024x768; /* default */
 
-	/* LCD75 [2003/8/22] Vicent */
+	/* LCD75 */
 	if ((tempbx == Panel_1024x768) || (tempbx == Panel_1280x1024)) {
 		if (pVBInfo->VBInfo & DriverMode) {
 			tempax = xgifb_reg_get(pVBInfo->P3d4, 0x33);
@@ -4591,7 +4589,7 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
 		}
 	}
 
-	/* [ycchen] 01/14/03 Modify for 301C PALM Support */
+	/* Modify for 301C PALM Support */
 	if (pVBInfo->VBType & VB_XGI301C) {
 		if (pVBInfo->TVInfo & TVSetPALM)
 			xgifb_reg_and_or(pVBInfo->Part2Port, 0x4E, ~0x08,
@@ -6245,8 +6243,7 @@ unsigned short XGI_GetRatePtrCRT2(struct xgi_hw_device_info *pXGIHWDE,
 		    (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 600)) {
 			index++;
 		}
-		/* Alan 10/19/2007;
-		 * do the similar adjustment like XGISearchCRT1Rate() */
+		/* do the similar adjustment like XGISearchCRT1Rate() */
 		if ((pVBInfo->RefIndex[RefreshRateTableIndex].XRes == 1024) &&
 		    (pVBInfo->RefIndex[RefreshRateTableIndex].YRes == 768)) {
 			index++;
@@ -6354,7 +6351,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	int i;
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
-	/* [2004/05/06] Vicent to fix XG42 single LCD sense to CRT+LCD */
+	/* to fix XG42 single LCD sense to CRT+LCD */
 	xgifb_reg_set(pVBInfo->P3d4, 0x57, 0x4A);
 	xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
 			pVBInfo->P3d4, 0x53) | 0x02));
@@ -6419,7 +6416,7 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	else
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x32, 0xDF, 0x00);
 
-	/* alan, avoid display something, set BLACK DAC if not restore DAC */
+	/* avoid display something, set BLACK DAC if not restore DAC */
 	outb(0x00, pVBInfo->P3c8);
 
 	for (i = 0; i < 256; i++) {
@@ -6432,7 +6429,6 @@ void XGI_SenseCRT1(struct vb_device_info *pVBInfo)
 	xgifb_reg_set(pVBInfo->P3d4, 0x63, CR63);
 	xgifb_reg_set(pVBInfo->P3c4, 0x31, SR31);
 
-	/* [2004/05/11] Vicent */
 	xgifb_reg_set(pVBInfo->P3d4, 0x53, (unsigned char) (xgifb_reg_get(
 			pVBInfo->P3d4, 0x53) & 0xFD));
 	xgifb_reg_set(pVBInfo->P3c4, 0x1F, (unsigned char) SR1F);
@@ -6653,7 +6649,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 	pVBInfo->IF_DEF_LVDS = 0;
 	pVBInfo->IF_DEF_LCDA = 1;
 
-	if (HwDeviceExtension->jChipType >= XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType >= XG20) {
 		pVBInfo->IF_DEF_YPbPr = 0;
 		pVBInfo->IF_DEF_HiVision = 0;
 		pVBInfo->IF_DEF_CRT2Monitor = 0;
@@ -6695,7 +6691,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 		}
 	}
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_GetVBType(pVBInfo);
 
 	InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo);
@@ -6703,12 +6699,12 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 		ModeNo = ModeNo & 0x7F;
 	xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86);
 
-	if (HwDeviceExtension->jChipType < XG20) /* kuku 2004/06/25 1.Openkey */
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_UnLockCRT2(HwDeviceExtension, pVBInfo);
 
 	XGI_SearchModeID(ModeNo, &ModeIdIndex, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		XGI_GetVBInfo(ModeNo, ModeIdIndex, HwDeviceExtension, pVBInfo);
 		XGI_GetTVInfo(ModeNo, ModeIdIndex, pVBInfo);
 		XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
@@ -6779,7 +6775,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 
 	XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) { /* kuku 2004/06/25 */
+	if (HwDeviceExtension->jChipType < XG20) {
 		XGI_LockCRT2(HwDeviceExtension, pVBInfo);
 	}
 
diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h
index aea760a..22c8eb9 100644
--- a/drivers/staging/xgifb/vb_struct.h
+++ b/drivers/staging/xgifb/vb_struct.h
@@ -28,7 +28,6 @@ struct XGI_Ext2Struct {
 	unsigned char  ModeID;
 	unsigned short XRes;
 	unsigned short YRes;
-	/* unsigned short ROM_OFFSET; */
 };
 
 struct XGI_ECLKDataStruct {
@@ -167,7 +166,6 @@ struct vb_device_info {
 	unsigned short   LCDHRS, LCDVRS, LCDHDES, LCDVDES;
 
 	unsigned short   ModeType;
-	/* ,IF_DEF_FSTN; add for dstn */
 	unsigned short   IF_DEF_LVDS, IF_DEF_TRUMPION, IF_DEF_DSTN;
 	unsigned short   IF_DEF_CRT2Monitor;
 	unsigned short   IF_DEF_LCDA, IF_DEF_YPbPr;
@@ -225,7 +223,6 @@ struct vb_device_info {
 	struct SiS_StandTable_S  *StandTable;
 	struct XGI_ExtStruct         *EModeIDTable;
 	struct XGI_Ext2Struct        *RefIndex;
-	/* XGINew_CRT1TableStruct *CRT1Table; */
 	struct XGI_CRT1TableStruct    *XGINEWUB_CRT1Table;
 	struct SiS_VCLKData    *VCLKData;
 	struct SiS_VBVCLKData  *VBVCLKData;
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index 75da7c3..ca8c68d 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1,6 +1,5 @@
 #ifndef _VB_TABLE_
 #define _VB_TABLE_
-/* yilin modify for xgi20 */
 static struct SiS_MCLKData XGI340New_MCLKData[] = {
 	{0x16, 0x01, 0x01, 166},
 	{0x19, 0x02, 0x01, 124},
@@ -23,7 +22,6 @@ static struct SiS_MCLKData XGI27New_MCLKData[] = {
 	{0x5c, 0x23, 0x01, 166}
 };
 
-/* yilin modify for xgi20 */
 static struct XGI_ECLKDataStruct XGI340_ECLKData[] = {
 	{0x5c, 0x23, 0x01, 166},
 	{0x55, 0x84, 0x01, 123},
@@ -424,13 +422,9 @@ static struct SiS_LCDData  XGI_StLCD1024x768Data[] = {
 };
 
 static struct SiS_LCDData  XGI_ExtLCD1024x768Data[] = {
-	/* { 12, 5, 896, 512,1344, 806}, // alan 09/12/2003 */
 	{42, 25, 1536, 419, 1344, 806},
-	/* { 12, 5, 896, 510,1344, 806}, // alan 09/12/2003 */
 	{48, 25, 1536, 369, 1344, 806},
-	/* { 32, 15,1008, 505,1344, 806}, // alan 09/12/2003 */
 	{42, 25, 1536, 419, 1344, 806},
-	/* { 32, 15,1008, 514,1344, 806}, // alan 09/12/2003 */
 	{48, 25, 1536, 369, 1344, 806},
 	{12, 5,  896,  500, 1344, 806},
 	{42, 25, 1024, 625, 1344, 806},
@@ -504,14 +498,10 @@ static struct SiS_LCDData xgifb_lcd_1400x1050[] = {
 };
 
 static struct SiS_LCDData  XGI_ExtLCD1600x1200Data[] = {
-	{4,  1,  1620, 420,  2160, 1250}, /* { 3,1,2160,425,2160,1250 },
-					  // 00 (320x200,320x400,
-					  //	 640x200,640x400)
-					  //	 // alan 10/14/2003 */
+	{4,  1,  1620, 420,  2160, 1250}, /* 00 (320x200,320x400,
+						 640x200,640x400)*/
 	{27, 7,  1920, 375,  2160, 1250}, /* 01 (320x350,640x350) */
-	{4,  1,  1620, 420,  2160, 1250}, /* { 3,1,2160,425,2160,1250 },
-					  // 02 (360x400,720x400)
-					  // // alan 10/14/2003 */
+	{4,  1,  1620, 420,  2160, 1250}, /* 02 (360x400,720x400)*/
 	{27, 7,  1920, 375,  2160, 1250}, /* 03 (720x350) */
 	{27, 4,  800,  500,  2160, 1250}, /* 04 (640x480x60Hz) */
 	{4,  1,  1080, 625,  2160, 1250}, /* 05 (800x600x60Hz) */
@@ -615,8 +605,7 @@ static struct SiS_LCDData  XGI_NoScalingDatax75[] = {
 	{1, 1, 1056, 625,  1056, 625},  /* ; 05 (800x600x75Hz) */
 	{1, 1, 1312, 800,  1312, 800},  /* ; 06 (1024x768x75Hz) */
 	{1, 1, 1688, 1066, 1688, 1066}, /* ; 07 (1280x1024x75Hz) */
-	{1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz)
-					   ;;[ycchen] 12/19/02 */
+	{1, 1, 1688, 1066, 1688, 1066}, /* ; 08 (1400x1050x75Hz)*/
 	{1, 1, 2160, 1250, 2160, 1250}, /* ; 09 (1600x1200x75Hz) */
 	{1, 1, 1688, 806,  1688, 806}   /* ; 0A (1280x768x75Hz) */
 };
@@ -823,8 +812,7 @@ static struct XGI330_LCDDataDesStruct2  XGI_NoScalingDesData[] = {
 	{9, 849,  627, 600,  128,  4}, /* 05 (800x600x60Hz) */
 	{9, 1057, 805, 770,  0136, 6}, /* 06 (1024x768x60Hz) */
 	{9, 1337, 0,   1025, 112,  3}, /* 07 (1280x1024x60Hz) */
-	{9, 1457, 0,   1051, 112,  3}, /* 08 (1400x1050x60Hz) },
-					//;[ycchen] 12/19/02 */
+	{9, 1457, 0,   1051, 112,  3}, /* 08 (1400x1050x60Hz)*/
 	{9, 1673, 0,   1201, 192,  3}, /* 09 (1600x1200x60Hz) */
 	{9, 1337, 0,   771,  112,  6}  /* 0A (1280x768x60Hz) */
 };
@@ -910,8 +898,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_NoScalingDesDatax75[] =  {
 	{9, 825,  0,   601,  80,  3}, /* ; 05 (800x600x75Hz) */
 	{9, 1049, 0,   769,  96,  3}, /* ; 06 (1024x768x75Hz) */
 	{9, 1305, 0,   1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */
-	{9, 1457, 0,   1051, 112, 3}, /* ; 08 (1400x1050x60Hz)
-					 ;;[ycchen] 12/19/02 */
+	{9, 1457, 0,   1051, 112, 3}, /* ; 08 (1400x1050x60Hz)*/
 	{9, 1673, 0,   1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */
 	{9, 1337, 0,   771,  112, 6}  /* ; 0A (1280x768x60Hz) */
 };
@@ -1308,7 +1295,7 @@ static struct SiS_LVDSData XGI_LVDSNoScalingData[] = {
 	{1056,  628, 1056,  628}, /* 05 (800x600x60Hz) */
 	{1344,  806, 1344,  806}, /* 06 (1024x768x60Hz) */
 	{1688, 1066, 1688, 1066}, /* 07 (1280x1024x60Hz) */
-	{1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) ;;[ycchen] 12/19/02 */
+	{1688, 1066, 1688, 1066}, /* 08 (1400x1050x60Hz) */
 	{2160, 1250, 2160, 1250}, /* 09 (1600x1200x60Hz) */
 	{1688,  806, 1688,  806}  /* 0A (1280x768x60Hz) */
 };
@@ -1469,8 +1456,7 @@ static struct XGI330_LCDDataDesStruct2  XGI_LVDSNoScalingDesData[] = {
 	{0,  840,  627,  600, 128, 4}, /* 05 (800x600x60Hz) */
 	{0, 1048,  805,  770, 136, 6}, /* 06 (1024x768x60Hz) */
 	{0, 1328,    0, 1025, 112, 3}, /* 07 (1280x1024x60Hz) */
-	{0, 1438,    0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)
-					;;[ycchen] 12/19/02 */
+	{0, 1438,    0, 1051, 112, 3}, /* 08 (1400x1050x60Hz)*/
 	{0, 1664,    0, 1201, 192, 3}, /* 09 (1600x1200x60Hz) */
 	{0, 1328,    0, 0771, 112, 6}  /* 0A (1280x768x60Hz) */
 };
@@ -1518,7 +1504,7 @@ static struct SiS_LVDSData XGI_LVDS1280x1024Des_1x75[] = {
 };
 
 /* The Display setting for DE Mode Panel */
-/* [ycchen] 02/18/03 Set DE as default */
+/* Set DE as default */
 static struct SiS_LVDSData XGI_LVDS1280x1024Des_2x75[] = {
 	{1368,  976, 752,  711}, /* ; 00 (320x200,320x400,640x200,640x400) */
 	{1368,  976, 729,  688}, /* ; 01 (320x350,640x350) */
@@ -1541,8 +1527,7 @@ static struct XGI330_LCDDataDesStruct2 XGI_LVDSNoScalingDesDatax75[] = {
 	{0,  816,   0,  601,  80, 3}, /* ; 05 (800x600x75Hz) */
 	{0, 1040,   0,  769,  96, 3}, /* ; 06 (1024x768x75Hz) */
 	{0, 1296,   0, 1025, 144, 3}, /* ; 07 (1280x1024x75Hz) */
-	{0, 1448,   0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz)
-					 ;;[ycchen] 12/19/02 */
+	{0, 1448,   0, 1051, 112, 3}, /* ; 08 (1400x1050x75Hz) */
 	{0, 1664,   0, 1201, 192, 3}, /* ; 09 (1600x1200x75Hz) */
 	{0, 1328,   0,  771, 112, 6}  /* ; 0A (1280x768x75Hz) */
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 02/19 v2] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
  2012-07-06 10:40   ` [PATCH 01/19 v2] Staging: xgifb: Comment cleaning Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
                     ` (16 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

LCD_TYPEs are taken from drivers/video/sis/sis.h, so this enumeration is not
needed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vgatypes.h |   34 ----------------------------------
 1 file changed, 34 deletions(-)

diff --git a/drivers/staging/xgifb/vgatypes.h b/drivers/staging/xgifb/vgatypes.h
index 7fc0719..ddf7776 100644
--- a/drivers/staging/xgifb/vgatypes.h
+++ b/drivers/staging/xgifb/vgatypes.h
@@ -21,40 +21,6 @@ enum XGI_VB_CHIP_TYPE {
 };
 #endif
 
-
-#define XGI_LCD_TYPE
-/* Since the merge with video/sis the LCD_TYPEs are used from
- drivers/video/sis/sis.h . Nevertheless we keep this (for the moment) for
- future reference until the code is merged completely and we are sure
- nothing of this should be added to the sis.h header */
-#ifndef XGI_LCD_TYPE
-enum XGI_LCD_TYPE {
-	LCD_INVALID = 0,
-	LCD_320x480,       /* FSTN, DSTN */
-	LCD_640x480,
-	LCD_640x480_2,     /* FSTN, DSTN */
-	LCD_640x480_3,     /* FSTN, DSTN */
-	LCD_800x600,
-	LCD_848x480,
-	LCD_1024x600,
-	LCD_1024x768,
-	LCD_1152x768,
-	LCD_1152x864,
-	LCD_1280x720,
-	LCD_1280x768,
-	LCD_1280x800,
-	LCD_1280x960,
-	LCD_1280x1024,
-	LCD_1400x1050,
-	LCD_1600x1200,
-	LCD_1680x1050,
-	LCD_1920x1440,
-	LCD_2048x1536,
-	LCD_CUSTOM,
-	LCD_UNKNOWN
-};
-#endif
-
 struct xgi_hw_device_info {
 	unsigned long ulExternalChip; /* NO VB or other video bridge*/
 				      /* if ujVBChipID = VB_CHIP_UNKNOWN, */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
  2012-07-06 10:40   ` [PATCH 01/19 v2] Staging: xgifb: Comment cleaning Miguel Gómez
  2012-07-06 10:40   ` [PATCH 02/19 v2] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-09 18:39     ` Greg KH
  2012-07-06 10:40   ` [PATCH 04/19 v2] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
                     ` (15 subsequent siblings)
  18 siblings, 1 reply; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

The piece of code that checks for LCDA in xgifb_probe() just checks for some
register values but doesn't really do anything in response to them (the actions
that should be executed are commented).
As nothing is really being done, the code can be safely removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index b226458..0307eca 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1952,36 +1952,6 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		}
 	}
 
-	if ((hw_info->ujVBChipID == VB_CHIP_302B) ||
-			(hw_info->ujVBChipID == VB_CHIP_301LV) ||
-			(hw_info->ujVBChipID == VB_CHIP_302LV)) {
-		int tmp;
-		tmp = xgifb_reg_get(XGICR, 0x34);
-		if (tmp <= 0x13) {
-			/* Currently on LCDA?
-			 *(Some BIOSes leave CR38) */
-			tmp = xgifb_reg_get(XGICR, 0x38);
-			if ((tmp & 0x03) == 0x03) {
-				/* XGI_Pr.XGI_UseLCDA = 1; */
-			} else {
-				/* Currently on LCDA?
-				 *(Some newer BIOSes set D0 in CR35) */
-				tmp = xgifb_reg_get(XGICR, 0x35);
-				if (tmp & 0x01) {
-					/* XGI_Pr.XGI_UseLCDA = 1; */
-				} else {
-					tmp = xgifb_reg_get(XGICR,
-							    0x30);
-					if (tmp & 0x20) {
-						tmp = xgifb_reg_get(
-							XGIPART1, 0x13);
-					}
-				}
-			}
-		}
-
-	}
-
 	xgifb_info->mode_idx = -1;
 
 	if (mode)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 04/19 v2] Staging: xgifb: Remove unused struct _chswtable.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (2 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 05/19 v2] Staging: xgifb: Improve debug strings Miguel Gómez
                     ` (14 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Struct _chswtable and the variable mychswtable are not used anywhere, so remove
them.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main.h |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main.h b/drivers/staging/xgifb/XGI_main.h
index 1686c5a..c033da4 100644
--- a/drivers/staging/xgifb/XGI_main.h
+++ b/drivers/staging/xgifb/XGI_main.h
@@ -227,16 +227,6 @@ static const struct _XGI_vrate {
 	{0, 0, 0, 0}
 };
 
-static const struct _chswtable {
-	int subsysVendor;
-	int subsysCard;
-	char *vendorName;
-	char *cardName;
-} mychswtable[] = {
-	{ 0x1631, 0x1002, "Mitachi", "0x1002" },
-	{ 0,      0,      ""       , ""       }
-};
-
 static const struct _XGI_TV_filter {
 	u8 filter[9][4];
 } XGI_TV_filter[] = {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 05/19 v2] Staging: xgifb: Improve debug strings.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (3 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 04/19 v2] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 06/19 v2] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
                     ` (13 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   34 +++++++++++++++++-----------------
 drivers/staging/xgifb/vb_init.c     |    4 ++--
 2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 0307eca..d5c87ea 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -39,14 +39,14 @@ static void dumpVGAReg(void)
 
 	for (i = 0; i < 0x4f; i++) {
 		reg = xgifb_reg_get(XGISR, i);
-		pr_debug("\no 3c4 %x", i);
-		pr_debug("\ni 3c5 => %x", reg);
+		pr_debug("o 3c4 %x\n", i);
+		pr_debug("i 3c5 => %x\n", reg);
 	}
 
 	for (i = 0; i < 0xF0; i++) {
 		reg = xgifb_reg_get(XGICR, i);
-		pr_debug("\no 3d4 %x", i);
-		pr_debug("\ni 3d5 => %x", reg);
+		pr_debug("o 3d4 %x\n", i);
+		pr_debug("i 3d5 => %x\n", reg);
 	}
 }
 #else
@@ -591,7 +591,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				break;
 			} else if (XGIfb_vrate[i].refresh > rate) {
 				if ((XGIfb_vrate[i].refresh - rate) <= 3) {
-					pr_debug("XGIfb: Adjusting rate from %d up to %d\n",
+					pr_debug("Adjusting rate from %d up to %d\n",
 						 rate, XGIfb_vrate[i].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i].idx;
@@ -600,7 +600,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				} else if (((rate - XGIfb_vrate[i - 1].refresh)
 						<= 2) && (XGIfb_vrate[i].idx
 						!= 1)) {
-					pr_debug("XGIfb: Adjusting rate from %d down to %d\n",
+					pr_debug("Adjusting rate from %d down to %d\n",
 						 rate, XGIfb_vrate[i-1].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i - 1].idx;
@@ -609,7 +609,7 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 				}
 				break;
 			} else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
-				pr_debug("XGIfb: Adjusting rate from %d down to %d\n",
+				pr_debug("Adjusting rate from %d down to %d\n",
 					 rate, XGIfb_vrate[i].refresh);
 				xgifb_info->rate_idx = XGIfb_vrate[i].idx;
 				break;
@@ -987,7 +987,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 	}
 
 	if (!htotal || !vtotal) {
-		pr_debug("XGIfb: Invalid 'var' information\n");
+		pr_debug("Invalid 'var' information\n");
 		return -EINVAL;
 	} pr_debug("var->pixclock=%d, htotal=%d, vtotal=%d\n",
 			var->pixclock, htotal, vtotal);
@@ -1063,7 +1063,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 
 		XGIfb_post_setmode(xgifb_info);
 
-		pr_debug("XGIfb: Set new mode: %dx%dx%d-%d\n",
+		pr_debug("Set new mode: %dx%dx%d-%d\n",
 			 XGIbios_mode[xgifb_info->mode_idx].xres,
 			 XGIbios_mode[xgifb_info->mode_idx].yres,
 			 XGIbios_mode[xgifb_info->mode_idx].bpp,
@@ -1109,7 +1109,7 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 			break;
 		default:
 			xgifb_info->video_cmap_len = 16;
-			pr_err("Unsupported depth %d",
+			pr_err("Unsupported depth %d\n",
 			       xgifb_info->video_bpp);
 			break;
 		}
@@ -1303,7 +1303,7 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 				+ var->vsync_len;
 
 	if (!(htotal) || !(vtotal)) {
-		pr_debug("XGIfb: no valid timing data\n");
+		pr_debug("No valid timing data\n");
 		return -EINVAL;
 	}
 
@@ -1661,7 +1661,7 @@ static int __init xgifb_optval(char *fullopt, int validx)
 	unsigned long lres;
 
 	if (kstrtoul(fullopt + validx, 0, &lres) < 0 || lres > INT_MAX) {
-		pr_err("xgifb: invalid value for option: %s\n", fullopt);
+		pr_err("Invalid value for option: %s\n", fullopt);
 		return 0;
 	}
 	return lres;
@@ -1674,7 +1674,7 @@ static int __init XGIfb_setup(char *options)
 	if (!options || !*options)
 		return 0;
 
-	pr_info("xgifb: options: %s\n", options);
+	pr_info("Options: %s\n", options);
 
 	while ((this_opt = strsep(&options, ",")) != NULL) {
 
@@ -1767,7 +1767,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	reg1 = xgifb_reg_get(XGISR, IND_SIS_PASSWORD);
 
 	if (reg1 != 0xa1) { /*I/O error */
-		dev_err(&pdev->dev, "I/O error!!!");
+		dev_err(&pdev->dev, "I/O error\n");
 		ret = -EIO;
 		goto error_disable;
 	}
@@ -1817,7 +1817,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	if (!request_mem_region(xgifb_info->video_base,
 				xgifb_info->video_size,
 				"XGIfb FB")) {
-		dev_err(&pdev->dev, "unable request memory size %x\n",
+		dev_err(&pdev->dev, "Unable request memory size %x\n",
 		       xgifb_info->video_size);
 		dev_err(&pdev->dev,
 			"Fatal error: Unable to reserve frame buffer memory. "
@@ -1973,7 +1973,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	}
 
 	if (xgifb_info->mode_idx < 0) {
-		dev_err(&pdev->dev, "no supported video mode found\n");
+		dev_err(&pdev->dev, "No supported video mode found\n");
 		goto error_1;
 	}
 
@@ -2085,7 +2085,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	xgifb_info->mtrr = mtrr_add(xgifb_info->video_base,
 		xgifb_info->video_size, MTRR_TYPE_WRCOMB, 1);
 	if (xgifb_info->mtrr >= 0)
-		dev_info(&pdev->dev, "added MTRR\n");
+		dev_info(&pdev->dev, "Added MTRR\n");
 #endif
 
 	if (register_framebuffer(fb_info) < 0) {
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 6bb0206..64935fa 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -951,7 +951,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev,
 	pVBInfo->IF_DEF_LVDS = 0;
 	vbios = xgifb_copy_rom(pdev, &vbios_size);
 	if (vbios == NULL) {
-		dev_err(&pdev->dev, "video BIOS not available\n");
+		dev_err(&pdev->dev, "Video BIOS not available\n");
 		return;
 	}
 	if (vbios_size <= 0x65)
@@ -1006,7 +1006,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev,
 	pVBInfo->IF_DEF_LVDS = 1;
 	return;
 error:
-	dev_err(&pdev->dev, "video BIOS corrupted\n");
+	dev_err(&pdev->dev, "Video BIOS corrupted\n");
 	vfree(vbios);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 06/19 v2] Staging: xgifb: Remove useless switch in XGIfb_detect_VB().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (4 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 05/19 v2] Staging: xgifb: Improve debug strings Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 07/19 v2] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
                     ` (12 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

The switch performs no action so it can be removed.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   10 ----------
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index d5c87ea..788d141 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1556,16 +1556,6 @@ static void XGIfb_detect_VB(struct xgifb_video_info *xgifb_info)
 
 	xgifb_info->TV_plug = xgifb_info->TV_type = 0;
 
-	switch (xgifb_info->hasVB) {
-	case HASVB_LVDS_CHRONTEL:
-	case HASVB_CHRONTEL:
-		break;
-	case HASVB_301:
-	case HASVB_302:
-		/* XGI_Sense30x(); */ /* Yi-Lin TV Sense? */
-		break;
-	}
-
 	cr32 = xgifb_reg_get(XGICR, IND_XGI_SCRATCH_REG_CR32);
 
 	if ((cr32 & SIS_CRT1) && !XGIfb_crt1off)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 07/19 v2] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (5 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 06/19 v2] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 08/19 v2] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
                     ` (11 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Simplify the code and make it more readable.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 788d141..c1aa037 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -262,28 +262,19 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
 
 static int XGIfb_GetXG21DefaultLVDSModeIdx(struct xgifb_video_info *xgifb_info)
 {
+	int i = 0;
 
-	int found_mode = 0;
-	int XGIfb_mode_idx = 0;
-
-	found_mode = 0;
-	while ((XGIbios_mode[XGIfb_mode_idx].mode_no != 0)
-			&& (XGIbios_mode[XGIfb_mode_idx].xres
-					<= xgifb_info->lvds_data.LVDSHDE)) {
-		if ((XGIbios_mode[XGIfb_mode_idx].xres
-				== xgifb_info->lvds_data.LVDSHDE)
-				&& (XGIbios_mode[XGIfb_mode_idx].yres
-					== xgifb_info->lvds_data.LVDSVDE)
-				&& (XGIbios_mode[XGIfb_mode_idx].bpp == 8)) {
-			found_mode = 1;
-			break;
+	while ((XGIbios_mode[i].mode_no != 0)
+	       && (XGIbios_mode[i].xres <= xgifb_info->lvds_data.LVDSHDE)) {
+		if ((XGIbios_mode[i].xres == xgifb_info->lvds_data.LVDSHDE)
+		    && (XGIbios_mode[i].yres == xgifb_info->lvds_data.LVDSVDE)
+		    && (XGIbios_mode[i].bpp == 8)) {
+			return i;
 		}
-		XGIfb_mode_idx++;
+		i++;
 	}
-	if (!found_mode)
-		XGIfb_mode_idx = -1;
 
-	return XGIfb_mode_idx;
+	return -1;
 }
 
 static void XGIfb_search_mode(struct xgifb_video_info *xgifb_info,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 08/19 v2] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (6 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 07/19 v2] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 09/19 v2] Staging: xgifb: Remove useless always true condition Miguel Gómez
                     ` (10 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index c1aa037..e5657ff 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -305,7 +305,7 @@ invalid_mode:
 static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
 				  unsigned int vesamode)
 {
-	int i = 0, j = 0;
+	int i = 0;
 
 	if (vesamode == 0)
 		goto invalid;
@@ -316,15 +316,13 @@ static void XGIfb_search_vesamode(struct xgifb_video_info *xgifb_info,
 		if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
 		    (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
 			xgifb_info->mode_idx = i;
-			j = 1;
-			break;
+			return;
 		}
 		i++;
 	}
 
 invalid:
-	if (!j)
-		pr_info("Invalid VESA mode 0x%x'\n", vesamode);
+	pr_info("Invalid VESA mode 0x%x'\n", vesamode);
 }
 
 static int XGIfb_validate_mode(struct xgifb_video_info *xgifb_info, int myindex)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 09/19 v2] Staging: xgifb: Remove useless always true condition.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (7 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 08/19 v2] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 10/19 v2] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
                     ` (9 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_init.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index 64935fa..ae10153 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1185,13 +1185,11 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
 {
 	unsigned char Temp;
 
-#if 1
 	if (pVBInfo->IF_DEF_LVDS) { /* For XG21 LVDS */
 		xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
 		/* LVDS on chip */
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0);
 	} else {
-#endif
 		/* Enable GPIOA/B read  */
 		xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03);
 		Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0;
@@ -1214,9 +1212,7 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension,
 			/* Disable read GPIOF */
 			xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20);
 		}
-#if 1
 	}
-#endif
 }
 
 static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 10/19 v2] Staging: xgifb: Rework conditions in XGI_SetATTRegs().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (8 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 09/19 v2] Staging: xgifb: Remove useless always true condition Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 11/19 v2] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
                     ` (8 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 3ba3c48..4b49705 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -161,18 +161,15 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
 
 	for (i = 0; i <= 0x13; i++) {
 		ARdata = pVBInfo->StandTable->ATTR[i];
-		if (modeflag & Charx8Dot) { /* ifndef Dot9 */
-			if (i == 0x13) {
-				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+
+		if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */
+			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+				ARdata = 0;
+			} else {
+				if ((pVBInfo->VBInfo &
+				     (SetCRT2ToTV | SetCRT2ToLCD)) &&
+				    (pVBInfo->VBInfo & SetInSlaveMode))
 					ARdata = 0;
-				} else {
-					if (pVBInfo->VBInfo & (SetCRT2ToTV
-							| SetCRT2ToLCD)) {
-						if (pVBInfo->VBInfo &
-						    SetInSlaveMode)
-							ARdata = 0;
-					}
-				}
 			}
 		}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 11/19 v2] Staging: xgifb: Refactor XGI_AjustCRT2Rate().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (9 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 10/19 v2] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 12/19 v2] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
                     ` (7 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Refactor some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   73 ++++++++++++------------------------
 1 file changed, 25 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 4b49705..03edf36 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -250,48 +250,30 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
 		if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
 			tempax |= SupportLCD;
 
-			if (pVBInfo->LCDResInfo != Panel_1280x1024) {
-				if (pVBInfo->LCDResInfo != Panel_1280x960) {
-					if (pVBInfo->LCDInfo &
-					    LCDNonExpanding) {
-						if (resinfo >= 9) {
-							tempax = 0;
-							return 0;
-						}
-					}
-				}
-			}
+			if (pVBInfo->LCDResInfo != Panel_1280x1024 &&
+			    pVBInfo->LCDResInfo != Panel_1280x960 &&
+			    (pVBInfo->LCDInfo & LCDNonExpanding) &&
+			    resinfo >= 9)
+				return 0;
 		}
 
 		if (pVBInfo->VBInfo & SetCRT2ToHiVision) { /* for HiTV */
 			if ((pVBInfo->VBType & VB_SIS301LV) &&
 			    (pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
 				tempax |= SupportYPbPr750p;
-				if (pVBInfo->VBInfo & SetInSlaveMode) {
-					if (resinfo == 4)
-						return 0;
-
-					if (resinfo == 3)
-						return 0;
-
-					if (resinfo > 7)
-						return 0;
-				}
+				if ((pVBInfo->VBInfo & SetInSlaveMode) &&
+				    ((resinfo == 3) ||
+				     (resinfo == 4) ||
+				     (resinfo > 7)))
+					return 0;
 			} else {
 				tempax |= SupportHiVision;
-				if (pVBInfo->VBInfo & SetInSlaveMode) {
-					if (resinfo == 4)
+				if ((pVBInfo->VBInfo & SetInSlaveMode) &&
+				    ((resinfo == 4) ||
+				     (resinfo == 3 &&
+				      (pVBInfo->SetFlag & TVSimuMode)) ||
+				     (resinfo > 7)))
 						return 0;
-
-					if (resinfo == 3) {
-						if (pVBInfo->SetFlag
-								& TVSimuMode)
-							return 0;
-					}
-
-					if (resinfo > 7)
-						return 0;
-				}
 			}
 		} else {
 			if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
@@ -301,23 +283,18 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
 					       SetCRT2ToHiVision)) {
 				tempax |= SupportTV;
 
-				if (pVBInfo->VBType & (VB_SIS301B | VB_SIS302B
-						| VB_SIS301LV | VB_SIS302LV
-						| VB_XGI301C)) {
+				if (pVBInfo->VBType & (VB_SIS301B |
+						       VB_SIS302B |
+						       VB_SIS301LV |
+						       VB_SIS302LV |
+						       VB_XGI301C))
 					tempax |= SupportTV1024;
-				}
 
-				if (!(pVBInfo->VBInfo & TVSetPAL)) {
-					if (modeflag & NoSupportSimuTV) {
-						if (pVBInfo->VBInfo &
-						    SetInSlaveMode) {
-							if (!(pVBInfo->VBInfo &
-							      SetNotSimuMode)) {
-								return 0;
-							}
-						}
-					}
-				}
+				if (!(pVBInfo->VBInfo & TVSetPAL) &&
+				    (modeflag & NoSupportSimuTV) &&
+				    (pVBInfo->VBInfo & SetInSlaveMode) &&
+				    (!(pVBInfo->VBInfo & SetNotSimuMode)))
+					return 0;
 			}
 		}
 	} else { /* for LVDS */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 12/19 v2] Staging: xgifb: Refactor XGI_GetVBType().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (10 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 11/19 v2] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 13/19 v2] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
                     ` (6 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Refactor XGI_GetVBType() to reduce indentation and fix style warnings.

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

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 03edf36..251145e 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -2559,42 +2559,45 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo)
 {
 	unsigned short flag, tempbx, tempah;
 
-	if (pVBInfo->IF_DEF_LVDS == 0) {
-		tempbx = VB_SIS302B;
-		flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
-		if (flag != 0x02) {
-			tempbx = VB_SIS301;
-			flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
-			if (flag >= 0xB0) {
-				tempbx = VB_SIS301B;
-				if (flag >= 0xC0) {
-					tempbx = VB_XGI301C;
-					if (flag >= 0xD0) {
-						tempbx = VB_SIS301LV;
-						if (flag >= 0xE0) {
-							tempbx = VB_SIS302LV;
-							tempah = xgifb_reg_get(
-							    pVBInfo->Part4Port,
-							    0x39);
-							if (tempah != 0xFF)
-								tempbx =
-								    VB_XGI301C;
-						}
-					}
-				}
+	if (pVBInfo->IF_DEF_LVDS != 0)
+		return;
 
-				if (tempbx & (VB_SIS301B | VB_SIS302B)) {
-					flag = xgifb_reg_get(
-							pVBInfo->Part4Port,
-							0x23);
+	tempbx = VB_SIS302B;
+	flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00);
+	if (flag == 0x02)
+		goto finish;
 
-					if (!(flag & 0x02))
-						tempbx = tempbx | VB_NoLCD;
-				}
-			}
-		}
-		pVBInfo->VBType = tempbx;
+	tempbx = VB_SIS301;
+	flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01);
+	if (flag < 0xB0)
+		goto finish;
+
+	tempbx = VB_SIS301B;
+	if (flag < 0xC0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_XGI301C;
+	if (flag < 0xD0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_SIS301LV;
+	if (flag < 0xE0)
+		goto bigger_than_0xB0;
+
+	tempbx = VB_SIS302LV;
+	tempah = xgifb_reg_get(pVBInfo->Part4Port, 0x39);
+	if (tempah != 0xFF)
+		tempbx = VB_XGI301C;
+
+bigger_than_0xB0:
+	if (tempbx & (VB_SIS301B | VB_SIS302B)) {
+		flag = xgifb_reg_get(pVBInfo->Part4Port, 0x23);
+		if (!(flag & 0x02))
+			tempbx = tempbx | VB_NoLCD;
 	}
+
+finish:
+	pVBInfo->VBType = tempbx;
 }
 
 static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 13/19 v2] Staging: xgifb: Rework conditions in XGI_GetVBInfo().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (11 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 12/19 v2] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 14/19 v2] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
                     ` (5 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |  287 ++++++++++++++++++------------------
 1 file changed, 142 insertions(+), 145 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 251145e..9dfc2de 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -2611,186 +2611,183 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
 	pVBInfo->ModeType = modeflag & ModeTypeMask;
 	tempbx = 0;
 
-	if (pVBInfo->VBType & 0xFFFF) {
-		/* Check Display Device */
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
-		tempbx = tempbx | temp;
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
-		push = temp;
-		push = push << 8;
-		tempax = temp << 8;
-		tempbx = tempbx | tempax;
-		temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
-				| SetInSlaveMode | DisableCRT2Display);
-		temp = 0xFFFF ^ temp;
-		tempbx &= temp;
-
-		temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+	if (!(pVBInfo->VBType & 0xFFFF))
+		return;
 
-		if (pVBInfo->IF_DEF_LCDA == 1) {
-
-			if ((HwDeviceExtension->jChipType >= XG20) ||
-			    (HwDeviceExtension->jChipType >= XG40)) {
-				if (pVBInfo->IF_DEF_LVDS == 0) {
-					if (pVBInfo->VBType &
-					    (VB_SIS302B |
-					     VB_SIS301LV |
-					     VB_SIS302LV |
-					     VB_XGI301C)) {
-						if (temp & EnableDualEdge) {
-							tempbx |=
-							    SetCRT2ToDualEdge;
-
-							if (temp & SetToLCDA)
-								tempbx |=
-								  XGI_SetCRT2ToLCDA;
-						}
-					}
+	/* Check Display Device */
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x30);
+	tempbx = tempbx | temp;
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x31);
+	push = temp;
+	push = push << 8;
+	tempax = temp << 8;
+	tempbx = tempbx | tempax;
+	temp = (SetCRT2ToDualEdge | SetCRT2ToYPbPr525750 | XGI_SetCRT2ToLCDA
+		| SetInSlaveMode | DisableCRT2Display);
+	temp = 0xFFFF ^ temp;
+	tempbx &= temp;
+
+	temp = xgifb_reg_get(pVBInfo->P3d4, 0x38);
+
+	if (pVBInfo->IF_DEF_LCDA == 1) {
+
+		if (((HwDeviceExtension->jChipType >= XG20) ||
+		     (HwDeviceExtension->jChipType >= XG40)) &&
+		    (pVBInfo->IF_DEF_LVDS == 0)) {
+			if (pVBInfo->VBType &
+			    (VB_SIS302B |
+			     VB_SIS301LV |
+			     VB_SIS302LV |
+			     VB_XGI301C)) {
+				if (temp & EnableDualEdge) {
+					tempbx |= SetCRT2ToDualEdge;
+					if (temp & SetToLCDA)
+						tempbx |= XGI_SetCRT2ToLCDA;
 				}
 			}
 		}
+	}
 
-		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			if (((pVBInfo->IF_DEF_LVDS == 0) &&
-			    ((pVBInfo->VBType & VB_SIS301LV) ||
-			    (pVBInfo->VBType & VB_SIS302LV) ||
-			    (pVBInfo->VBType & VB_XGI301C)))) {
-				if (temp & SetYPbPr) {
-					if (pVBInfo->IF_DEF_HiVision == 1) {
-						/* shampoo add for new
-						 * scratch */
-						temp = xgifb_reg_get(
-								pVBInfo->P3d4,
-								0x35);
-						temp &= YPbPrMode;
-						tempbx |= SetCRT2ToHiVision;
-
-						if (temp != YPbPrMode1080i) {
-							tempbx &=
-							 (~SetCRT2ToHiVision);
-							tempbx |=
-							 SetCRT2ToYPbPr525750;
-						}
+	if (pVBInfo->IF_DEF_YPbPr == 1) {
+		if (((pVBInfo->IF_DEF_LVDS == 0) &&
+		     ((pVBInfo->VBType & VB_SIS301LV) ||
+		      (pVBInfo->VBType & VB_SIS302LV) ||
+		      (pVBInfo->VBType & VB_XGI301C)))) {
+			if (temp & SetYPbPr) {
+				if (pVBInfo->IF_DEF_HiVision == 1) {
+					/* shampoo add for new
+					 * scratch */
+					temp = xgifb_reg_get(
+						pVBInfo->P3d4,
+						0x35);
+					temp &= YPbPrMode;
+					tempbx |= SetCRT2ToHiVision;
+
+					if (temp != YPbPrMode1080i) {
+						tempbx &=
+							(~SetCRT2ToHiVision);
+						tempbx |=
+							SetCRT2ToYPbPr525750;
 					}
 				}
 			}
 		}
+	}
 
-		tempax = push; /* restore CR31 */
+	tempax = push; /* restore CR31 */
 
-		if (pVBInfo->IF_DEF_LVDS == 0) {
-			if (pVBInfo->IF_DEF_YPbPr == 1) {
-				if (pVBInfo->IF_DEF_HiVision == 1)
-					temp = 0x09FC;
-				else
-					temp = 0x097C;
-			} else {
-				if (pVBInfo->IF_DEF_HiVision == 1)
-					temp = 0x01FC;
-				else
-					temp = 0x017C;
-			}
-		} else { /* 3nd party chip */
-			temp = SetCRT2ToLCD;
-		}
-
-		if (!(tempbx & temp)) {
-			tempax |= DisableCRT2Display;
-			tempbx = 0;
-		}
-
-		if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
-			if (!(pVBInfo->VBType & VB_NoLCD)) {
-				if (tempbx & XGI_SetCRT2ToLCDA) {
-					if (tempbx & SetSimuScanMode)
-						tempbx &= (~(SetCRT2ToLCD |
-							   SetCRT2ToRAMDAC |
-							   SwitchCRT2));
-					else
-						tempbx &= (~(SetCRT2ToLCD |
-							     SetCRT2ToRAMDAC |
-							     SetCRT2ToTV |
-							     SwitchCRT2));
-				}
-			}
+	if (pVBInfo->IF_DEF_LVDS == 0) {
+		if (pVBInfo->IF_DEF_YPbPr == 1) {
+			if (pVBInfo->IF_DEF_HiVision == 1)
+				temp = 0x09FC;
+			else
+				temp = 0x097C;
+		} else {
+			if (pVBInfo->IF_DEF_HiVision == 1)
+				temp = 0x01FC;
+			else
+				temp = 0x017C;
 		}
+	} else { /* 3nd party chip */
+		temp = SetCRT2ToLCD;
+	}
 
-		/* shampoo add */
-		/* for driver abnormal */
-		if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
-			if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
-				if (tempbx & SetCRT2ToRAMDAC) {
-					tempbx &= (0xFF00 |
-						   SetCRT2ToRAMDAC |
-						   SwitchCRT2 |
-						   SetSimuScanMode);
-					tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
-				}
-			} else {
-				tempbx &= (~(SetCRT2ToRAMDAC |
-					   SetCRT2ToLCD |
-					   SetCRT2ToTV));
+	if (!(tempbx & temp)) {
+		tempax |= DisableCRT2Display;
+		tempbx = 0;
+	}
+
+	if (pVBInfo->IF_DEF_LCDA == 1) { /* Select Display Device */
+		if (!(pVBInfo->VBType & VB_NoLCD)) {
+			if (tempbx & XGI_SetCRT2ToLCDA) {
+				if (tempbx & SetSimuScanMode)
+					tempbx &= (~(SetCRT2ToLCD |
+						     SetCRT2ToRAMDAC |
+						     SwitchCRT2));
+				else
+					tempbx &= (~(SetCRT2ToLCD |
+						     SetCRT2ToRAMDAC |
+						     SetCRT2ToTV |
+						     SwitchCRT2));
 			}
 		}
+	}
 
-		if (!(pVBInfo->VBType & VB_NoLCD)) {
-			if (tempbx & SetCRT2ToLCD) {
+	/* shampoo add */
+	/* for driver abnormal */
+	if (!(tempbx & (SwitchCRT2 | SetSimuScanMode))) {
+		if (pVBInfo->IF_DEF_CRT2Monitor == 1) {
+			if (tempbx & SetCRT2ToRAMDAC) {
 				tempbx &= (0xFF00 |
-					   SetCRT2ToLCD |
+					   SetCRT2ToRAMDAC |
 					   SwitchCRT2 |
 					   SetSimuScanMode);
 				tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
 			}
+		} else {
+			tempbx &= (~(SetCRT2ToRAMDAC |
+				     SetCRT2ToLCD |
+				     SetCRT2ToTV));
 		}
+	}
 
-		if (tempbx & SetCRT2ToSCART) {
+	if (!(pVBInfo->VBType & VB_NoLCD)) {
+		if (tempbx & SetCRT2ToLCD) {
 			tempbx &= (0xFF00 |
-				   SetCRT2ToSCART |
+				   SetCRT2ToLCD |
 				   SwitchCRT2 |
 				   SetSimuScanMode);
 			tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
 		}
+	}
 
-		if (pVBInfo->IF_DEF_YPbPr == 1) {
-			if (tempbx & SetCRT2ToYPbPr525750)
-				tempbx &= (0xFF00 |
-					   SwitchCRT2 |
-					   SetSimuScanMode);
-		}
+	if (tempbx & SetCRT2ToSCART) {
+		tempbx &= (0xFF00 |
+			   SetCRT2ToSCART |
+			   SwitchCRT2 |
+			   SetSimuScanMode);
+		tempbx &= (0x00FF | (~SetCRT2ToYPbPr525750));
+	}
 
-		if (pVBInfo->IF_DEF_HiVision == 1) {
-			if (tempbx & SetCRT2ToHiVision)
-				tempbx &= (0xFF00 |
-					   SetCRT2ToHiVision |
-					   SwitchCRT2 |
-					   SetSimuScanMode);
-		}
+	if (pVBInfo->IF_DEF_YPbPr == 1) {
+		if (tempbx & SetCRT2ToYPbPr525750)
+			tempbx &= (0xFF00 |
+				   SwitchCRT2 |
+				   SetSimuScanMode);
+	}
 
-		if (tempax & DisableCRT2Display) { /* Set Display Device Info */
-			if (!(tempbx & (SwitchCRT2 | SetSimuScanMode)))
-				tempbx = DisableCRT2Display;
-		}
+	if (pVBInfo->IF_DEF_HiVision == 1) {
+		if (tempbx & SetCRT2ToHiVision)
+			tempbx &= (0xFF00 |
+				   SetCRT2ToHiVision |
+				   SwitchCRT2 |
+				   SetSimuScanMode);
+	}
 
-		if (!(tempbx & DisableCRT2Display)) {
-			if ((!(tempbx & DriverMode)) ||
-			    (!(modeflag & CRT2Mode))) {
-				if (pVBInfo->IF_DEF_LCDA == 1) {
-					if (!(tempbx & XGI_SetCRT2ToLCDA))
-						tempbx |= (SetInSlaveMode |
-							   SetSimuScanMode);
-				}
-			}
+	if (tempax & DisableCRT2Display) { /* Set Display Device Info */
+		if (!(tempbx & (SwitchCRT2 | SetSimuScanMode)))
+			tempbx = DisableCRT2Display;
+	}
 
-			/* LCD+TV can't support in slave mode
-			 * (Force LCDA+TV->LCDB) */
-			if ((tempbx & SetInSlaveMode) &&
-			    (tempbx & XGI_SetCRT2ToLCDA)) {
-				tempbx ^= (SetCRT2ToLCD |
-					  XGI_SetCRT2ToLCDA |
-					  SetCRT2ToDualEdge);
-				pVBInfo->SetFlag |= ReserveTVOption;
+	if (!(tempbx & DisableCRT2Display)) {
+		if ((!(tempbx & DriverMode)) ||
+		    (!(modeflag & CRT2Mode))) {
+			if (pVBInfo->IF_DEF_LCDA == 1) {
+				if (!(tempbx & XGI_SetCRT2ToLCDA))
+					tempbx |= (SetInSlaveMode |
+						   SetSimuScanMode);
 			}
 		}
+
+		/* LCD+TV can't support in slave mode
+		 * (Force LCDA+TV->LCDB) */
+		if ((tempbx & SetInSlaveMode) &&
+		    (tempbx & XGI_SetCRT2ToLCDA)) {
+			tempbx ^= (SetCRT2ToLCD |
+				   XGI_SetCRT2ToLCDA |
+				   SetCRT2ToDualEdge);
+			pVBInfo->SetFlag |= ReserveTVOption;
+		}
 	}
 
 	pVBInfo->VBInfo = tempbx;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 14/19 v2] Staging: xgifb: Refactor XGI_GetCRT2ResInfo().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (12 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 13/19 v2] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 15/19 v2] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
                     ` (4 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Use a goto to remove one level of indentation, fixing style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   61 ++++++++++++++++++------------------
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 9dfc2de..a7ba99f 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -3263,46 +3263,47 @@ static void XGI_GetCRT2ResInfo(unsigned short ModeNo,
 	if (modeflag & DoubleScanMode)
 		yres *= 2;
 
-	if (pVBInfo->VBInfo & SetCRT2ToLCD) {
-		if (pVBInfo->IF_DEF_LVDS == 0) {
-			if (pVBInfo->LCDResInfo == Panel_1600x1200) {
-				if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
-					if (yres == 1024)
-						yres = 1056;
-				}
+	if (!(pVBInfo->VBInfo & SetCRT2ToLCD))
+		goto exit;
+
+	if (pVBInfo->IF_DEF_LVDS == 0) {
+		if (pVBInfo->LCDResInfo == Panel_1600x1200) {
+			if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
+				if (yres == 1024)
+					yres = 1056;
 			}
+		}
 
-			if (pVBInfo->LCDResInfo == Panel_1280x1024) {
-				if (yres == 400)
-					yres = 405;
-				else if (yres == 350)
-					yres = 360;
+		if (pVBInfo->LCDResInfo == Panel_1280x1024) {
+			if (yres == 400)
+				yres = 405;
+			else if (yres == 350)
+				yres = 360;
 
-				if (pVBInfo->LCDInfo & XGI_LCDVESATiming) {
-					if (yres == 360)
-						yres = 375;
-				}
+			if (pVBInfo->LCDInfo & XGI_LCDVESATiming) {
+				if (yres == 360)
+					yres = 375;
 			}
+		}
 
-			if (pVBInfo->LCDResInfo == Panel_1024x768) {
-				if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
-					if (!(pVBInfo->LCDInfo
-							& LCDNonExpanding)) {
-						if (yres == 350)
-							yres = 357;
-						else if (yres == 400)
-							yres = 420;
-						else if (yres == 480)
-							yres = 525;
-					}
+		if (pVBInfo->LCDResInfo == Panel_1024x768) {
+			if (!(pVBInfo->LCDInfo & XGI_LCDVESATiming)) {
+				if (!(pVBInfo->LCDInfo & LCDNonExpanding)) {
+					if (yres == 350)
+						yres = 357;
+					else if (yres == 400)
+						yres = 420;
+					else if (yres == 480)
+						yres = 525;
 				}
 			}
 		}
-
-		if (xres == 720)
-			xres = 640;
 	}
 
+	if (xres == 720)
+		xres = 640;
+
+exit:
 	pVBInfo->VGAHDE = xres;
 	pVBInfo->HDE = xres;
 	pVBInfo->VGAVDE = yres;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 15/19 v2] Staging: xgifb: Rework conditions in XGI_SetLockRegs().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (13 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 14/19 v2] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 16/19 v2] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
                     ` (3 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index a7ba99f..5b2c35a 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -4039,24 +4039,16 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
 	}
 
 	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-		if (pVBInfo->VBType & VB_SIS301LV) {
-			if (pVBInfo->TVInfo & TVSetHiVision) {
-				tempbx -= 10;
-			} else {
-				if (pVBInfo->TVInfo & TVSimuMode) {
-					if (pVBInfo->TVInfo & TVSetPAL) {
-						if (pVBInfo->VBType &
-						    VB_SIS301LV) {
-							if (!(pVBInfo->TVInfo &
-							    (TVSetYPbPr525p |
-							    TVSetYPbPr750p |
-							    TVSetHiVision)))
-								tempbx += 40;
-						} else {
-							tempbx += 40;
-						}
-					}
-				}
+		if ((pVBInfo->VBType & VB_SIS301LV) &&
+		    !(pVBInfo->TVInfo & TVSetHiVision)) {
+			if ((pVBInfo->TVInfo & TVSimuMode) &&
+			    (pVBInfo->TVInfo & TVSetPAL)) {
+				if (!(pVBInfo->VBType & VB_SIS301LV) ||
+				    !(pVBInfo->TVInfo &
+				      (TVSetYPbPr525p |
+				       TVSetYPbPr750p |
+				       TVSetHiVision)))
+					tempbx += 40;
 			}
 		} else {
 			tempbx -= 10;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 16/19 v2] Staging: xgifb: Rework conditions in XGI_EnableBridge().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (14 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 15/19 v2] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 17/19 v2] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
                     ` (2 subsequent siblings)
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/vb_setmode.c |   44 +++++++++++++++---------------------
 1 file changed, 18 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 5b2c35a..53135c5 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -6472,32 +6472,24 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
 		if (!(pVBInfo->VBInfo & DisableCRT2Display)) {
 			tempah = 0xc0;
 
-			if (!(pVBInfo->VBInfo & SetSimuScanMode)) {
-				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
-					if (pVBInfo->VBInfo &
-					    SetCRT2ToDualEdge) {
-						tempah = tempah & 0x40;
-						if (pVBInfo->VBInfo &
-						    XGI_SetCRT2ToLCDA)
-							tempah = tempah ^ 0xC0;
-
-						if (pVBInfo->SetFlag &
-						    DisableChB)
-							tempah &= 0xBF;
-
-						if (pVBInfo->SetFlag &
-						    DisableChA)
-							tempah &= 0x7F;
-
-						if (pVBInfo->SetFlag &
-						    EnableChB)
-							tempah |= 0x40;
-
-						if (pVBInfo->SetFlag &
-						    EnableChA)
-							tempah |= 0x80;
-					}
-				}
+			if (!(pVBInfo->VBInfo & SetSimuScanMode) &&
+			    (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
+			    (pVBInfo->VBInfo & SetCRT2ToDualEdge)) {
+				tempah = tempah & 0x40;
+				if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)
+					tempah = tempah ^ 0xC0;
+
+				if (pVBInfo->SetFlag & DisableChB)
+					tempah &= 0xBF;
+
+				if (pVBInfo->SetFlag &  DisableChA)
+					tempah &= 0x7F;
+
+				if (pVBInfo->SetFlag &  EnableChB)
+					tempah |= 0x40;
+
+				if (pVBInfo->SetFlag &  EnableChA)
+					tempah |= 0x80;
 			}
 		}
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 17/19 v2] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs().
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (15 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 16/19 v2] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 18/19 v2] Staging: xgifb: Fix coding style Miguel Gómez
  2012-07-06 10:40   ` [PATCH 19/19 v2] Staging: xgifb: Remove useless condition Miguel Gómez
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Rework some conditions to reduce indentation and fix style warnings.

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

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 53135c5..01a3ef3 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -5990,60 +5990,49 @@ 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 {
-		tempah = 0x00;
-		tempbl = 0xff;
+	if (pVBInfo->VBInfo & DisableCRT2Display)
+		goto reg_and_or;
 
-		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;
-				}
+	tempah = 0x00;
+	tempbl = 0xff;
 
-				if (pVBInfo->VBInfo &
-				    (SetCRT2ToRAMDAC |
-				     SetCRT2ToTV |
-				     SetCRT2ToLCD)) {
-					tempbl &= 0xf8;
-					tempah = 0x01;
+	if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV |
+				 SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
+		goto reg_and_or;
 
-					if (!(pVBInfo->VBInfo & SetInSlaveMode))
-						tempah |= 0x02;
+	if ((pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) &&
+	    (!(pVBInfo->VBInfo & SetSimuScanMode))) {
+		tempbl &= 0xf7;
+		tempah |= 0x01;
+		goto reg_and_or;
+	}
 
-					if (!(pVBInfo->VBInfo &
-					      SetCRT2ToRAMDAC)) {
-						tempah = tempah ^ 0x05;
-						if (!(pVBInfo->VBInfo &
-						      SetCRT2ToLCD))
-							tempah = tempah ^ 0x01;
-					}
+	if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+		tempbl &= 0xf7;
+		tempah |= 0x01;
+	}
 
-					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);
-		}
+	if (!(pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD)))
+		goto reg_and_or;
+
+	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;
+
+reg_and_or:
+	xgifb_reg_and_or(pVBInfo->Part1Port, 0x2e, tempbl, tempah);
+
 	if (pVBInfo->VBInfo & (SetCRT2ToRAMDAC | SetCRT2ToTV | SetCRT2ToLCD
 			| XGI_SetCRT2ToLCDA)) {
 		tempah &= (~0x08);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 18/19 v2] Staging: xgifb: Fix coding style.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (16 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 17/19 v2] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  2012-07-06 10:40   ` [PATCH 19/19 v2] Staging: xgifb: Remove useless condition Miguel Gómez
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Fix small coding style warnings in several files.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    3 +-
 drivers/staging/xgifb/vb_init.c     |    3 +-
 drivers/staging/xgifb/vb_setmode.c  |   59 +++++++++++++++++++++--------------
 drivers/staging/xgifb/vb_table.h    |   30 ++++++++++++------
 4 files changed, 58 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index e5657ff..0f49a21 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -590,7 +590,8 @@ static u8 XGIfb_search_refresh_rate(struct xgifb_video_info *xgifb_info,
 						<= 2) && (XGIfb_vrate[i].idx
 						!= 1)) {
 					pr_debug("Adjusting rate from %d down to %d\n",
-						 rate, XGIfb_vrate[i-1].refresh);
+						 rate,
+						 XGIfb_vrate[i-1].refresh);
 					xgifb_info->rate_idx =
 						XGIfb_vrate[i - 1].idx;
 					xgifb_info->refresh_rate =
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c
index ae10153..80dba6a 100644
--- a/drivers/staging/xgifb/vb_init.c
+++ b/drivers/staging/xgifb/vb_init.c
@@ -1042,9 +1042,8 @@ static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension,
 
 	if (tempbx & tempcx) {
 		CR3CData = xgifb_reg_get(pVBInfo->P3d4, 0x3c);
-		if (!(CR3CData & DisplayDeviceFromCMOS)) {
+		if (!(CR3CData & DisplayDeviceFromCMOS))
 			tempcx = 0x1FF0;
-		}
 	} else {
 		tempcx = 0x1FF0;
 	}
diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index 01a3ef3..e81149f 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -945,23 +945,26 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 
 	if (pVBInfo->IF_DEF_LVDS == 0) {
 		CRT2Index = CRT2Index >> 6; /*  for LCD */
-		if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/
+		if (pVBInfo->VBInfo &
+		    (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) { /*301b*/
 			if (pVBInfo->LCDResInfo != Panel_1024x768)
-				VCLKIndex =  VCLK108_2_315 + 5; /* LCDXlat2VCLK */
+				/* LCDXlat2VCLK */
+				VCLKIndex = VCLK108_2_315 + 5;
 			else
 				VCLKIndex = VCLK65_315 + 2; /* LCDXlat1VCLK */
 		} else if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-			if (pVBInfo->SetFlag & RPLLDIV2XO) {
+			if (pVBInfo->SetFlag & RPLLDIV2XO)
 				VCLKIndex = TVCLKBASE_315_25 + HiTVVCLKDIV2;
-			} else {
+			else
 				VCLKIndex = TVCLKBASE_315_25 + HiTVVCLK;
-			}
 
 			if (pVBInfo->SetFlag & TVSimuMode) {
 				if (modeflag & Charx8Dot) {
-					VCLKIndex = TVCLKBASE_315_25 + HiTVSimuVCLK;
+					VCLKIndex = TVCLKBASE_315_25 +
+							HiTVSimuVCLK;
 				} else {
-					VCLKIndex = TVCLKBASE_315_25 + HiTVTextVCLK;
+					VCLKIndex = TVCLKBASE_315_25 +
+							HiTVTextVCLK;
 				}
 			}
 
@@ -978,11 +981,10 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 					VCLKIndex = YPbPr525iVCLK;
 			}
 		} else if (pVBInfo->VBInfo & SetCRT2ToTV) {
-			if (pVBInfo->SetFlag & RPLLDIV2XO) {
+			if (pVBInfo->SetFlag & RPLLDIV2XO)
 				VCLKIndex = TVCLKBASE_315_25 + TVVCLKDIV2;
-			} else {
+			else
 				VCLKIndex = TVCLKBASE_315_25 + TVVCLK;
-			}
 		} else { /* for CRT2 */
 			/* di+Ext_CRTVCLK */
 			VCLKIndex = pVBInfo->RefIndex[RefreshRateTableIndex].
@@ -994,7 +996,8 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
 		    (pVBInfo->LCDResInfo == Panel_320x480))
 			VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
 		else
-			VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK  */
+			VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK,
+						       LVDSXlat3VCLK  */
 	}
 
 	return VCLKIndex;
@@ -1928,7 +1931,8 @@ static void XGI_GetLVDSData(unsigned short ModeNo, unsigned short ModeIdIndex,
 				pVBInfo->HDE = 1024;
 				pVBInfo->VDE = 768;
 			} else if ((pVBInfo->LCDResInfo == Panel_1280x1024) ||
-				   (pVBInfo->LCDResInfo == Panel_1280x1024x75)) {
+				   (pVBInfo->LCDResInfo ==
+					Panel_1280x1024x75)) {
 				pVBInfo->HDE = 1280;
 				pVBInfo->VDE = 1024;
 			} else if (pVBInfo->LCDResInfo == Panel_1400x1050) {
@@ -2385,7 +2389,8 @@ static unsigned char XGI_GetVCLKPtr(unsigned short RefreshRateTableIndex,
 				if (pVBInfo->TVInfo & TVSimuMode) {
 					tempal = TVCLKBASE_315 + HiTVSimuVCLK;
 					if (!(modeflag & Charx8Dot))
-						tempal = TVCLKBASE_315 + HiTVTextVCLK;
+						tempal = TVCLKBASE_315 +
+								HiTVTextVCLK;
 
 				}
 				return tempal;
@@ -2431,8 +2436,8 @@ static void XGI_GetVCLKLen(unsigned char tempal, unsigned char *di_0,
 {
 	if (pVBInfo->VBType & (VB_SIS301 | VB_SIS301B | VB_SIS302B
 			| VB_SIS301LV | VB_SIS302LV | VB_XGI301C)) {
-		if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) && (pVBInfo->SetFlag
-				& ProgrammingCRT2)) {
+		if ((!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA)) &&
+		    (pVBInfo->SetFlag & ProgrammingCRT2)) {
 			*di_0 = (unsigned char) XGI_VBVCLKData[tempal].SR2B;
 			*di_1 = XGI_VBVCLKData[tempal].SR2C;
 		}
@@ -2948,7 +2953,10 @@ static unsigned char XGI_GetLCDInfo(unsigned short ModeNo,
 		if ((pVBInfo->LCDResInfo == Panel_1400x1050) && (pVBInfo->VBInfo
 				& SetCRT2ToLCD) && (resinfo == 9) &&
 				(!(tempbx & EnableScalingLCD)))
-			/* set to center in 1280x1024 LCDB for Panel_1400x1050 */
+			/*
+			 * set to center in 1280x1024 LCDB
+			 * for Panel_1400x1050
+			 */
 			tempbx |= SetLCDtoNonExpanding;
 	}
 
@@ -5451,7 +5459,8 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info,
 			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
 				if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
 					tempah = 0x7F; /* Disable Channel A */
-					if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA))
+					if (!(pVBInfo->VBInfo &
+					      XGI_SetCRT2ToLCDA))
 						/* Disable Channel B */
 						tempah = 0xBF;
 
@@ -5470,9 +5479,10 @@ static void XGI_DisableBridge(struct xgifb_video_info *xgifb_info,
 		xgifb_reg_and(pVBInfo->Part4Port, 0x1F, tempah);
 
 		if (pVBInfo->VBType & (VB_SIS302LV | VB_XGI301C)) {
-			if (((pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
-					|| (XGI_DisableChISLCD(pVBInfo))
-					|| (XGI_IsLCDON(pVBInfo)))
+			if (((pVBInfo->VBInfo &
+			      (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)))
+			    || (XGI_DisableChISLCD(pVBInfo))
+			    || (XGI_IsLCDON(pVBInfo)))
 				/* LVDS Driver power down */
 				xgifb_reg_or(pVBInfo->Part4Port, 0x30, 0x80);
 		}
@@ -5638,7 +5648,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
 
 			if (pVBInfo->VBInfo & SetCRT2ToDualEdge)
 				tempbl = tempbl >> 4;
-			if (pVBInfo->VBInfo & (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
+			if (pVBInfo->VBInfo &
+			    (SetCRT2ToLCD | XGI_SetCRT2ToLCDA)) {
 				tempbh = XGI301LCDDelay;
 
 				if (!(pVBInfo->VBInfo & XGI_SetCRT2ToLCDA))
@@ -5655,7 +5666,8 @@ static void XGI_SetDelayComp(struct vb_device_info *pVBInfo)
 				tempah |= tempbl;
 			}
 
-			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { /* Channel A */
+			if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
+				/* Channel A */
 				tempah &= 0x0F;
 				tempah |= tempbh;
 			}
@@ -6723,9 +6735,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
 
 	XGI_UpdateModeInfo(HwDeviceExtension, pVBInfo);
 
-	if (HwDeviceExtension->jChipType < XG20) {
+	if (HwDeviceExtension->jChipType < XG20)
 		XGI_LockCRT2(HwDeviceExtension, pVBInfo);
-	}
 
 	return 1;
 }
diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h
index ca8c68d..1c16846 100644
--- a/drivers/staging/xgifb/vb_table.h
+++ b/drivers/staging/xgifb/vb_table.h
@@ -1838,9 +1838,12 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDataTable[] = {
 	{Panel_1024x768x75, 0x0019, 0x0001, 12}, /* XGI_ExtLCD1024x768x75Data */
 	{Panel_1024x768x75, 0x0019, 0x0000, 13}, /* XGI_StLCD1024x768x75Data */
 	{Panel_1024x768x75, 0x0018, 0x0010, 14}, /* XGI_CetLCD1024x768x75Data */
-	{Panel_1280x1024x75, 0x0019, 0x0001, 15}, /* XGI_ExtLCD1280x1024x75Data*/
-	{Panel_1280x1024x75, 0x0019, 0x0000, 16}, /* XGI_StLCD1280x1024x75Data */
-	{Panel_1280x1024x75, 0x0018, 0x0010, 17}, /* XGI_CetLCD1280x1024x75Data*/
+	/* XGI_ExtLCD1280x1024x75Data */
+	{Panel_1280x1024x75, 0x0019, 0x0001, 15},
+	/* XGI_StLCD1280x1024x75Data */
+	{Panel_1280x1024x75, 0x0019, 0x0000, 16},
+	/* XGI_CetLCD1280x1024x75Data */
+	{Panel_1280x1024x75, 0x0018, 0x0010, 17},
 	{PanelRef75Hz, 0x0008, 0x0008, 18}, /* XGI_NoScalingDatax75 */
 	{0xFF, 0x0000, 0x0000, 0} /* End of table */
 };
@@ -1859,9 +1862,12 @@ static struct XGI330_LCDDataTablStruct XGI_LCDDesDataTable[] = {
 	{Panel_1600x1200, 0x0019, 0x0001, 10}, /* XGI_ExtLCDDes1600x1200Data */
 	{Panel_1600x1200, 0x0019, 0x0000, 11}, /* XGI_StLCDDes1600x1200Data */
 	{PanelRef60Hz, 0x0008, 0x0008, 12}, /* XGI_NoScalingDesData */
-	{Panel_1024x768x75, 0x0019, 0x0001, 13}, /*XGI_ExtLCDDes1024x768x75Data*/
-	{Panel_1024x768x75, 0x0019, 0x0000, 14}, /* XGI_StLCDDes1024x768x75Data*/
-	{Panel_1024x768x75, 0x0018, 0x0010, 15}, /*XGI_CetLCDDes1024x768x75Data*/
+	/* XGI_ExtLCDDes1024x768x75Data */
+	{Panel_1024x768x75, 0x0019, 0x0001, 13},
+	/* XGI_StLCDDes1024x768x75Data */
+	{Panel_1024x768x75, 0x0019, 0x0000, 14},
+	/* XGI_CetLCDDes1024x768x75Data */
+	{Panel_1024x768x75, 0x0018, 0x0010, 15},
 	/* XGI_ExtLCDDes1280x1024x75Data */
 	{Panel_1280x1024x75, 0x0019, 0x0001, 16},
 	/* XGI_StLCDDes1280x1024x75Data */
@@ -1898,8 +1904,10 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDataPtr[] = {
 	{PanelRef60Hz, 0x0008, 0x0008, 7}, /* XGI_LVDSNoScalingData */
 	{Panel_1024x768x75, 0x0018, 0x0000, 8}, /* XGI_LVDS1024x768Data_1x75 */
 	{Panel_1024x768x75, 0x0018, 0x0010, 9}, /* XGI_LVDS1024x768Data_2x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0000, 10}, /* XGI_LVDS1280x1024Data_1x75*/
-	{Panel_1280x1024x75, 0x0018, 0x0010, 11},  /*XGI_LVDS1280x1024Data_2x75*/
+	/* XGI_LVDS1280x1024Data_1x75 */
+	{Panel_1280x1024x75, 0x0018, 0x0000, 10},
+	/* XGI_LVDS1280x1024Data_2x75 */
+	{Panel_1280x1024x75, 0x0018, 0x0010, 11},
 	{PanelRef75Hz, 0x0008, 0x0008, 12}, /* XGI_LVDSNoScalingDatax75 */
 	{0xFF, 0x0000, 0x0000, 0}
 };
@@ -1917,8 +1925,10 @@ static struct XGI330_LCDDataTablStruct XGI_EPLLCDDesDataPtr[] = {
 	{Panel_1024x768x75, 0x0018, 0x0000, 9}, /* XGI_LVDS1024x768Des_1x75 */
 	{Panel_1024x768x75, 0x0618, 0x0410, 10}, /* XGI_LVDS1024x768Des_3x75 */
 	{Panel_1024x768x75, 0x0018, 0x0010, 11}, /* XGI_LVDS1024x768Des_2x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0000, 12}, /* XGI_LVDS1280x1024Des_1x75 */
-	{Panel_1280x1024x75, 0x0018, 0x0010, 13}, /* XGI_LVDS1280x1024Des_2x75 */
+	/* XGI_LVDS1280x1024Des_1x75 */
+	{Panel_1280x1024x75, 0x0018, 0x0000, 12},
+	/* XGI_LVDS1280x1024Des_2x75 */
+	{Panel_1280x1024x75, 0x0018, 0x0010, 13},
 	{PanelRef75Hz, 0x0008, 0x0008, 14}, /* XGI_LVDSNoScalingDesDatax75 */
 	{0xFF, 0x0000, 0x0000, 0}
 };
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* [PATCH 19/19 v2] Staging: xgifb: Remove useless condition.
  2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
                     ` (17 preceding siblings ...)
  2012-07-06 10:40   ` [PATCH 18/19 v2] Staging: xgifb: Fix coding style Miguel Gómez
@ 2012-07-06 10:40   ` Miguel Gómez
  18 siblings, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-06 10:40 UTC (permalink / raw)
  To: arnaud.patard, gregkh, aaro.koskinen, dan.carpenter
  Cc: devel, linux-kernel, Miguel Gómez

Remove last if branch in XGIfb_do_set_var(), as it has no action assigned.

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 0f49a21..64ffd70 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -973,8 +973,6 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 		vtotal <<= 1;
 	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE)
 		vtotal <<= 2;
-	else if ((var->vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
-	}
 
 	if (!htotal || !vtotal) {
 		pr_debug("Invalid 'var' information\n");
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 56+ messages in thread

* Re: [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe().
  2012-07-06 10:40   ` [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
@ 2012-07-09 18:39     ` Greg KH
  2012-07-09 22:08       ` Aaro Koskinen
  2012-07-13 14:02       ` Miguel Gómez
  0 siblings, 2 replies; 56+ messages in thread
From: Greg KH @ 2012-07-09 18:39 UTC (permalink / raw)
  To: Miguel Gómez
  Cc: arnaud.patard, aaro.koskinen, dan.carpenter, devel, linux-kernel

On Fri, Jul 06, 2012 at 12:40:38PM +0200, Miguel Gómez wrote:
> The piece of code that checks for LCDA in xgifb_probe() just checks for some
> register values but doesn't really do anything in response to them (the actions
> that should be executed are commented).
> As nothing is really being done, the code can be safely removed.

Are you sure?  Some devices (foolish ones that is) need registers read
to work properly as that is part of their start-up logic.  Yeah, it
doesn't seem to make sense, but hardware designers usually have good
reasons for doing this type of thing.  Or at least they think they do :)

So have you tested the device after this change and it all works
properly?  You do have this device, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe().
  2012-07-09 18:39     ` Greg KH
@ 2012-07-09 22:08       ` Aaro Koskinen
  2012-07-13 14:02       ` Miguel Gómez
  1 sibling, 0 replies; 56+ messages in thread
From: Aaro Koskinen @ 2012-07-09 22:08 UTC (permalink / raw)
  To: Greg KH
  Cc: Miguel Gómez, arnaud.patard, dan.carpenter, devel, linux-kernel

Hi,

On Mon, Jul 09, 2012 at 11:39:47AM -0700, Greg KH wrote:
> On Fri, Jul 06, 2012 at 12:40:38PM +0200, Miguel Gómez wrote:
> > The piece of code that checks for LCDA in xgifb_probe() just checks for some
> > register values but doesn't really do anything in response to them (the actions
> > that should be executed are commented).
> > As nothing is really being done, the code can be safely removed.
> 
> Are you sure?  Some devices (foolish ones that is) need registers read
> to work properly as that is part of their start-up logic.  Yeah, it
> doesn't seem to make sense, but hardware designers usually have good
> reasons for doing this type of thing.  Or at least they think they do :)

Those registers (CR 0x30..0x38) are scratch registers, so reading them
should have no side effects in the device side. I think it's safe to
delete that code.

A.

^ permalink raw reply	[flat|nested] 56+ messages in thread

* Re: [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe().
  2012-07-09 18:39     ` Greg KH
  2012-07-09 22:08       ` Aaro Koskinen
@ 2012-07-13 14:02       ` Miguel Gómez
  1 sibling, 0 replies; 56+ messages in thread
From: Miguel Gómez @ 2012-07-13 14:02 UTC (permalink / raw)
  To: Greg KH; +Cc: arnaud.patard, aaro.koskinen, dan.carpenter, devel, linux-kernel

El 09/07/12 20:39, Greg KH escribió:
> On Fri, Jul 06, 2012 at 12:40:38PM +0200, Miguel Gómez wrote:
>> The piece of code that checks for LCDA in xgifb_probe() just checks for some
>> register values but doesn't really do anything in response to them (the actions
>> that should be executed are commented).
>> As nothing is really being done, the code can be safely removed.
>
> Are you sure?  Some devices (foolish ones that is) need registers read
> to work properly as that is part of their start-up logic.  Yeah, it
> doesn't seem to make sense, but hardware designers usually have good
> reasons for doing this type of thing.  Or at least they think they do :)

Weird... I didn't expect that some devices might need those reads to 
work properly... I'm writing down that comment for the future ;)

> So have you tested the device after this change and it all works
> properly?  You do have this device, right?

I have an XGI Z7 card that I use for testing, and it doesn't require 
those reads to work properly, despite I don't have a Z9 or Z11 to test. 
But according to Aaro's comment, it seems that the patch is safe as 
these register reads don't have any effect.

Regards!

-- 
Miguel Gómez
Igalia - http://www.igalia.com



^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2012-07-13 14:02 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-05 14:45 [PATCH 00/19] Several cleanings and style fixes Miguel Gómez
2012-07-05 14:45 ` [PATCH 01/19] Staging: xgifb: Comment cleaning Miguel Gómez
2012-07-05 17:24   ` Aaro Koskinen
2012-07-06  8:00     ` Miguel Gómez
2012-07-05 17:35   ` Joe Perches
2012-07-06  8:02     ` Miguel Gómez
2012-07-05 20:35   ` Dan Carpenter
2012-07-06  8:14     ` Miguel Gómez
2012-07-05 14:45 ` [PATCH 02/19] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
2012-07-05 14:45 ` [PATCH 03/19] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
2012-07-05 14:45 ` [PATCH 04/19] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
2012-07-05 14:45 ` [PATCH 05/19] Staging: xgifb: Improve debug strings Miguel Gómez
2012-07-05 17:42   ` Aaro Koskinen
2012-07-06  8:09     ` Miguel Gómez
2012-07-05 14:45 ` [PATCH 06/19] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
2012-07-05 14:45 ` [PATCH 07/19] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
2012-07-05 14:45 ` [PATCH 08/19] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
2012-07-05 14:45 ` [PATCH 09/19] Staging: xgifb: Remove useless always true condition Miguel Gómez
2012-07-05 14:45 ` [PATCH 10/19] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
2012-07-05 14:45 ` [PATCH 11/19] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
2012-07-05 14:45 ` [PATCH 12/19] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
2012-07-05 14:45 ` [PATCH 13/19] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
2012-07-05 14:45 ` [PATCH 14/19] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
2012-07-05 14:45 ` [PATCH 15/19] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
2012-07-05 18:00   ` Aaro Koskinen
2012-07-06  8:12     ` Miguel Gómez
2012-07-06  6:51   ` Dan Carpenter
2012-07-06  9:04     ` Miguel Gómez
2012-07-06 10:27       ` Dan Carpenter
2012-07-05 14:45 ` [PATCH 16/19] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
2012-07-05 14:46 ` [PATCH 17/19] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
2012-07-05 14:46 ` [PATCH 18/19] Staging: xgifb: Fix coding style Miguel Gómez
2012-07-05 14:46 ` [PATCH 19/19] Staging: xgifb: Remove useless condition Miguel Gómez
2012-07-06 10:40 ` [PATCH 00/19 v2] Several cleanings and style fixes Miguel Gómez
2012-07-06 10:40   ` [PATCH 01/19 v2] Staging: xgifb: Comment cleaning Miguel Gómez
2012-07-06 10:40   ` [PATCH 02/19 v2] Staging: xgifb: Remove unneeded XGI_LCD_TYPE enumeration Miguel Gómez
2012-07-06 10:40   ` [PATCH 03/19 v2] Staging: xgifb: Remove LCDA detection in xgifb_probe() Miguel Gómez
2012-07-09 18:39     ` Greg KH
2012-07-09 22:08       ` Aaro Koskinen
2012-07-13 14:02       ` Miguel Gómez
2012-07-06 10:40   ` [PATCH 04/19 v2] Staging: xgifb: Remove unused struct _chswtable Miguel Gómez
2012-07-06 10:40   ` [PATCH 05/19 v2] Staging: xgifb: Improve debug strings Miguel Gómez
2012-07-06 10:40   ` [PATCH 06/19 v2] Staging: xgifb: Remove useless switch in XGIfb_detect_VB() Miguel Gómez
2012-07-06 10:40   ` [PATCH 07/19 v2] Staging: xgifb: Simplify XGIfb_GetXG21DefaultLVDSModeIdx() Miguel Gómez
2012-07-06 10:40   ` [PATCH 08/19 v2] Staging: xgifb: Remove unneeded var and condition in XGIfb_search_vesamode() Miguel Gómez
2012-07-06 10:40   ` [PATCH 09/19 v2] Staging: xgifb: Remove useless always true condition Miguel Gómez
2012-07-06 10:40   ` [PATCH 10/19 v2] Staging: xgifb: Rework conditions in XGI_SetATTRegs() Miguel Gómez
2012-07-06 10:40   ` [PATCH 11/19 v2] Staging: xgifb: Refactor XGI_AjustCRT2Rate() Miguel Gómez
2012-07-06 10:40   ` [PATCH 12/19 v2] Staging: xgifb: Refactor XGI_GetVBType() Miguel Gómez
2012-07-06 10:40   ` [PATCH 13/19 v2] Staging: xgifb: Rework conditions in XGI_GetVBInfo() Miguel Gómez
2012-07-06 10:40   ` [PATCH 14/19 v2] Staging: xgifb: Refactor XGI_GetCRT2ResInfo() Miguel Gómez
2012-07-06 10:40   ` [PATCH 15/19 v2] Staging: xgifb: Rework conditions in XGI_SetLockRegs() Miguel Gómez
2012-07-06 10:40   ` [PATCH 16/19 v2] Staging: xgifb: Rework conditions in XGI_EnableBridge() Miguel Gómez
2012-07-06 10:40   ` [PATCH 17/19 v2] Staging: xgifb: Rework some conditions in XGI_SetCRT2ModeRegs() Miguel Gómez
2012-07-06 10:40   ` [PATCH 18/19 v2] Staging: xgifb: Fix coding style Miguel Gómez
2012-07-06 10:40   ` [PATCH 19/19 v2] Staging: xgifb: Remove useless condition Miguel Gómez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.