Staging: xgifb: Fixed style issues.
authorKenji Toyama <kenji.toyama@gmail.com>
Tue, 26 Apr 2011 04:13:43 +0000 (12:13 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Apr 2011 22:46:28 +0000 (15:46 -0700)
Not all warnings/errors were silenced, some of them are related to
simple printk() messages that imho should not be split across multiple
lines (it makes it harder to grep for example), and some of them are
related to long lines that are pretty much impossible to split without
proper code refactoring.

Resubmitting this patch because of conflicts.

Signed-off-by: Daniel Kenji Toyama <kenji.toyama@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/xgifb/XGI_main_26.c

index c0b2c7a..cadec2a 100644 (file)
@@ -33,7 +33,7 @@
 #define XGIFB_PAN
 #endif
 
-#include <asm/io.h>
+#include <linux/io.h>
 #ifdef CONFIG_MTRR
 #include <asm/mtrr.h>
 #endif
@@ -349,10 +349,10 @@ static int XGIfb_mode_rate_to_ddata(struct vb_device_info *XGI_Pr,
        else {
                j = 0;
                while (XGI_Pr->EModeIDTable[j].Ext_ModeID != 0xff) {
-                       if (XGI_Pr->EModeIDTable[j].Ext_ModeID
-                                       == XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) {
-                               if (XGI_Pr->EModeIDTable[j].Ext_ModeFlag
-                                               & DoubleScanMode) {
+                       if (XGI_Pr->EModeIDTable[j].Ext_ModeID ==
+                           XGI_Pr->RefIndex[RefreshRateTableIndex].ModeID) {
+                               if (XGI_Pr->EModeIDTable[j].Ext_ModeFlag &
+                                   DoubleScanMode) {
                                        *vmode = FB_VMODE_DOUBLE;
                                }
                                break;
@@ -378,11 +378,16 @@ static void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr)
        XGI_Pr->P3c8 = BaseAddr + 0x18;
        XGI_Pr->P3c9 = BaseAddr + 0x19;
        XGI_Pr->P3da = BaseAddr + 0x2A;
-       XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04; /* Digital video interface registers (LCD) */
-       XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10; /* 301 TV Encoder registers */
-       XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12; /* 301 Macrovision registers */
-       XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14; /* 301 VGA2 (and LCD) registers */
-       XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2; /* 301 palette address port registers */
+       /* Digital video interface registers (LCD) */
+       XGI_Pr->Part1Port = BaseAddr + XGI_CRT2_PORT_04;
+       /* 301 TV Encoder registers */
+       XGI_Pr->Part2Port = BaseAddr + XGI_CRT2_PORT_10;
+       /* 301 Macrovision registers */
+       XGI_Pr->Part3Port = BaseAddr + XGI_CRT2_PORT_12;
+       /* 301 VGA2 (and LCD) registers */
+       XGI_Pr->Part4Port = BaseAddr + XGI_CRT2_PORT_14;
+       /* 301 palette address port registers */
+       XGI_Pr->Part5Port = BaseAddr + XGI_CRT2_PORT_14 + 2;
 
 }
 
@@ -511,8 +516,8 @@ static void XGIfb_search_vesamode(unsigned int vesamode)
        vesamode &= 0x1dff; /* Clean VESA mode number from other flags */
 
        while (XGIbios_mode[i].mode_no != 0) {
-               if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode)
-                               || (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
+               if ((XGIbios_mode[i].vesa_mode_no_1 == vesamode) ||
+                   (XGIbios_mode[i].vesa_mode_no_2 == vesamode)) {
                        xgifb_mode_idx = i;
                        j = 1;
                        break;
@@ -533,7 +538,9 @@ static int XGIfb_GetXG21LVDSData(void)
        xgifb_reg_set(XGISR, 0x1e, tmp | 4);
 
        pData = xgi_video_info.mmio_vbase + 0x20000;
-       if ((pData[0x0] == 0x55) && (pData[0x1] == 0xAA) && (pData[0x65] & 0x1)) {
+       if ((pData[0x0] == 0x55) &&
+           (pData[0x1] == 0xAA) &&
+           (pData[0x65] & 0x1)) {
                i = pData[0x316] | (pData[0x317] << 8);
                j = pData[i - 1];
                if (j == 0xff)
@@ -589,8 +596,8 @@ static int XGIfb_validate_mode(int myindex)
                                return -1;
                        if (XGIbios_mode[myindex].yres > yres)
                                return -1;
-                       if ((XGIbios_mode[myindex].xres < xres)
-                                       && (XGIbios_mode[myindex].yres < yres)) {
+                       if ((XGIbios_mode[myindex].xres < xres) &&
+                           (XGIbios_mode[myindex].yres < yres)) {
                                if (XGIbios_mode[myindex].bpp > 8)
                                        return -1;
                        }
@@ -666,7 +673,7 @@ static int XGIfb_validate_mode(int myindex)
                if (XGIbios_mode[myindex].yres > yres)
                        return -1;
                if ((XGIhw_ext.ulExternalChip == 0x01) || /* LVDS */
-                               (XGIhw_ext.ulExternalChip == 0x05)) { /* LVDS+Chrontel */
+                   (XGIhw_ext.ulExternalChip == 0x05)) { /* LVDS+Chrontel */
                        switch (XGIbios_mode[myindex].xres) {
                        case 512:
                                if (XGIbios_mode[myindex].yres != 512)
@@ -685,13 +692,11 @@ static int XGIfb_validate_mode(int myindex)
                                        return -1;
                                break;
                        case 1024:
-                               if ((XGIbios_mode[myindex].yres != 600)
-                                               && (XGIbios_mode[myindex].yres
-                                                               != 768))
+                               if ((XGIbios_mode[myindex].yres != 600) &&
+                                   (XGIbios_mode[myindex].yres != 768))
                                        return -1;
-                               if ((XGIbios_mode[myindex].yres == 600)
-                                               && (XGIhw_ext.ulCRT2LCDType
-                                                               != LCD_1024x600))
+                               if ((XGIbios_mode[myindex].yres == 600) &&
+                                   (XGIhw_ext.ulCRT2LCDType != LCD_1024x600))
                                        return -1;
                                break;
                        case 1152:
@@ -701,13 +706,11 @@ static int XGIfb_validate_mode(int myindex)
                                        return -1;
                                break;
                        case 1280:
-                               if ((XGIbios_mode[myindex].yres != 768)
-                                               && (XGIbios_mode[myindex].yres
-                                                               != 1024))
+                               if ((XGIbios_mode[myindex].yres != 768) &&
+                                   (XGIbios_mode[myindex].yres != 1024))
                                        return -1;
-                               if ((XGIbios_mode[myindex].yres == 768)
-                                               && (XGIhw_ext.ulCRT2LCDType
-                                                               != LCD_1280x768))
+                               if ((XGIbios_mode[myindex].yres == 768) &&
+                                   (XGIhw_ext.ulCRT2LCDType != LCD_1280x768))
                                        return -1;
                                break;
                        case 1400:
@@ -728,9 +731,8 @@ static int XGIfb_validate_mode(int myindex)
                                        return -1;
                                break;
                        case 640:
-                               if ((XGIbios_mode[myindex].yres != 400)
-                                               && (XGIbios_mode[myindex].yres
-                                                               != 480))
+                               if ((XGIbios_mode[myindex].yres != 400) &&
+                                   (XGIbios_mode[myindex].yres != 480))
                                        return -1;
                                break;
                        case 800:
@@ -742,13 +744,12 @@ static int XGIfb_validate_mode(int myindex)
                                        return -1;
                                break;
                        case 1280:
-                               if ((XGIbios_mode[myindex].yres != 960)
-                                               && (XGIbios_mode[myindex].yres
-                                                               != 1024))
+                               if ((XGIbios_mode[myindex].yres != 960) &&
+                                   (XGIbios_mode[myindex].yres != 1024))
                                        return -1;
                                if (XGIbios_mode[myindex].yres == 960) {
-                                       if (XGIhw_ext.ulCRT2LCDType
-                                                       == LCD_1400x1050)
+                                       if (XGIhw_ext.ulCRT2LCDType ==
+                                           LCD_1400x1050)
                                                return -1;
                                }
                                break;
@@ -780,8 +781,8 @@ static int XGIfb_validate_mode(int myindex)
                                        return -1;
                        }
                        /*  TW: LVDS/CHRONTEL does not support 720 */
-                       if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL
-                                       || xgi_video_info.hasVB == HASVB_CHRONTEL) {
+                       if (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL ||
+                           xgi_video_info.hasVB == HASVB_CHRONTEL) {
                                return -1;
                        }
                        break;
@@ -833,31 +834,31 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
 
        XGIfb_rate_idx = 0;
        while ((XGIfb_vrate[i].idx != 0) && (XGIfb_vrate[i].xres <= xres)) {
-               if ((XGIfb_vrate[i].xres == xres) && (XGIfb_vrate[i].yres
-                               == yres)) {
+               if ((XGIfb_vrate[i].xres == xres) &&
+                   (XGIfb_vrate[i].yres == yres)) {
                        if (XGIfb_vrate[i].refresh == rate) {
                                XGIfb_rate_idx = XGIfb_vrate[i].idx;
                                break;
                        } else if (XGIfb_vrate[i].refresh > rate) {
                                if ((XGIfb_vrate[i].refresh - rate) <= 3) {
                                        DPRINTK("XGIfb: Adjusting rate from %d up to %d\n",
-                                                       rate, XGIfb_vrate[i].refresh);
+                                               rate, XGIfb_vrate[i].refresh);
                                        XGIfb_rate_idx = XGIfb_vrate[i].idx;
-                                       xgi_video_info.refresh_rate
-                                                       = XGIfb_vrate[i].refresh;
+                                       xgi_video_info.refresh_rate =
+                                               XGIfb_vrate[i].refresh;
                                } else if (((rate - XGIfb_vrate[i - 1].refresh)
                                                <= 2) && (XGIfb_vrate[i].idx
                                                != 1)) {
                                        DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
-                                                       rate, XGIfb_vrate[i-1].refresh);
+                                               rate, XGIfb_vrate[i-1].refresh);
                                        XGIfb_rate_idx = XGIfb_vrate[i - 1].idx;
-                                       xgi_video_info.refresh_rate
-                                                       = XGIfb_vrate[i - 1].refresh;
+                                       xgi_video_info.refresh_rate =
+                                               XGIfb_vrate[i - 1].refresh;
                                }
                                break;
                        } else if ((rate - XGIfb_vrate[i].refresh) <= 2) {
                                DPRINTK("XGIfb: Adjusting rate from %d down to %d\n",
-                                               rate, XGIfb_vrate[i].refresh);
+                                       rate, XGIfb_vrate[i].refresh);
                                XGIfb_rate_idx = XGIfb_vrate[i].idx;
                                break;
                        }
@@ -867,8 +868,8 @@ static u8 XGIfb_search_refresh_rate(unsigned int rate)
        if (XGIfb_rate_idx > 0) {
                return XGIfb_rate_idx;
        } else {
-               printk(KERN_INFO
-                               "XGIfb: Unsupported rate %d for %dx%d\n", rate, xres, yres);
+               printk(KERN_INFO "XGIfb: Unsupported rate %d for %dx%d\n",
+                      rate, xres, yres);
                return 0;
        }
 }
@@ -983,12 +984,14 @@ static void XGIfb_post_setmode(void)
        *test*
        */
        if (xgi_video_info.video_bpp == 8) {
-               /* TW: We can't switch off CRT1 on LVDS/Chrontel in 8bpp Modes */
-               if ((xgi_video_info.hasVB == HASVB_LVDS)
-                               || (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
+               /* TW: We can't switch off CRT1 on LVDS/Chrontel
+                * in 8bpp Modes */
+               if ((xgi_video_info.hasVB == HASVB_LVDS) ||
+                   (xgi_video_info.hasVB == HASVB_LVDS_CHRONTEL)) {
                        doit = 0;
                }
-               /* TW: We can't switch off CRT1 on 301B-DH in 8bpp Modes if using LCD */
+               /* TW: We can't switch off CRT1 on 301B-DH
+                * in 8bpp Modes if using LCD */
                if (xgi_video_info.disp_state & DISPTYPE_LCD)
                        doit = 0;
        }
@@ -1019,25 +1022,27 @@ static void XGIfb_post_setmode(void)
                reg = xgifb_reg_get(XGIPART4, 0x01);
 
                if (reg < 0xB0) { /* Set filter for XGI301 */
-
                        switch (xgi_video_info.video_width) {
                        case 320:
-                               filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 4 : 12;
+                               filter_tb = (xgi_video_info.TV_type ==
+                                            TVMODE_NTSC) ? 4 : 12;
                                break;
                        case 640:
-                               filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 5 : 13;
+                               filter_tb = (xgi_video_info.TV_type ==
+                                            TVMODE_NTSC) ? 5 : 13;
                                break;
                        case 720:
-                               filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 6 : 14;
+                               filter_tb = (xgi_video_info.TV_type ==
+                                            TVMODE_NTSC) ? 6 : 14;
                                break;
                        case 800:
-                               filter_tb = (xgi_video_info.TV_type == TVMODE_NTSC) ? 7 : 15;
+                               filter_tb = (xgi_video_info.TV_type ==
+                                            TVMODE_NTSC) ? 7 : 15;
                                break;
                        default:
                                filter = -1;
                                break;
                        }
-
                        xgifb_reg_or(XGIPART1, XGIfb_CRT2_write_enable, 0x01);
 
                        if (xgi_video_info.TV_type == TVMODE_NTSC) {
@@ -1055,22 +1060,46 @@ static void XGIfb_post_setmode(void)
 
                                        switch (xgi_video_info.video_width) {
                                        case 640:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xEB);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0x04);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x25);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0x18);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xEB);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0x04);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x25);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0x18);
                                                break;
                                        case 720:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xEE);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0x0C);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x22);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0x08);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xEE);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0x0C);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x22);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0x08);
                                                break;
                                        case 800:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xEB);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0x15);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x25);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0xF6);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xEB);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0x15);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x25);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0xF6);
                                                break;
                                        }
                                }
@@ -1090,56 +1119,86 @@ static void XGIfb_post_setmode(void)
 
                                        switch (xgi_video_info.video_width) {
                                        case 640:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xF1);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0xF7);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x1F);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0x32);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xF1);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0xF7);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x1F);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0x32);
                                                break;
                                        case 720:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xF3);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0x00);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x1D);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0x20);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xF3);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0x00);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x1D);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0x20);
                                                break;
                                        case 800:
-                                               xgifb_reg_set(XGIPART2, 0x35, 0xFC);
-                                               xgifb_reg_set(XGIPART2, 0x36, 0xFB);
-                                               xgifb_reg_set(XGIPART2, 0x37, 0x14);
-                                               xgifb_reg_set(XGIPART2, 0x38, 0x2A);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x35,
+                                                             0xFC);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x36,
+                                                             0xFB);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x37,
+                                                             0x14);
+                                               xgifb_reg_set(XGIPART2,
+                                                             0x38,
+                                                             0x2A);
                                                break;
                                        }
                                }
                        }
 
                        if ((filter >= 0) && (filter <= 7)) {
-                               DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n", filter_tb, filter,
-                                               XGI_TV_filter[filter_tb].filter[filter][0],
-                                               XGI_TV_filter[filter_tb].filter[filter][1],
-                                               XGI_TV_filter[filter_tb].filter[filter][2],
-                                               XGI_TV_filter[filter_tb].filter[filter][3]
+                               DPRINTK("FilterTable[%d]-%d: %02x %02x %02x %02x\n",
+                                       filter_tb, filter,
+                                       XGI_TV_filter[filter_tb].
+                                               filter[filter][0],
+                                       XGI_TV_filter[filter_tb].
+                                               filter[filter][1],
+                                       XGI_TV_filter[filter_tb].
+                                               filter[filter][2],
+                                       XGI_TV_filter[filter_tb].
+                                               filter[filter][3]
                                );
                                xgifb_reg_set(
-                                               XGIPART2,
-                                               0x35,
-                                               (XGI_TV_filter[filter_tb].filter[filter][0]));
+                                       XGIPART2,
+                                       0x35,
+                                       (XGI_TV_filter[filter_tb].
+                                               filter[filter][0]));
                                xgifb_reg_set(
-                                               XGIPART2,
-                                               0x36,
-                                               (XGI_TV_filter[filter_tb].filter[filter][1]));
+                                       XGIPART2,
+                                       0x36,
+                                       (XGI_TV_filter[filter_tb].
+                                               filter[filter][1]));
                                xgifb_reg_set(
-                                               XGIPART2,
-                                               0x37,
-                                               (XGI_TV_filter[filter_tb].filter[filter][2]));
+                                       XGIPART2,
+                                       0x37,
+                                       (XGI_TV_filter[filter_tb].
+                                               filter[filter][2]));
                                xgifb_reg_set(
-                                               XGIPART2,
-                                               0x38,
-                                               (XGI_TV_filter[filter_tb].filter[filter][3]));
+                                       XGIPART2,
+                                       0x38,
+                                       (XGI_TV_filter[filter_tb].
+                                               filter[filter][3]));
                        }
-
                }
-
        }
-
 }
 
 static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
@@ -1190,7 +1249,10 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
        }
 
        printk(KERN_DEBUG "XGIfb: Change mode to %dx%dx%d-%dHz\n",
-                       var->xres, var->yres, var->bits_per_pixel, xgi_video_info.refresh_rate);
+              var->xres,
+              var->yres,
+              var->bits_per_pixel,
+              xgi_video_info.refresh_rate);
 
        old_mode = xgifb_mode_idx;
        xgifb_mode_idx = 0;
@@ -1215,8 +1277,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
                xgifb_mode_idx = -1;
 
        if (xgifb_mode_idx < 0) {
-               printk(KERN_ERR "XGIfb: Mode %dx%dx%d not supported\n", var->xres,
-                               var->yres, var->bits_per_pixel);
+               printk(KERN_ERR "XGIfb: Mode %dx%dx%d not supported\n",
+                      var->xres, var->yres, var->bits_per_pixel);
                xgifb_mode_idx = old_mode;
                return -EINVAL;
        }
@@ -1230,7 +1292,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
 
                XGIfb_pre_setmode();
                if (XGISetModeNew(&XGIhw_ext, XGIfb_mode_no) == 0) {
-                       printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n", XGIfb_mode_no);
+                       printk(KERN_ERR "XGIfb: Setting mode[0x%x] failed\n",
+                              XGIfb_mode_no);
                        return -EINVAL;
                }
                info->fix.line_length = ((info->var.xres_virtual
@@ -1239,7 +1302,9 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
                xgifb_reg_set(XGISR, IND_XGI_PASSWORD, XGI_PASSWORD);
 
                xgifb_reg_set(XGICR, 0x13, (info->fix.line_length & 0x00ff));
-               xgifb_reg_set(XGISR, 0x0E, (info->fix.line_length & 0xff00) >> 8);
+               xgifb_reg_set(XGISR,
+                             0x0E,
+                             (info->fix.line_length & 0xff00) >> 8);
 
                XGIfb_post_setmode();
 
@@ -1287,7 +1352,8 @@ static int XGIfb_do_set_var(struct fb_var_screeninfo *var, int isactive,
                        break;
                default:
                        xgi_video_info.video_cmap_len = 16;
-                       printk(KERN_ERR "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp);
+                       printk(KERN_ERR "XGIfb: Unsupported depth %d",
+                              xgi_video_info.video_bpp);
                        break;
                }
        }
@@ -1343,7 +1409,10 @@ static int XGIfb_pan_var(struct fb_var_screeninfo *var)
                xgifb_reg_set(XGIPART1, 0x06, (base & 0xFF));
                xgifb_reg_set(XGIPART1, 0x05, ((base >> 8) & 0xFF));
                xgifb_reg_set(XGIPART1, 0x04, ((base >> 16) & 0xFF));
-               xgifb_reg_and_or(XGIPART1, 0x02, 0x7F, ((base >> 24) & 0x01) << 7);
+               xgifb_reg_and_or(XGIPART1,
+                                0x02,
+                                0x7F,
+                                ((base >> 24) & 0x01) << 7);
        }
        /* printk("End of pan_var"); */
        return 0;
@@ -1493,7 +1562,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        if (var->pixclock && htotal && vtotal) {
                drate = 1000000000 / var->pixclock;
                hrate = (drate * 1000) / htotal;
-               xgi_video_info.refresh_rate = (unsigned int) (hrate * 2 / vtotal);
+               xgi_video_info.refresh_rate =
+                       (unsigned int) (hrate * 2 / vtotal);
                printk(KERN_DEBUG
                        "%s: pixclock = %d ,htotal=%d, vtotal=%d\n"
                        "%s: drate=%d, hrate=%d, refresh_rate=%d\n",
@@ -1536,10 +1606,10 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
                        var->xres, var->yres, var->bits_per_pixel);
                search_idx = 0;
                while (XGIbios_mode[search_idx].mode_no != 0) {
-
                        if ((var->xres <= XGIbios_mode[search_idx].xres) &&
-                               (var->yres <= XGIbios_mode[search_idx].yres) &&
-                               (var->bits_per_pixel == XGIbios_mode[search_idx].bpp)) {
+                           (var->yres <= XGIbios_mode[search_idx].yres) &&
+                           (var->bits_per_pixel ==
+                            XGIbios_mode[search_idx].bpp)) {
                                if (XGIfb_validate_mode(search_idx) > 0) {
                                        found_mode = 1;
                                        break;
@@ -1579,7 +1649,8 @@ static int XGIfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        } /* else { */
                /* TW: Now patch yres_virtual if we use panning */
                /* May I do this? */
-               /* var->yres_virtual = xgi_video_info.heapstart / (var->xres * (var->bits_per_pixel >> 3)); */
+               /* var->yres_virtual = xgi_video_info.heapstart /
+                       (var->xres * (var->bits_per_pixel >> 3)); */
                /* if (var->yres_virtual <= var->yres) { */
                /* TW: Paranoia check */
                /* var->yres_virtual = var->yres; */
@@ -1765,8 +1836,9 @@ static int XGIfb_get_dram_size(void)
        /* xgi_video_info.video_size = 0x200000; */ /* 1024x768x16 */
        /* xgi_video_info.video_size = 0x1000000; */ /* benchmark */
 
-       printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n", reg,
-                       xgi_video_info.video_size, ChannelNum);
+       printk("XGIfb: SR14=%x DramSzie %x ChannelNum %x\n",
+              reg,
+              xgi_video_info.video_size, ChannelNum);
        return 0;
 
 }
@@ -1897,15 +1969,19 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
                if (!strncmp(this_opt, "mode:", 5)) {
                        XGIfb_search_mode(this_opt + 5);
                } else if (!strncmp(this_opt, "vesa:", 5)) {
-                       XGIfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0));
+                       XGIfb_search_vesamode(simple_strtoul(
+                                               this_opt + 5, NULL, 0));
                } else if (!strncmp(this_opt, "mode:", 5)) {
                        XGIfb_search_mode(this_opt + 5);
                } else if (!strncmp(this_opt, "vesa:", 5)) {
-                       XGIfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0));
+                       XGIfb_search_vesamode(simple_strtoul(
+                                               this_opt + 5, NULL, 0));
                } else if (!strncmp(this_opt, "vrate:", 6)) {
-                       xgi_video_info.refresh_rate = simple_strtoul(this_opt + 6, NULL, 0);
+                       xgi_video_info.refresh_rate = simple_strtoul(
+                                               this_opt + 6, NULL, 0);
                } else if (!strncmp(this_opt, "rate:", 5)) {
-                       xgi_video_info.refresh_rate = simple_strtoul(this_opt + 5, NULL, 0);
+                       xgi_video_info.refresh_rate = simple_strtoul(
+                                               this_opt + 5, NULL, 0);
                } else if (!strncmp(this_opt, "off", 3)) {
                        XGIfb_off = 1;
                } else if (!strncmp(this_opt, "crt1off", 7)) {
@@ -1915,7 +1991,8 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
                } else if (!strncmp(this_opt, "forcecrt2type:", 14)) {
                        XGIfb_search_crt2type(this_opt + 14);
                } else if (!strncmp(this_opt, "forcecrt1:", 10)) {
-                       XGIfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0);
+                       XGIfb_forcecrt1 = (int)simple_strtoul(
+                                               this_opt + 10, NULL, 0);
                } else if (!strncmp(this_opt, "tvmode:", 7)) {
                        XGIfb_search_tvstd(this_opt + 7);
                } else if (!strncmp(this_opt, "tvstandard:", 11)) {
@@ -1933,12 +2010,15 @@ XGIINITSTATIC int __init XGIfb_setup(char *options)
                } else if (!strncmp(this_opt, "noypan", 6)) {
                        XGIfb_ypan = 0;
                } else if (!strncmp(this_opt, "userom:", 7)) {
-                       XGIfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0);
+                       XGIfb_userom = (int)simple_strtoul(
+                                               this_opt + 7, NULL, 0);
                        /* } else if (!strncmp(this_opt, "useoem:", 7)) { */
-                       /* XGIfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0); */
+                       /* XGIfb_useoem = (int)simple_strtoul(
+                                               this_opt + 7, NULL, 0); */
                } else {
                        XGIfb_search_mode(this_opt);
-                       /* printk(KERN_INFO "XGIfb: Invalid option %s\n", this_opt); */
+                       /* printk(KERN_INFO "XGIfb: Invalid option %s\n",
+                                 this_opt); */
                }
 
                /* TW: Panning only with acceleration */
@@ -1989,7 +2069,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                return -ENOMEM;
 
        xgi_video_info.chip_id = pdev->device;
-       pci_read_config_byte(pdev, PCI_REVISION_ID, &xgi_video_info.revision_id);
+       pci_read_config_byte(pdev,
+                            PCI_REVISION_ID,
+                            &xgi_video_info.revision_id);
        XGIhw_ext.jChipRevision = xgi_video_info.revision_id;
 
        xgi_video_info.pcibus = pdev->bus->number;
@@ -2005,7 +2087,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
        XGIhw_ext.pjIOAddress = (unsigned char *)xgi_video_info.vga_base;
        /* XGI_Pr.RelIO  = ioremap(pci_resource_start(pdev, 2), 128) + 0x30; */
        printk("XGIfb: Relocate IO address: %lx [%08lx]\n",
-                       (unsigned long)pci_resource_start(pdev, 2), XGI_Pr.RelIO);
+              (unsigned long)pci_resource_start(pdev, 2), XGI_Pr.RelIO);
 
        if (pci_enable_device(pdev)) {
                ret = -EIO;
@@ -2060,7 +2142,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
        if ((xgi_video_info.chip == XG21) || (XGIfb_userom)) {
                XGIhw_ext.pjVirtualRomBase = xgifb_copy_rom(pdev);
                if (XGIhw_ext.pjVirtualRomBase)
-                       printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n", XGIhw_ext.pjVirtualRomBase);
+                       printk(KERN_INFO "XGIfb: Video ROM found and mapped to %p\n",
+                              XGIhw_ext.pjVirtualRomBase);
                else
                        printk(KERN_INFO "XGIfb: Video ROM not found\n");
        } else {
@@ -2075,17 +2158,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                goto error;
        }
 
-       if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
+       if ((xgifb_mode_idx < 0) ||
+           ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
                /* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE  */
-               xgifb_reg_or(XGISR, IND_XGI_PCI_ADDRESS_SET, (XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE));
+               xgifb_reg_or(XGISR,
+                            IND_XGI_PCI_ADDRESS_SET,
+                            (XGI_PCI_ADDR_ENABLE | XGI_MEM_MAP_IO_ENABLE));
                /* Enable 2D accelerator engine */
                xgifb_reg_or(XGISR, IND_XGI_MODULE_ENABLE, XGI_ENABLE_2D);
        }
 
        XGIhw_ext.ulVideoMemorySize = xgi_video_info.video_size;
 
-       if (!request_mem_region(xgi_video_info.video_base, xgi_video_info.video_size, "XGIfb FB")) {
-               printk("unable request memory size %x", xgi_video_info.video_size);
+       if (!request_mem_region(xgi_video_info.video_base,
+                               xgi_video_info.video_size,
+                               "XGIfb FB")) {
+               printk("unable request memory size %x",
+                      xgi_video_info.video_size);
                printk(KERN_ERR "XGIfb: Fatal error: Unable to reserve frame buffer memory\n");
                printk(KERN_ERR "XGIfb: Is there another framebuffer driver active?\n");
                ret = -ENODEV;
@@ -2106,7 +2195,9 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                                            xgi_video_info.mmio_size);
 
        printk(KERN_INFO "XGIfb: Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
-                       xgi_video_info.video_base, xgi_video_info.video_vbase, xgi_video_info.video_size / 1024);
+              xgi_video_info.video_base,
+              xgi_video_info.video_vbase,
+              xgi_video_info.video_size / 1024);
 
        printk(KERN_INFO "XGIfb: MMIO at 0x%lx, mapped to 0x%p, size %ldk\n",
               xgi_video_info.mmio_base, xgi_video_info.mmio_vbase,
@@ -2119,9 +2210,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 
        xgi_video_info.mtrr = (unsigned int) 0;
 
-       if ((xgifb_mode_idx < 0) || ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
+       if ((xgifb_mode_idx < 0) ||
+           ((XGIbios_mode[xgifb_mode_idx].mode_no) != 0xFF)) {
                xgi_video_info.hasVB = HASVB_NONE;
-               if ((xgi_video_info.chip == XG20) || (xgi_video_info.chip == XG27)) {
+               if ((xgi_video_info.chip == XG20) ||
+                   (xgi_video_info.chip == XG27)) {
                        xgi_video_info.hasVB = HASVB_NONE;
                } else if (xgi_video_info.chip == XG21) {
                        CR38 = xgifb_reg_get(XGICR, 0x38);
@@ -2131,7 +2224,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                                        int m;
                                        for (m = 0; m < sizeof(XGI21_LCDCapList)/sizeof(struct XGI21_LVDSCapStruct); m++) {
                                                if ((XGI21_LCDCapList[m].LVDSHDE == XGIbios_mode[xgifb_mode_idx].xres) &&
-                                                               (XGI21_LCDCapList[m].LVDSVDE == XGIbios_mode[xgifb_mode_idx].yres)) {
+                                                   (XGI21_LCDCapList[m].LVDSVDE == XGIbios_mode[xgifb_mode_idx].yres)) {
                                                        xgifb_reg_set(XGI_Pr.P3d4, 0x36, m);
                                                }
                                        }
@@ -2215,9 +2308,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                        if (XGIfb_crt1off)
                                xgi_video_info.disp_state |= DISPMODE_SINGLE;
                        else
-                               xgi_video_info.disp_state |= (DISPMODE_MIRROR | DISPTYPE_CRT1);
+                               xgi_video_info.disp_state |= (DISPMODE_MIRROR |
+                                                             DISPTYPE_CRT1);
                } else {
-                       xgi_video_info.disp_state = DISPMODE_SINGLE | DISPTYPE_CRT1;
+                       xgi_video_info.disp_state = DISPMODE_SINGLE |
+                                                   DISPTYPE_CRT1;
                }
 
                if (xgi_video_info.disp_state & DISPTYPE_LCD) {
@@ -2244,19 +2339,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                        int tmp;
                        tmp = xgifb_reg_get(XGICR, 0x34);
                        if (tmp <= 0x13) {
-                               /* Currently on LCDA? (Some BIOSes leave CR38) */
+                               /* 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) */
+                                       /* 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);
+                                               tmp = xgifb_reg_get(XGICR,
+                                                                   0x30);
                                                if (tmp & 0x20) {
-                                                       tmp = xgifb_reg_get(XGIPART1, 0x13);
+                                                       tmp = xgifb_reg_get(
+                                                               XGIPART1, 0x13);
                                                        if (tmp & 0x04) {
                                                                /* XGI_Pr.XGI_UseLCDA = 1; */
                                                        }
@@ -2275,7 +2374,8 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                        case DISPTYPE_LCD:
                                xgifb_mode_idx = DEFAULT_LCDMODE;
                                if (xgi_video_info.chip == XG21)
-                                       xgifb_mode_idx = XGIfb_GetXG21DefaultLVDSModeIdx();
+                                       xgifb_mode_idx =
+                                           XGIfb_GetXG21DefaultLVDSModeIdx();
                                break;
                        case DISPTYPE_TV:
                                xgifb_mode_idx = DEFAULT_TVMODE;
@@ -2288,18 +2388,26 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 
                XGIfb_mode_no = XGIbios_mode[xgifb_mode_idx].mode_no;
 
+               /* yilin set default refresh rate */
                if (xgi_video_info.refresh_rate == 0)
-                       xgi_video_info.refresh_rate = 60; /* yilin set default refresh rate */
-               if (XGIfb_search_refresh_rate(xgi_video_info.refresh_rate) == 0) {
+                       xgi_video_info.refresh_rate = 60;
+               if (XGIfb_search_refresh_rate(
+                               xgi_video_info.refresh_rate) == 0) {
                        XGIfb_rate_idx = XGIbios_mode[xgifb_mode_idx].rate_idx;
                        xgi_video_info.refresh_rate = 60;
                }
 
                xgi_video_info.video_bpp = XGIbios_mode[xgifb_mode_idx].bpp;
-               xgi_video_info.video_vwidth = xgi_video_info.video_width = XGIbios_mode[xgifb_mode_idx].xres;
-               xgi_video_info.video_vheight = xgi_video_info.video_height = XGIbios_mode[xgifb_mode_idx].yres;
+               xgi_video_info.video_vwidth =
+                       xgi_video_info.video_width =
+                               XGIbios_mode[xgifb_mode_idx].xres;
+               xgi_video_info.video_vheight =
+                       xgi_video_info.video_height =
+                               XGIbios_mode[xgifb_mode_idx].yres;
                xgi_video_info.org_x = xgi_video_info.org_y = 0;
-               xgi_video_info.video_linelength = xgi_video_info.video_width * (xgi_video_info.video_bpp >> 3);
+               xgi_video_info.video_linelength =
+                       xgi_video_info.video_width *
+                       (xgi_video_info.video_bpp >> 3);
                switch (xgi_video_info.video_bpp) {
                case 8:
                        xgi_video_info.DstColor = 0x0000;
@@ -2318,16 +2426,23 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                        break;
                default:
                        xgi_video_info.video_cmap_len = 16;
-                       printk(KERN_INFO "XGIfb: Unsupported depth %d", xgi_video_info.video_bpp);
+                       printk(KERN_INFO "XGIfb: Unsupported depth %d",
+                              xgi_video_info.video_bpp);
                        break;
                }
 
                printk(KERN_INFO "XGIfb: Default mode is %dx%dx%d (%dHz)\n",
-                               xgi_video_info.video_width, xgi_video_info.video_height, xgi_video_info.video_bpp,
-                               xgi_video_info.refresh_rate);
-
-               default_var.xres = default_var.xres_virtual = xgi_video_info.video_width;
-               default_var.yres = default_var.yres_virtual = xgi_video_info.video_height;
+                      xgi_video_info.video_width,
+                      xgi_video_info.video_height,
+                      xgi_video_info.video_bpp,
+                      xgi_video_info.refresh_rate);
+
+               default_var.xres =
+                       default_var.xres_virtual =
+                               xgi_video_info.video_width;
+               default_var.yres =
+                       default_var.yres_virtual =
+                               xgi_video_info.video_height;
                default_var.bits_per_pixel = xgi_video_info.video_bpp;
 
                XGIfb_bpp_to_var(&default_var);
@@ -2343,10 +2458,12 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                        &default_var.hsync_len, &default_var.vsync_len,
                        &default_var.sync, &default_var.vmode)) {
 
-                       if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
+                       if ((default_var.vmode & FB_VMODE_MASK) ==
+                           FB_VMODE_INTERLACED) {
                                default_var.yres <<= 1;
                                default_var.yres_virtual <<= 1;
-                       } else if ((default_var.vmode & FB_VMODE_MASK) == FB_VMODE_DOUBLE) {
+                       } else if ((default_var.vmode & FB_VMODE_MASK) ==
+                                  FB_VMODE_DOUBLE) {
                                default_var.pixclock >>= 1;
                                default_var.yres >>= 1;
                                default_var.yres_virtual >>= 1;
@@ -2366,9 +2483,10 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                fb_alloc_cmap(&fb_info->cmap, 256 , 0);
 
 #ifdef CONFIG_MTRR
-               xgi_video_info.mtrr = mtrr_add((unsigned int) xgi_video_info.video_base,
-                               (unsigned int) xgi_video_info.video_size,
-                               MTRR_TYPE_WRCOMB, 1);
+               xgi_video_info.mtrr = mtrr_add(
+                       (unsigned int) xgi_video_info.video_base,
+                       (unsigned int) xgi_video_info.video_size,
+                       MTRR_TYPE_WRCOMB, 1);
                if (xgi_video_info.mtrr)
                        printk(KERN_INFO "XGIfb: Added MTRRs\n");
 #endif
@@ -2381,7 +2499,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                XGIfb_registered = 1;
 
                printk(KERN_INFO "fb%d: %s frame buffer device, Version %d.%d.%02d\n",
-                               fb_info->node, myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
+                      fb_info->node, myid, VER_MAJOR, VER_MINOR, VER_LEVEL);
 
        }