aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/pm2fb.c
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-10-16 04:28:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:15 -0400
commit3843faa2caa463ec3738cb30fb03dc5be8ef3250 (patch)
tree29cb40a35e74846a5dc03c19c2567338235305cf /drivers/video/pm2fb.c
parent0960bd3db199d73b07e4d266949dcdd6dda10d54 (diff)
pm2fb: checkpatch fixes
This patch fixes all errors detected by checkpatch.pl script in the pm2fb.c file. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Antonino Daplas <adaplas@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/video/pm2fb.c')
-rw-r--r--drivers/video/pm2fb.c162
1 files changed, 88 insertions, 74 deletions
diff --git a/drivers/video/pm2fb.c b/drivers/video/pm2fb.c
index 4b54e2776ca1..19cbde192956 100644
--- a/drivers/video/pm2fb.c
+++ b/drivers/video/pm2fb.c
@@ -55,9 +55,10 @@
55 55
56#undef PM2FB_MASTER_DEBUG 56#undef PM2FB_MASTER_DEBUG
57#ifdef PM2FB_MASTER_DEBUG 57#ifdef PM2FB_MASTER_DEBUG
58#define DPRINTK(a,b...) printk(KERN_DEBUG "pm2fb: %s: " a, __FUNCTION__ , ## b) 58#define DPRINTK(a, b...) \
59 printk(KERN_DEBUG "pm2fb: %s: " a, __FUNCTION__ , ## b)
59#else 60#else
60#define DPRINTK(a,b...) 61#define DPRINTK(a, b...)
61#endif 62#endif
62 63
63#define PM2_PIXMAP_SIZE (1600 * 4) 64#define PM2_PIXMAP_SIZE (1600 * 4)
@@ -65,7 +66,7 @@
65/* 66/*
66 * Driver data 67 * Driver data
67 */ 68 */
68static char *mode __devinitdata = NULL; 69static char *mode __devinitdata;
69 70
70/* 71/*
71 * The XFree GLINT driver will (I think to implement hardware cursor 72 * The XFree GLINT driver will (I think to implement hardware cursor
@@ -146,31 +147,31 @@ static struct fb_var_screeninfo pm2fb_var __devinitdata = {
146 * Utility functions 147 * Utility functions
147 */ 148 */
148 149
149static inline u32 pm2_RD(struct pm2fb_par* p, s32 off) 150static inline u32 pm2_RD(struct pm2fb_par *p, s32 off)
150{ 151{
151 return fb_readl(p->v_regs + off); 152 return fb_readl(p->v_regs + off);
152} 153}
153 154
154static inline void pm2_WR(struct pm2fb_par* p, s32 off, u32 v) 155static inline void pm2_WR(struct pm2fb_par *p, s32 off, u32 v)
155{ 156{
156 fb_writel(v, p->v_regs + off); 157 fb_writel(v, p->v_regs + off);
157} 158}
158 159
159static inline u32 pm2_RDAC_RD(struct pm2fb_par* p, s32 idx) 160static inline u32 pm2_RDAC_RD(struct pm2fb_par *p, s32 idx)
160{ 161{
161 pm2_WR(p, PM2R_RD_PALETTE_WRITE_ADDRESS, idx); 162 pm2_WR(p, PM2R_RD_PALETTE_WRITE_ADDRESS, idx);
162 mb(); 163 mb();
163 return pm2_RD(p, PM2R_RD_INDEXED_DATA); 164 return pm2_RD(p, PM2R_RD_INDEXED_DATA);
164} 165}
165 166
166static inline u32 pm2v_RDAC_RD(struct pm2fb_par* p, s32 idx) 167static inline u32 pm2v_RDAC_RD(struct pm2fb_par *p, s32 idx)
167{ 168{
168 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 169 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
169 mb(); 170 mb();
170 return pm2_RD(p, PM2VR_RD_INDEXED_DATA); 171 return pm2_RD(p, PM2VR_RD_INDEXED_DATA);
171} 172}
172 173
173static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 174static inline void pm2_RDAC_WR(struct pm2fb_par *p, s32 idx, u32 v)
174{ 175{
175 pm2_WR(p, PM2R_RD_PALETTE_WRITE_ADDRESS, idx); 176 pm2_WR(p, PM2R_RD_PALETTE_WRITE_ADDRESS, idx);
176 wmb(); 177 wmb();
@@ -178,7 +179,7 @@ static inline void pm2_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
178 wmb(); 179 wmb();
179} 180}
180 181
181static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v) 182static inline void pm2v_RDAC_WR(struct pm2fb_par *p, s32 idx, u32 v)
182{ 183{
183 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff); 184 pm2_WR(p, PM2VR_RD_INDEX_LOW, idx & 0xff);
184 wmb(); 185 wmb();
@@ -189,9 +190,9 @@ static inline void pm2v_RDAC_WR(struct pm2fb_par* p, s32 idx, u32 v)
189#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT 190#ifdef CONFIG_FB_PM2_FIFO_DISCONNECT
190#define WAIT_FIFO(p, a) 191#define WAIT_FIFO(p, a)
191#else 192#else
192static inline void WAIT_FIFO(struct pm2fb_par* p, u32 a) 193static inline void WAIT_FIFO(struct pm2fb_par *p, u32 a)
193{ 194{
194 while(pm2_RD(p, PM2R_IN_FIFO_SPACE) < a); 195 while (pm2_RD(p, PM2R_IN_FIFO_SPACE) < a);
195 mb(); 196 mb();
196} 197}
197#endif 198#endif
@@ -250,8 +251,8 @@ static u32 to3264(u32 timing, int bpp, int is64)
250 return timing; 251 return timing;
251} 252}
252 253
253static void pm2_mnp(u32 clk, unsigned char* mm, unsigned char* nn, 254static void pm2_mnp(u32 clk, unsigned char *mm, unsigned char *nn,
254 unsigned char* pp) 255 unsigned char *pp)
255{ 256{
256 unsigned char m; 257 unsigned char m;
257 unsigned char n; 258 unsigned char n;
@@ -279,8 +280,8 @@ static void pm2_mnp(u32 clk, unsigned char* mm, unsigned char* nn,
279 } 280 }
280} 281}
281 282
282static void pm2v_mnp(u32 clk, unsigned char* mm, unsigned char* nn, 283static void pm2v_mnp(u32 clk, unsigned char *mm, unsigned char *nn,
283 unsigned char* pp) 284 unsigned char *pp)
284{ 285{
285 unsigned char m; 286 unsigned char m;
286 unsigned char n; 287 unsigned char n;
@@ -304,7 +305,8 @@ static void pm2v_mnp(u32 clk, unsigned char* mm, unsigned char* nn,
304 } 305 }
305} 306}
306 307
307static void clear_palette(struct pm2fb_par* p) { 308static void clear_palette(struct pm2fb_par *p)
309{
308 int i = 256; 310 int i = 256;
309 311
310 WAIT_FIFO(p, 1); 312 WAIT_FIFO(p, 1);
@@ -318,7 +320,7 @@ static void clear_palette(struct pm2fb_par* p) {
318 } 320 }
319} 321}
320 322
321static void reset_card(struct pm2fb_par* p) 323static void reset_card(struct pm2fb_par *p)
322{ 324{
323 if (p->type == PM2_TYPE_PERMEDIA2V) 325 if (p->type == PM2_TYPE_PERMEDIA2V)
324 pm2_WR(p, PM2VR_RD_INDEX_HIGH, 0); 326 pm2_WR(p, PM2VR_RD_INDEX_HIGH, 0);
@@ -341,7 +343,7 @@ static void reset_card(struct pm2fb_par* p)
341 pm2_WR(p, PM2R_MEM_CONFIG, p->mem_config); 343 pm2_WR(p, PM2R_MEM_CONFIG, p->mem_config);
342} 344}
343 345
344static void reset_config(struct pm2fb_par* p) 346static void reset_config(struct pm2fb_par *p)
345{ 347{
346 WAIT_FIFO(p, 53); 348 WAIT_FIFO(p, 53);
347 pm2_WR(p, PM2R_CHIP_CONFIG, pm2_RD(p, PM2R_CHIP_CONFIG) & 349 pm2_WR(p, PM2R_CHIP_CONFIG, pm2_RD(p, PM2R_CHIP_CONFIG) &
@@ -398,7 +400,7 @@ static void reset_config(struct pm2fb_par* p)
398 } 400 }
399} 401}
400 402
401static void set_aperture(struct pm2fb_par* p, u32 depth) 403static void set_aperture(struct pm2fb_par *p, u32 depth)
402{ 404{
403 /* 405 /*
404 * The hardware is little-endian. When used in big-endian 406 * The hardware is little-endian. When used in big-endian
@@ -428,11 +430,11 @@ static void set_aperture(struct pm2fb_par* p, u32 depth)
428 } 430 }
429#endif 431#endif
430 432
431 // We don't use aperture two, so this may be superflous 433 /* We don't use aperture two, so this may be superflous */
432 pm2_WR(p, PM2R_APERTURE_TWO, PM2F_APERTURE_STANDARD); 434 pm2_WR(p, PM2R_APERTURE_TWO, PM2F_APERTURE_STANDARD);
433} 435}
434 436
435static void set_color(struct pm2fb_par* p, unsigned char regno, 437static void set_color(struct pm2fb_par *p, unsigned char regno,
436 unsigned char r, unsigned char g, unsigned char b) 438 unsigned char r, unsigned char g, unsigned char b)
437{ 439{
438 WAIT_FIFO(p, 4); 440 WAIT_FIFO(p, 4);
@@ -445,7 +447,7 @@ static void set_color(struct pm2fb_par* p, unsigned char regno,
445 pm2_WR(p, PM2R_RD_PALETTE_DATA, b); 447 pm2_WR(p, PM2R_RD_PALETTE_DATA, b);
446} 448}
447 449
448static void set_memclock(struct pm2fb_par* par, u32 clk) 450static void set_memclock(struct pm2fb_par *par, u32 clk)
449{ 451{
450 int i; 452 int i;
451 unsigned char m, n, p; 453 unsigned char m, n, p;
@@ -482,7 +484,7 @@ static void set_memclock(struct pm2fb_par* par, u32 clk)
482 } 484 }
483} 485}
484 486
485static void set_pixclock(struct pm2fb_par* par, u32 clk) 487static void set_pixclock(struct pm2fb_par *par, u32 clk)
486{ 488{
487 int i; 489 int i;
488 unsigned char m, n, p; 490 unsigned char m, n, p;
@@ -513,7 +515,8 @@ static void set_pixclock(struct pm2fb_par* par, u32 clk)
513 } 515 }
514} 516}
515 517
516static void set_video(struct pm2fb_par* p, u32 video) { 518static void set_video(struct pm2fb_par *p, u32 video)
519{
517 u32 tmp; 520 u32 tmp;
518 u32 vsync = video; 521 u32 vsync = video;
519 522
@@ -572,12 +575,14 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
572 } 575 }
573 576
574 if (var->xres != var->xres_virtual) { 577 if (var->xres != var->xres_virtual) {
575 DPRINTK("virtual x resolution != physical x resolution not supported\n"); 578 DPRINTK("virtual x resolution != "
579 "physical x resolution not supported\n");
576 return -EINVAL; 580 return -EINVAL;
577 } 581 }
578 582
579 if (var->yres > var->yres_virtual) { 583 if (var->yres > var->yres_virtual) {
580 DPRINTK("virtual y resolution < physical y resolution not possible\n"); 584 DPRINTK("virtual y resolution < "
585 "physical y resolution not possible\n");
581 return -EINVAL; 586 return -EINVAL;
582 } 587 }
583 588
@@ -611,15 +616,18 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
611 } 616 }
612 617
613 if (PICOS2KHZ(var->pixclock) > PM2_MAX_PIXCLOCK) { 618 if (PICOS2KHZ(var->pixclock) > PM2_MAX_PIXCLOCK) {
614 DPRINTK("pixclock too high (%ldKHz)\n", PICOS2KHZ(var->pixclock)); 619 DPRINTK("pixclock too high (%ldKHz)\n",
620 PICOS2KHZ(var->pixclock));
615 return -EINVAL; 621 return -EINVAL;
616 } 622 }
617 623
618 var->transp.offset = 0; 624 var->transp.offset = 0;
619 var->transp.length = 0; 625 var->transp.length = 0;
620 switch(var->bits_per_pixel) { 626 switch (var->bits_per_pixel) {
621 case 8: 627 case 8:
622 var->red.length = var->green.length = var->blue.length = 8; 628 var->red.length = 8;
629 var->green.length = 8;
630 var->blue.length = 8;
623 break; 631 break;
624 case 16: 632 case 16:
625 var->red.offset = 11; 633 var->red.offset = 11;
@@ -635,7 +643,9 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
635 var->red.offset = 16; 643 var->red.offset = 16;
636 var->green.offset = 8; 644 var->green.offset = 8;
637 var->blue.offset = 0; 645 var->blue.offset = 0;
638 var->red.length = var->green.length = var->blue.length = 8; 646 var->red.length = 8;
647 var->green.length = 8;
648 var->blue.length = 8;
639 break; 649 break;
640 case 24: 650 case 24:
641#ifdef __BIG_ENDIAN 651#ifdef __BIG_ENDIAN
@@ -646,10 +656,13 @@ static int pm2fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
646 var->blue.offset = 0; 656 var->blue.offset = 0;
647#endif 657#endif
648 var->green.offset = 8; 658 var->green.offset = 8;
649 var->red.length = var->green.length = var->blue.length = 8; 659 var->red.length = 8;
660 var->green.length = 8;
661 var->blue.length = 8;
650 break; 662 break;
651 } 663 }
652 var->height = var->width = -1; 664 var->height = -1;
665 var->width = -1;
653 666
654 var->accel_flags = 0; /* Can't mmap if this is on */ 667 var->accel_flags = 0; /* Can't mmap if this is on */
655 668
@@ -708,7 +721,8 @@ static int pm2fb_set_par(struct fb_info *info)
708 ? info->var.lower_margin - 1 721 ? info->var.lower_margin - 1
709 : 0; /* FIXME! */ 722 : 0; /* FIXME! */
710 vsend = info->var.lower_margin + info->var.vsync_len - 1; 723 vsend = info->var.lower_margin + info->var.vsync_len - 1;
711 vbend = info->var.lower_margin + info->var.vsync_len + info->var.upper_margin; 724 vbend = info->var.lower_margin + info->var.vsync_len +
725 info->var.upper_margin;
712 vtotal = info->var.yres + vbend - 1; 726 vtotal = info->var.yres + vbend - 1;
713 stride = to3264(width, depth, 1); 727 stride = to3264(width, depth, 1);
714 base = to3264(info->var.yoffset * xres + info->var.xoffset, depth, 1); 728 base = to3264(info->var.yoffset * xres + info->var.xoffset, depth, 1);
@@ -721,18 +735,18 @@ static int pm2fb_set_par(struct fb_info *info)
721 video |= PM2F_HSYNC_ACT_LOW; 735 video |= PM2F_HSYNC_ACT_LOW;
722 } else 736 } else
723 video |= PM2F_HSYNC_ACT_HIGH; 737 video |= PM2F_HSYNC_ACT_HIGH;
724 } 738 } else
725 else
726 video |= PM2F_HSYNC_ACT_LOW; 739 video |= PM2F_HSYNC_ACT_LOW;
740
727 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) { 741 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) {
728 if (lowvsync) { 742 if (lowvsync) {
729 DPRINTK("ignoring +vsync, using -vsync.\n"); 743 DPRINTK("ignoring +vsync, using -vsync.\n");
730 video |= PM2F_VSYNC_ACT_LOW; 744 video |= PM2F_VSYNC_ACT_LOW;
731 } else 745 } else
732 video |= PM2F_VSYNC_ACT_HIGH; 746 video |= PM2F_VSYNC_ACT_HIGH;
733 } 747 } else
734 else
735 video |= PM2F_VSYNC_ACT_LOW; 748 video |= PM2F_VSYNC_ACT_LOW;
749
736 if ((info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) { 750 if ((info->var.vmode & FB_VMODE_MASK) == FB_VMODE_INTERLACED) {
737 DPRINTK("interlaced not supported\n"); 751 DPRINTK("interlaced not supported\n");
738 return -EINVAL; 752 return -EINVAL;
@@ -817,7 +831,7 @@ static int pm2fb_set_par(struct fb_info *info)
817 case PM2_TYPE_PERMEDIA2: 831 case PM2_TYPE_PERMEDIA2:
818 pm2_RDAC_WR(par, PM2I_RD_COLOR_MODE, clrmode); 832 pm2_RDAC_WR(par, PM2I_RD_COLOR_MODE, clrmode);
819 pm2_RDAC_WR(par, PM2I_RD_COLOR_KEY_CONTROL, 833 pm2_RDAC_WR(par, PM2I_RD_COLOR_KEY_CONTROL,
820 (depth == 8) ? 0 : PM2F_COLOR_KEY_TEST_OFF); 834 (depth == 8) ? 0 : PM2F_COLOR_KEY_TEST_OFF);
821 break; 835 break;
822 case PM2_TYPE_PERMEDIA2V: 836 case PM2_TYPE_PERMEDIA2V:
823 pm2v_RDAC_WR(par, PM2VI_RD_DAC_CONTROL, 0); 837 pm2v_RDAC_WR(par, PM2VI_RD_DAC_CONTROL, 0);
@@ -861,10 +875,9 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green,
861 */ 875 */
862 876
863 /* grayscale works only partially under directcolor */ 877 /* grayscale works only partially under directcolor */
864 if (info->var.grayscale) { 878 /* grayscale = 0.30*R + 0.59*G + 0.11*B */
865 /* grayscale = 0.30*R + 0.59*G + 0.11*B */ 879 if (info->var.grayscale)
866 red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8; 880 red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
867 }
868 881
869 /* Directcolor: 882 /* Directcolor:
870 * var->{color}.offset contains start of bitfield 883 * var->{color}.offset contains start of bitfield
@@ -931,8 +944,7 @@ static int pm2fb_setcolreg(unsigned regno, unsigned red, unsigned green,
931 break; 944 break;
932 } 945 }
933 return 0; 946 return 0;
934 } 947 } else if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
935 else if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR)
936 set_color(par, regno, red, green, blue); 948 set_color(par, regno, red, green, blue);
937 949
938 return 0; 950 return 0;
@@ -1007,7 +1019,7 @@ static int pm2fb_blank(int blank_mode, struct fb_info *info)
1007 break; 1019 break;
1008 case FB_BLANK_POWERDOWN: 1020 case FB_BLANK_POWERDOWN:
1009 /* HSync: Off, VSync: Off */ 1021 /* HSync: Off, VSync: Off */
1010 video &= ~(PM2F_VSYNC_MASK | PM2F_HSYNC_MASK| PM2F_BLANK_LOW); 1022 video &= ~(PM2F_VSYNC_MASK | PM2F_HSYNC_MASK | PM2F_BLANK_LOW);
1011 break; 1023 break;
1012 } 1024 }
1013 set_video(par, video); 1025 set_video(par, video);
@@ -1030,14 +1042,14 @@ static int pm2fb_sync(struct fb_info *info)
1030 return 0; 1042 return 0;
1031} 1043}
1032 1044
1033static void pm2fb_fillrect (struct fb_info *info, 1045static void pm2fb_fillrect(struct fb_info *info,
1034 const struct fb_fillrect *region) 1046 const struct fb_fillrect *region)
1035{ 1047{
1036 struct pm2fb_par *par = info->par; 1048 struct pm2fb_par *par = info->par;
1037 struct fb_fillrect modded; 1049 struct fb_fillrect modded;
1038 int vxres, vyres; 1050 int vxres, vyres;
1039 u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ? 1051 u32 color = (info->fix.visual == FB_VISUAL_TRUECOLOR) ?
1040 ((u32*)info->pseudo_palette)[region->color] : region->color; 1052 ((u32 *)info->pseudo_palette)[region->color] : region->color;
1041 1053
1042 if (info->state != FBINFO_STATE_RUNNING) 1054 if (info->state != FBINFO_STATE_RUNNING)
1043 return; 1055 return;
@@ -1082,7 +1094,8 @@ static void pm2fb_fillrect (struct fb_info *info,
1082 pm2_WR(par, PM2R_CONSTANT_COLOR, color); 1094 pm2_WR(par, PM2R_CONSTANT_COLOR, color);
1083 wmb(); 1095 wmb();
1084 pm2_WR(par, PM2R_RENDER, 1096 pm2_WR(par, PM2R_RENDER,
1085 PM2F_RENDER_RECTANGLE | PM2F_INCREASE_X | PM2F_INCREASE_Y ); 1097 PM2F_RENDER_RECTANGLE |
1098 PM2F_INCREASE_X | PM2F_INCREASE_Y );
1086 pm2_WR(par, PM2R_COLOR_DDA_MODE, 0); 1099 pm2_WR(par, PM2R_COLOR_DDA_MODE, 0);
1087 } 1100 }
1088} 1101}
@@ -1124,14 +1137,14 @@ static void pm2fb_copyarea(struct fb_info *info,
1124 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE | 1137 pm2_WR(par, PM2R_CONFIG, PM2F_CONFIG_FB_WRITE_ENABLE |
1125 PM2F_CONFIG_FB_READ_SOURCE_ENABLE); 1138 PM2F_CONFIG_FB_READ_SOURCE_ENABLE);
1126 pm2_WR(par, PM2R_FB_SOURCE_DELTA, 1139 pm2_WR(par, PM2R_FB_SOURCE_DELTA,
1127 ((modded.sy-modded.dy) & 0xfff) << 16 | 1140 ((modded.sy - modded.dy) & 0xfff) << 16 |
1128 ((modded.sx-modded.dx) & 0xfff)); 1141 ((modded.sx - modded.dx) & 0xfff));
1129 pm2_WR(par, PM2R_RECTANGLE_ORIGIN, (modded.dy << 16) | modded.dx); 1142 pm2_WR(par, PM2R_RECTANGLE_ORIGIN, (modded.dy << 16) | modded.dx);
1130 pm2_WR(par, PM2R_RECTANGLE_SIZE, (modded.height << 16) | modded.width); 1143 pm2_WR(par, PM2R_RECTANGLE_SIZE, (modded.height << 16) | modded.width);
1131 wmb(); 1144 wmb();
1132 pm2_WR(par, PM2R_RENDER, PM2F_RENDER_RECTANGLE | 1145 pm2_WR(par, PM2R_RENDER, PM2F_RENDER_RECTANGLE |
1133 (modded.dx<modded.sx ? PM2F_INCREASE_X : 0) | 1146 (modded.dx < modded.sx ? PM2F_INCREASE_X : 0) |
1134 (modded.dy<modded.sy ? PM2F_INCREASE_Y : 0)); 1147 (modded.dy < modded.sy ? PM2F_INCREASE_Y : 0));
1135} 1148}
1136 1149
1137static void pm2fb_imageblit(struct fb_info *info, const struct fb_image *image) 1150static void pm2fb_imageblit(struct fb_info *info, const struct fb_image *image)
@@ -1139,7 +1152,7 @@ static void pm2fb_imageblit(struct fb_info *info, const struct fb_image *image)
1139 struct pm2fb_par *par = info->par; 1152 struct pm2fb_par *par = info->par;
1140 u32 height = image->height; 1153 u32 height = image->height;
1141 u32 fgx, bgx; 1154 u32 fgx, bgx;
1142 const u32 *src = (const u32*)image->data; 1155 const u32 *src = (const u32 *)image->data;
1143 u32 xres = (info->var.xres + 31) & ~31; 1156 u32 xres = (info->var.xres + 31) & ~31;
1144 1157
1145 if (info->state != FBINFO_STATE_RUNNING) 1158 if (info->state != FBINFO_STATE_RUNNING)
@@ -1269,7 +1282,8 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1269{ 1282{
1270 struct pm2fb_par *default_par; 1283 struct pm2fb_par *default_par;
1271 struct fb_info *info; 1284 struct fb_info *info;
1272 int err, err_retval = -ENXIO; 1285 int err;
1286 int retval = -ENXIO;
1273 1287
1274 err = pci_enable_device(pdev); 1288 err = pci_enable_device(pdev);
1275 if (err) { 1289 if (err) {
@@ -1342,26 +1356,28 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1342 default_par->mem_config = 0xe6002021; 1356 default_par->mem_config = 0xe6002021;
1343 if (pdev->subsystem_vendor == 0x1048 && 1357 if (pdev->subsystem_vendor == 0x1048 &&
1344 pdev->subsystem_device == 0x0a31) { 1358 pdev->subsystem_device == 0x0a31) {
1345 DPRINTK("subsystem_vendor: %04x, subsystem_device: %04x\n", 1359 DPRINTK("subsystem_vendor: %04x, "
1360 "subsystem_device: %04x\n",
1346 pdev->subsystem_vendor, pdev->subsystem_device); 1361 pdev->subsystem_vendor, pdev->subsystem_device);
1347 DPRINTK("We have not been initialized by VGA BIOS " 1362 DPRINTK("We have not been initialized by VGA BIOS and "
1348 "and are running on an Elsa Winner 2000 Office\n"); 1363 "are running on an Elsa Winner 2000 Office\n");
1349 DPRINTK("Initializing card timings manually...\n"); 1364 DPRINTK("Initializing card timings manually...\n");
1350 default_par->memclock = 100000; 1365 default_par->memclock = 100000;
1351 } 1366 }
1352 if (pdev->subsystem_vendor == 0x3d3d && 1367 if (pdev->subsystem_vendor == 0x3d3d &&
1353 pdev->subsystem_device == 0x0100) { 1368 pdev->subsystem_device == 0x0100) {
1354 DPRINTK("subsystem_vendor: %04x, subsystem_device: %04x\n", 1369 DPRINTK("subsystem_vendor: %04x, "
1370 "subsystem_device: %04x\n",
1355 pdev->subsystem_vendor, pdev->subsystem_device); 1371 pdev->subsystem_vendor, pdev->subsystem_device);
1356 DPRINTK("We have not been initialized by VGA BIOS " 1372 DPRINTK("We have not been initialized by VGA BIOS and "
1357 "and are running on an 3dlabs reference board\n"); 1373 "are running on an 3dlabs reference board\n");
1358 DPRINTK("Initializing card timings manually...\n"); 1374 DPRINTK("Initializing card timings manually...\n");
1359 default_par->memclock = 74894; 1375 default_par->memclock = 74894;
1360 } 1376 }
1361 } 1377 }
1362 1378
1363 /* Now work out how big lfb is going to be. */ 1379 /* Now work out how big lfb is going to be. */
1364 switch(default_par->mem_config & PM2F_MEM_CONFIG_RAM_MASK) { 1380 switch (default_par->mem_config & PM2F_MEM_CONFIG_RAM_MASK) {
1365 case PM2F_MEM_BANKS_1: 1381 case PM2F_MEM_BANKS_1:
1366 pm2fb_fix.smem_len = 0x200000; 1382 pm2fb_fix.smem_len = 0x200000;
1367 break; 1383 break;
@@ -1411,7 +1427,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1411 1427
1412 info->pixmap.addr = kmalloc(PM2_PIXMAP_SIZE, GFP_KERNEL); 1428 info->pixmap.addr = kmalloc(PM2_PIXMAP_SIZE, GFP_KERNEL);
1413 if (!info->pixmap.addr) { 1429 if (!info->pixmap.addr) {
1414 err_retval = -ENOMEM; 1430 retval = -ENOMEM;
1415 goto err_exit_pixmap; 1431 goto err_exit_pixmap;
1416 } 1432 }
1417 info->pixmap.size = PM2_PIXMAP_SIZE; 1433 info->pixmap.size = PM2_PIXMAP_SIZE;
@@ -1461,7 +1477,7 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1461 release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); 1477 release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len);
1462 err_exit_neither: 1478 err_exit_neither:
1463 framebuffer_release(info); 1479 framebuffer_release(info);
1464 return err_retval; 1480 return retval;
1465} 1481}
1466 1482
1467/** 1483/**
@@ -1473,8 +1489,8 @@ static int __devinit pm2fb_probe(struct pci_dev *pdev,
1473 */ 1489 */
1474static void __devexit pm2fb_remove(struct pci_dev *pdev) 1490static void __devexit pm2fb_remove(struct pci_dev *pdev)
1475{ 1491{
1476 struct fb_info* info = pci_get_drvdata(pdev); 1492 struct fb_info *info = pci_get_drvdata(pdev);
1477 struct fb_fix_screeninfo* fix = &info->fix; 1493 struct fb_fix_screeninfo *fix = &info->fix;
1478 struct pm2fb_par *par = info->par; 1494 struct pm2fb_par *par = info->par;
1479 1495
1480 unregister_framebuffer(info); 1496 unregister_framebuffer(info);
@@ -1490,8 +1506,7 @@ static void __devexit pm2fb_remove(struct pci_dev *pdev)
1490 release_mem_region(fix->mmio_start, fix->mmio_len); 1506 release_mem_region(fix->mmio_start, fix->mmio_len);
1491 1507
1492 pci_set_drvdata(pdev, NULL); 1508 pci_set_drvdata(pdev, NULL);
1493 if (info->pixmap.addr) 1509 kfree(info->pixmap.addr);
1494 kfree(info->pixmap.addr);
1495 kfree(info); 1510 kfree(info);
1496} 1511}
1497 1512
@@ -1523,7 +1538,7 @@ MODULE_DEVICE_TABLE(pci, pm2fb_id_table);
1523 */ 1538 */
1524static int __init pm2fb_setup(char *options) 1539static int __init pm2fb_setup(char *options)
1525{ 1540{
1526 char* this_opt; 1541 char *this_opt;
1527 1542
1528 if (!options || !*options) 1543 if (!options || !*options)
1529 return 0; 1544 return 0;
@@ -1531,19 +1546,18 @@ static int __init pm2fb_setup(char *options)
1531 while ((this_opt = strsep(&options, ",")) != NULL) { 1546 while ((this_opt = strsep(&options, ",")) != NULL) {
1532 if (!*this_opt) 1547 if (!*this_opt)
1533 continue; 1548 continue;
1534 if (!strcmp(this_opt, "lowhsync")) { 1549 if (!strcmp(this_opt, "lowhsync"))
1535 lowhsync = 1; 1550 lowhsync = 1;
1536 } else if (!strcmp(this_opt, "lowvsync")) { 1551 else if (!strcmp(this_opt, "lowvsync"))
1537 lowvsync = 1; 1552 lowvsync = 1;
1538#ifdef CONFIG_MTRR 1553#ifdef CONFIG_MTRR
1539 } else if (!strncmp(this_opt, "nomtrr", 6)) { 1554 else if (!strncmp(this_opt, "nomtrr", 6))
1540 nomtrr = 1; 1555 nomtrr = 1;
1541#endif 1556#endif
1542 } else if (!strncmp(this_opt, "noaccel", 7)) { 1557 else if (!strncmp(this_opt, "noaccel", 7))
1543 noaccel = 1; 1558 noaccel = 1;
1544 } else { 1559 else
1545 mode = this_opt; 1560 mode = this_opt;
1546 }
1547 } 1561 }
1548 return 0; 1562 return 0;
1549} 1563}