Commit 8af1d50f authored by Krzysztof Helt's avatar Krzysztof Helt Committed by Linus Torvalds

tdfxfb: coding style improvement

This patch contains coding style improvements to the tdfxfb driver (white
spaces, indentations, long lines).

It also moves fb_ops structure to the end of file, so forward declarations of
ops functions are redundant.
Signed-off-by: default avatarKrzysztof Helt <krzysztof.h1@wp.pl>
Signed-off-by: default avatarAntonino Daplas <adaplas@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 245a2c2c
......@@ -102,7 +102,7 @@ static struct fb_var_screeninfo tdfx_var __devinitdata = {
.yres = 480,
.xres_virtual = 640,
.yres_virtual = 1024,
.bits_per_pixel =8,
.bits_per_pixel = 8,
.red = {0, 8, 0},
.blue = {0, 8, 0},
.green = {0, 8, 0},
......@@ -149,48 +149,6 @@ static struct pci_driver tdfxfb_driver = {
MODULE_DEVICE_TABLE(pci, tdfxfb_id_table);
/*
* Frame buffer device API
*/
static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *fb);
static int tdfxfb_set_par(struct fb_info *info);
static int tdfxfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
u_int transp, struct fb_info *info);
static int tdfxfb_blank(int blank, struct fb_info *info);
static int tdfxfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info);
static int banshee_wait_idle(struct fb_info *info);
#ifdef CONFIG_FB_3DFX_ACCEL
static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect);
static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area);
static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image);
#endif /* CONFIG_FB_3DFX_ACCEL */
static struct fb_ops tdfxfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = tdfxfb_check_var,
.fb_set_par = tdfxfb_set_par,
.fb_setcolreg = tdfxfb_setcolreg,
.fb_blank = tdfxfb_blank,
.fb_pan_display = tdfxfb_pan_display,
.fb_sync = banshee_wait_idle,
#ifdef CONFIG_FB_3DFX_ACCEL
.fb_fillrect = tdfxfb_fillrect,
.fb_copyarea = tdfxfb_copyarea,
.fb_imageblit = tdfxfb_imageblit,
#else
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
#endif
};
/*
* do_xxx: Hardware-specific functions
*/
static u32 do_calc_pll(int freq, int *freq_out);
static void do_write_regs(struct fb_info *info, struct banshee_reg *reg);
static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short);
/*
* Driver data
*/
......@@ -203,36 +161,54 @@ static char *mode_option __devinitdata = NULL;
* ------------------------------------------------------------------------- */
#ifdef VGA_REG_IO
static inline u8 vga_inb(struct tdfx_par *par, u32 reg) { return inb(reg); }
static inline u8 vga_inb(struct tdfx_par *par, u32 reg)
{
return inb(reg);
}
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) { outb(val, reg); }
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val)
{
outb(val, reg);
}
#else
static inline u8 vga_inb(struct tdfx_par *par, u32 reg) {
static inline u8 vga_inb(struct tdfx_par *par, u32 reg)
{
return inb(par->iobase + reg - 0x300);
}
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val) {
static inline void vga_outb(struct tdfx_par *par, u32 reg, u8 val)
{
outb(val, par->iobase + reg - 0x300);
}
#endif
static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(par, GRA_I, idx); vga_outb(par, GRA_D, val);
static inline void gra_outb(struct tdfx_par *par, u32 idx, u8 val)
{
vga_outb(par, GRA_I, idx);
vga_outb(par, GRA_D, val);
}
static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(par, SEQ_I, idx); vga_outb(par, SEQ_D, val);
static inline void seq_outb(struct tdfx_par *par, u32 idx, u8 val)
{
vga_outb(par, SEQ_I, idx);
vga_outb(par, SEQ_D, val);
}
static inline u8 seq_inb(struct tdfx_par *par, u32 idx) {
vga_outb(par, SEQ_I, idx); return vga_inb(par, SEQ_D);
static inline u8 seq_inb(struct tdfx_par *par, u32 idx)
{
vga_outb(par, SEQ_I, idx);
return vga_inb(par, SEQ_D);
}
static inline void crt_outb(struct tdfx_par *par, u32 idx, u8 val) {
vga_outb(par, CRT_I, idx); vga_outb(par, CRT_D, val);
static inline void crt_outb(struct tdfx_par *par, u32 idx, u8 val)
{
vga_outb(par, CRT_I, idx);
vga_outb(par, CRT_D, val);
}
static inline u8 crt_inb(struct tdfx_par *par, u32 idx) {
vga_outb(par, CRT_I, idx); return vga_inb(par, CRT_D);
static inline u8 crt_inb(struct tdfx_par *par, u32 idx)
{
vga_outb(par, CRT_I, idx);
return vga_inb(par, CRT_D);
}
static inline void att_outb(struct tdfx_par *par, u32 idx, u8 val)
......@@ -284,7 +260,7 @@ static inline void banshee_make_room(struct tdfx_par *par, int size)
{
/* Note: The Voodoo3's onboard FIFO has 32 slots. This loop
* won't quit if you ask for more. */
while((tdfx_inl(par, STATUS) & 0x1f) < size-1);
while ((tdfx_inl(par, STATUS) & 0x1f) < size - 1) ;
}
static int banshee_wait_idle(struct fb_info *info)
......@@ -295,9 +271,10 @@ static int banshee_wait_idle(struct fb_info *info)
banshee_make_room(par, 1);
tdfx_outl(par, COMMAND_3D, COMMAND_3D_NOP);
while(1) {
while (1) {
i = (tdfx_inl(par, STATUS) & STATUS_BUSY) ? 0 : i + 1;
if(i == 3) break;
if (i == 3)
break;
}
return 0;
}
......@@ -312,7 +289,7 @@ static inline void do_setpalentry(struct tdfx_par *par, unsigned regno, u32 c)
tdfx_outl(par, DACDATA, c);
}
static u32 do_calc_pll(int freq, int* freq_out)
static u32 do_calc_pll(int freq, int *freq_out)
{
int m, n, k, best_m, best_n, best_k, best_error;
int fref = 14318;
......@@ -336,7 +313,7 @@ static u32 do_calc_pll(int freq, int* freq_out)
* estimated n
*/
int f = fref * (n + 2) / (m + 2) / (1 << k);
int error = abs (f - freq);
int error = abs(f - freq);
/*
* If this is the closest we've come to the
......@@ -355,12 +332,12 @@ static u32 do_calc_pll(int freq, int* freq_out)
n = best_n;
m = best_m;
k = best_k;
*freq_out = fref*(n + 2)/(m + 2)/(1 << k);
*freq_out = fref * (n + 2) / (m + 2) / (1 << k);
return (n << 8) | (m << 2) | k;
}
static void do_write_regs(struct fb_info *info, struct banshee_reg* reg)
static void do_write_regs(struct fb_info *info, struct banshee_reg *reg)
{
struct tdfx_par *par = info->par;
int i;
......@@ -406,7 +383,7 @@ static void do_write_regs(struct fb_info *info, struct banshee_reg* reg)
tdfx_outl(par, VIDDESKSTRIDE, reg->stride);
tdfx_outl(par, HWCURPATADDR, 0);
tdfx_outl(par, VIDSCREENSIZE,reg->screensize);
tdfx_outl(par, VIDSCREENSIZE, reg->screensize);
tdfx_outl(par, VIDDESKSTART, reg->startaddr);
tdfx_outl(par, VIDPROCCFG, reg->vidcfg);
tdfx_outl(par, VGAINIT1, reg->vgainit1);
......@@ -444,8 +421,9 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id)
if (dev_id < PCI_DEVICE_ID_3DFX_VOODOO5) {
/* Banshee/Voodoo3 */
has_sgram = draminit1 & DRAMINIT1_MEM_SDRAM;
chip_size = has_sgram ? ((draminit0 & DRAMINIT0_SGRAM_TYPE) ? 2 : 1)
: 2;
chip_size = 2;
if (has_sgram)
chip_size = (draminit0 & DRAMINIT0_SGRAM_TYPE) ? 2 : 1;
} else {
/* Voodoo4/5 */
has_sgram = 0;
......@@ -465,7 +443,7 @@ static unsigned long do_lfb_size(struct tdfx_par *par, unsigned short dev_id)
/* ------------------------------------------------------------------------- */
static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info)
static int tdfxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
{
struct tdfx_par *par = info->par;
u32 lpitch;
......@@ -496,7 +474,7 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info)
}
var->xres = (var->xres + 15) & ~15; /* could sometimes be 8 */
lpitch = var->xres * ((var->bits_per_pixel + 7)>>3);
lpitch = var->xres * ((var->bits_per_pixel + 7) >> 3);
if (var->xres < 320 || var->xres > 2048) {
DPRINTK("width not supported: %u\n", var->xres);
......@@ -509,20 +487,22 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info)
}
if (lpitch * var->yres_virtual > info->fix.smem_len) {
var->yres_virtual = info->fix.smem_len/lpitch;
var->yres_virtual = info->fix.smem_len / lpitch;
if (var->yres_virtual < var->yres) {
DPRINTK("no memory for screen (%ux%ux%u)\n",
var->xres, var->yres_virtual, var->bits_per_pixel);
var->xres, var->yres_virtual,
var->bits_per_pixel);
return -EINVAL;
}
}
if (PICOS2KHZ(var->pixclock) > par->max_pixclock) {
DPRINTK("pixclock too high (%ldKHz)\n",PICOS2KHZ(var->pixclock));
DPRINTK("pixclock too high (%ldKHz)\n",
PICOS2KHZ(var->pixclock));
return -EINVAL;
}
switch(var->bits_per_pixel) {
switch (var->bits_per_pixel) {
case 8:
var->red.length = var->green.length = var->blue.length = 8;
break;
......@@ -534,23 +514,20 @@ static int tdfxfb_check_var(struct fb_var_screeninfo *var,struct fb_info *info)
var->blue.offset = 0;
var->blue.length = 5;
break;
case 32:
case 24:
var->red.offset=16;
var->green.offset=8;
var->blue.offset=0;
var->red.length = var->green.length = var->blue.length = 8;
case 32:
var->red.offset = 16;
var->green.offset = 8;
var->blue.offset = 0;
var->red.length = var->green.length = var->blue.length = 8;
break;
}
var->height = var->width = -1;
var->accel_flags = FB_ACCELF_TEXT;
DPRINTK("Checking graphics mode at %dx%d depth %d\n", var->xres, var->yres, var->bits_per_pixel);
DPRINTK("Checking graphics mode at %dx%d depth %d\n",
var->xres, var->yres, var->bits_per_pixel);
return 0;
}
......@@ -567,9 +544,12 @@ static int tdfxfb_set_par(struct fb_info *info)
par->baseline = 0;
memset(&reg, 0, sizeof(reg));
cpp = (info->var.bits_per_pixel + 7)/8;
cpp = (info->var.bits_per_pixel + 7) / 8;
reg.vidcfg = VIDCFG_VIDPROC_ENABLE | VIDCFG_DESK_ENABLE | VIDCFG_CURS_X11 | ((cpp - 1) << VIDCFG_PIXFMT_SHIFT) | (cpp != 1 ? VIDCFG_CLUT_BYPASS : 0);
reg.vidcfg = VIDCFG_VIDPROC_ENABLE | VIDCFG_DESK_ENABLE |
VIDCFG_CURS_X11 |
((cpp - 1) << VIDCFG_PIXFMT_SHIFT) |
(cpp != 1 ? VIDCFG_CLUT_BYPASS : 0);
/* PLL settings */
freq = PICOS2KHZ(info->var.pixclock);
......@@ -582,7 +562,7 @@ static int tdfxfb_set_par(struct fb_info *info)
hsyncend = hsyncsta + info->var.hsync_len;
htotal = hsyncend + info->var.left_margin;
if (freq > par->max_pixclock/2) {
if (freq > par->max_pixclock / 2) {
freq = freq > par->max_pixclock ? par->max_pixclock : freq;
reg.dacmode |= DACMODE_2X;
reg.vidcfg |= VIDCFG_2X;
......@@ -721,7 +701,7 @@ static int tdfxfb_set_par(struct fb_info *info)
reg.dacmode &= ~DACMODE_2X;
reg.vidcfg &= ~VIDCFG_2X;
if (freq > par->max_pixclock/2) {
if (freq > par->max_pixclock / 2) {
freq = freq > par->max_pixclock ? par->max_pixclock : freq;
reg.dacmode |= DACMODE_2X;
reg.vidcfg |= VIDCFG_2X;
......@@ -764,24 +744,28 @@ static int tdfxfb_set_par(struct fb_info *info)
do_write_regs(info, &reg);
/* Now change fb_fix_screeninfo according to changes in par */
info->fix.line_length = info->var.xres * ((info->var.bits_per_pixel + 7)>>3);
info->fix.line_length =
info->var.xres * ((info->var.bits_per_pixel + 7) >> 3);
info->fix.visual = (info->var.bits_per_pixel == 8)
? FB_VISUAL_PSEUDOCOLOR
: FB_VISUAL_TRUECOLOR;
DPRINTK("Graphics mode is now set at %dx%d depth %d\n", info->var.xres, info->var.yres, info->var.bits_per_pixel);
DPRINTK("Graphics mode is now set at %dx%d depth %d\n",
info->var.xres, info->var.yres, info->var.bits_per_pixel);
return 0;
}
/* A handy macro shamelessly pinched from matroxfb */
#define CNVT_TOHW(val,width) ((((val)<<(width))+0x7FFF-(val))>>16)
#define CNVT_TOHW(val, width) ((((val)<<(width))+0x7FFF-(val))>>16)
static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
unsigned blue,unsigned transp,struct fb_info *info)
unsigned blue, unsigned transp,
struct fb_info *info)
{
struct tdfx_par *par = info->par;
u32 rgbcol;
if (regno >= info->cmap.len || regno > 255) return 1;
if (regno >= info->cmap.len || regno > 255)
return 1;
switch (info->fix.visual) {
case FB_VISUAL_PSEUDOCOLOR:
......@@ -793,13 +777,13 @@ static int tdfxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
/* Truecolor has no hardware color palettes. */
case FB_VISUAL_TRUECOLOR:
if (regno < 16) {
rgbcol = (CNVT_TOHW( red, info->var.red.length) <<
rgbcol = (CNVT_TOHW(red, info->var.red.length) <<
info->var.red.offset) |
(CNVT_TOHW( green, info->var.green.length) <<
(CNVT_TOHW(green, info->var.green.length) <<
info->var.green.offset) |
(CNVT_TOHW( blue, info->var.blue.length) <<
(CNVT_TOHW(blue, info->var.blue.length) <<
info->var.blue.offset) |
(CNVT_TOHW( transp, info->var.transp.length) <<
(CNVT_TOHW(transp, info->var.transp.length) <<
info->var.transp.offset);
par->palette[regno] = rgbcol;
}
......@@ -882,12 +866,13 @@ static int tdfxfb_pan_display(struct fb_var_screeninfo *var,
/*
* FillRect 2D command (solidfill or invert (via ROP_XOR))
*/
static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
static void tdfxfb_fillrect(struct fb_info *info,
const struct fb_fillrect *rect)
{
struct tdfx_par *par = info->par;
u32 bpp = info->var.bits_per_pixel;
u32 stride = info->fix.line_length;
u32 fmt= stride | ((bpp+((bpp==8) ? 0 : 8)) << 13);
u32 fmt= stride | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
int tdfx_rop;
if (rect->rop == ROP_COPY)
......@@ -910,14 +895,15 @@ static void tdfxfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect
/*
* Screen-to-Screen BitBlt 2D command (for the bmove fb op.)
*/
static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
static void tdfxfb_copyarea(struct fb_info *info,
const struct fb_copyarea *area)
{
struct tdfx_par *par = info->par;
u32 sx = area->sx, sy = area->sy, dx = area->dx, dy = area->dy;
u32 bpp = info->var.bits_per_pixel;
u32 stride = info->fix.line_length;
u32 blitcmd = COMMAND_2D_S2S_BITBLT | (TDFX_ROP_COPY << 24);
u32 fmt = stride | ((bpp+((bpp==8) ? 0 : 8)) << 13);
u32 fmt = stride | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
if (area->sx <= area->dx) {
//-X
......@@ -945,11 +931,11 @@ static void tdfxfb_copyarea(struct fb_info *info, const struct fb_copyarea *area
static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image)
{
struct tdfx_par *par = info->par;
int size = image->height * ((image->width * image->depth + 7)>>3);
int size = image->height * ((image->width * image->depth + 7) >> 3);
int fifo_free;
int i, stride = info->fix.line_length;
u32 bpp = info->var.bits_per_pixel;
u32 dstfmt = stride | ((bpp+((bpp==8) ? 0 : 8)) << 13);
u32 dstfmt = stride | ((bpp + ((bpp == 8) ? 0 : 8)) << 13);
u8 *chardata = (u8 *) image->data;
u32 srcfmt;
......@@ -991,23 +977,31 @@ static void tdfxfb_imageblit(struct fb_info *info, const struct fb_image *image)
fifo_free = 0;
/* Send four bytes at a time of data */
for (i = (size >> 2) ; i > 0; i--) {
if(--fifo_free < 0) {
fifo_free=31;
banshee_make_room(par,fifo_free);
for (i = (size >> 2); i > 0; i--) {
if (--fifo_free < 0) {
fifo_free = 31;
banshee_make_room(par, fifo_free);
}
tdfx_outl(par, LAUNCH_2D,*(u32*)chardata);
tdfx_outl(par, LAUNCH_2D, *(u32*)chardata);
chardata += 4;
}
/* Send the leftovers now */
banshee_make_room(par,3);
i = size%4;
banshee_make_room(par, 3);
i = size % 4;
switch (i) {
case 0: break;
case 1: tdfx_outl(par, LAUNCH_2D,*chardata); break;
case 2: tdfx_outl(par, LAUNCH_2D,*(u16*)chardata); break;
case 3: tdfx_outl(par, LAUNCH_2D,*(u16*)chardata | ((chardata[3]) << 24)); break;
case 0:
break;
case 1:
tdfx_outl(par, LAUNCH_2D, *chardata);
break;
case 2:
tdfx_outl(par, LAUNCH_2D, *(u16*)chardata);
break;
case 3:
tdfx_outl(par, LAUNCH_2D,
*(u16*)chardata | ((chardata[3]) << 24));
break;
}
}
#endif /* CONFIG_FB_3DFX_ACCEL */
......@@ -1023,7 +1017,8 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
* current cursor state (if enable is set) or we want to query what
* we can do with the cursor (if enable is not set)
*/
if (!cursor->set) return 0;
if (!cursor->set)
return 0;
/* Too large of a cursor :-( */
if (cursor->image.width > 64 || cursor->image.height > 64)
......@@ -1054,9 +1049,9 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
fg_color = ((cmap.red[cmap.start] << 16) |
(cmap.green[cmap.start] << 8) |
(cmap.blue[cmap.start]));
bg_color = ((cmap.red[cmap.start+1] << 16) |
(cmap.green[cmap.start+1] << 8) |
(cmap.blue[cmap.start+1]));
bg_color = ((cmap.red[cmap.start + 1] << 16) |
(cmap.green[cmap.start + 1] << 8) |
(cmap.blue[cmap.start + 1]));
fb_copy_cmap(&cmap, &info->cursor.image.cmap);
spin_lock_irqsave(&par->DAClock, flags);
banshee_make_room(par, 2);
......@@ -1106,9 +1101,9 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
* (128 bits) which is the maximum cursor width times two for
* the two monochrome patterns.
*/
u8 *cursorbase = (u8 *) info->cursor.image.data;
u8 *cursorbase = (u8 *)info->cursor.image.data;
char *bitmap = (char *)cursor->image.data;
char *mask = (char *) cursor->mask;
char *mask = (char *)cursor->mask;
int i, j, k, h = 0;
for (i = 0; i < 64; i++) {
......@@ -1116,7 +1111,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
j = (cursor->image.width + 7) >> 3;
k = 8 - j;
for (;j > 0; j--) {
for (; j > 0; j--) {
/* Pattern 0. Copy the cursor bitmap to it */
fb_writeb(*bitmap, cursorbase + h);
bitmap++;
......@@ -1125,7 +1120,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
mask++;
h++;
}
for (;k > 0; k--) {
for (; k > 0; k--) {
fb_writeb(0, cursorbase + h);
fb_writeb(~0, cursorbase + h + 8);
h++;
......@@ -1142,7 +1137,7 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
/* Turn the cursor on */
cursor->enable = 1;
info->cursor = *cursor;
mod_timer(&par->hwcursor.timer, jiffies+HZ/2);
mod_timer(&par->hwcursor.timer, jiffies + HZ / 2);
spin_lock_irqsave(&par->DAClock, flags);
banshee_make_room(par, 1);
tdfx_outl(par, VIDPROCCFG, par->hwcursor.enable);
......@@ -1151,6 +1146,25 @@ static int tdfxfb_cursor(struct fb_info *info, struct fb_cursor *cursor)
}
#endif
static struct fb_ops tdfxfb_ops = {
.owner = THIS_MODULE,
.fb_check_var = tdfxfb_check_var,
.fb_set_par = tdfxfb_set_par,
.fb_setcolreg = tdfxfb_setcolreg,
.fb_blank = tdfxfb_blank,
.fb_pan_display = tdfxfb_pan_display,
.fb_sync = banshee_wait_idle,
#ifdef CONFIG_FB_3DFX_ACCEL
.fb_fillrect = tdfxfb_fillrect,
.fb_copyarea = tdfxfb_copyarea,
.fb_imageblit = tdfxfb_imageblit,
#else
.fb_fillrect = cfb_fillrect,
.fb_copyarea = cfb_copyarea,
.fb_imageblit = cfb_imageblit,
#endif
};
/**
* tdfxfb_probe - Device Initializiation
*
......@@ -1197,7 +1211,8 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
tdfx_fix.mmio_start = pci_resource_start(pdev, 0);
tdfx_fix.mmio_len = pci_resource_len(pdev, 0);
default_par->regbase_virt = ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len);
default_par->regbase_virt =
ioremap_nocache(tdfx_fix.mmio_start, tdfx_fix.mmio_len);
if (!default_par->regbase_virt) {
printk("fb: Can't remap %s register area.\n", tdfx_fix.id);
goto out_err;
......@@ -1271,7 +1286,7 @@ static int __devinit tdfxfb_probe(struct pci_dev *pdev,
/* maximize virtual vertical length */
lpitch = info->var.xres_virtual * ((info->var.bits_per_pixel + 7) >> 3);
info->var.yres_virtual = info->fix.smem_len/lpitch;
info->var.yres_virtual = info->fix.smem_len / lpitch;
if (info->var.yres_virtual < info->var.yres)
goto out_err;
......@@ -1316,7 +1331,7 @@ out_err:
#ifndef MODULE
static void tdfxfb_setup(char *options)
{
char* this_opt;
char *this_opt;
if (!options || !*options)
return;
......@@ -1324,9 +1339,9 @@ static void tdfxfb_setup(char *options)
while ((this_opt = strsep(&options, ",")) != NULL) {
if (!*this_opt)
continue;
if(!strcmp(this_opt, "nopan")) {
if (!strcmp(this_opt, "nopan")) {
nopan = 1;
} else if(!strcmp(this_opt, "nowrap")) {
} else if (!strcmp(this_opt, "nowrap")) {
nowrap = 1;
} else {
mode_option = this_opt;
......
......@@ -82,15 +82,15 @@
#define BIT(x) (1UL << (x))
/* COMMAND_2D reg. values */
#define TDFX_ROP_COPY 0xcc // src
#define TDFX_ROP_INVERT 0x55 // NOT dst
#define TDFX_ROP_XOR 0x66 // src XOR dst
#define TDFX_ROP_COPY 0xcc /* src */
#define TDFX_ROP_INVERT 0x55 /* NOT dst */
#define TDFX_ROP_XOR 0x66 /* src XOR dst */
#define AUTOINC_DSTX BIT(10)
#define AUTOINC_DSTY BIT(11)
#define COMMAND_2D_FILLRECT 0x05
#define COMMAND_2D_S2S_BITBLT 0x01 // screen to screen
#define COMMAND_2D_H2S_BITBLT 0x03 // host to screen
#define COMMAND_2D_S2S_BITBLT 0x01 /* screen to screen */
#define COMMAND_2D_H2S_BITBLT 0x03 /* host to screen */
#define COMMAND_3D_NOP 0x00
#define STATUS_RETRACE BIT(6)
......@@ -99,7 +99,7 @@
#define MISCINIT1_2DBLOCK_DIS BIT(15)
#define DRAMINIT0_SGRAM_NUM BIT(26)
#define DRAMINIT0_SGRAM_TYPE BIT(27)
#define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27)|BIT(28)|BIT(29))
#define DRAMINIT0_SGRAM_TYPE_MASK (BIT(27) | BIT(28) | BIT(29))
#define DRAMINIT0_SGRAM_TYPE_SHIFT 27
#define DRAMINIT1_MEM_SDRAM BIT(30)
#define VGAINIT0_VGA_DISABLE BIT(0)
......@@ -143,9 +143,9 @@ struct banshee_reg {
/* VGA rubbish */
unsigned char att[21];
unsigned char crt[25];
unsigned char gra[ 9];
unsigned char gra[9];
unsigned char misc[1];
unsigned char seq[ 5];
unsigned char seq[5];
/* Banshee extensions */
unsigned char ext[2];
......@@ -180,8 +180,8 @@ struct tdfx_par {
u32 baseline;
struct {
int w,u,d;
unsigned long enable,disable;
int w, u, d;
unsigned long enable, disable;
struct timer_list timer;
} hwcursor;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment