[PATCH] framebuffer drivers: static zero initializers removal

Andrey Panin
2001-03-29T11:09:13Z

[-- Attachment #1.1: Type: text/plain, Size: 487 bytes --]

Hi all,

IMHO subject is selfexplaining. Affected files: amifb.c, atafb.c, clgenfb.c,
cyberfb.c, tdfxfb.c, tgafb.c, vesafb.c, vfb.c, vga16fb.c, vgacon.c, virgefb.c
and most importantly skeletonfb.c :)

All patches are extremely simple, except patch for TGA framebuffer which
adds missing pci_enable_device() call.

Best regards.

--
Andrey Panin | Embedded systems software engineer
pazke@orbita1.ru | PGP key: http://www.orbita1.ru/~pazke/AndreyPanin.asc

[-- Attachment #1.2: patch-amifb --]
[-- Type: text/plain, Size: 2096 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/amifb.c /linux/drivers/video/amifb.c
--- /linux.vanilla/drivers/video/amifb.c Tue Mar 27 20:32:55 2001
+++ /linux/drivers/video/amifb.c Thu Mar 29 21:02:36 2001
@@ -661,7 +661,7 @@
copins *rebuild[2];
} copdisplay;

-static u_short currentcop = 0;
+static u_short currentcop;

/*
* Hardware Cursor
@@ -742,7 +742,7 @@
u_short fmode; /* vmode */
} currentpar;

-static int currcon = 0;
+static int currcon;

static struct display disp;

@@ -770,18 +770,18 @@
* Latches for Display Changes during VBlank
*/

-static u_short do_vmode_full = 0; /* Change the Video Mode */
-static u_short do_vmode_pan = 0; /* Update the Video Mode */
-static short do_blank = 0; /* (Un)Blank the Screen (╠1) */
-static u_short do_cursor = 0; /* Move the Cursor */
+static u_short do_vmode_full; /* Change the Video Mode */
+static u_short do_vmode_pan; /* Update the Video Mode */
+static short do_blank; /* (Un)Blank the Screen (╠1) */
+static u_short do_cursor; /* Move the Cursor */

/*
* Various Flags
*/

-static u_short is_blanked = 0; /* Screen is Blanked */
-static u_short is_lace = 0; /* Screen is laced */
+static u_short is_blanked; /* Screen is Blanked */
+static u_short is_lace; /* Screen is laced */

/*
* Frame Buffer Name
@@ -929,8 +929,8 @@
#define DEFMODE_AGA 19 /* "vga70" for AGA */

-static int amifb_ilbm = 0; /* interleaved or normal bitplanes */
-static int amifb_inverse = 0;
+static int amifb_ilbm; /* interleaved or normal bitplanes */
+static int amifb_inverse;

/*
@@ -1573,7 +1573,7 @@
* Allocate, Clear and Align a Block of Chip Memory
*/

-static u_long unaligned_chipptr = 0;
+static u_long unaligned_chipptr;

static inline u_long __init chipalloc(u_long size)
{
@@ -1923,7 +1923,7 @@
static char __init *strtoke(char *s,const char *ct)
{
char *sbegin, *send;
- static char *ssave = NULL;
+ static char *ssave;

sbegin = s ? s : ssave;
if (!sbegin)

[-- Attachment #1.3: patch-atafb --]
[-- Type: text/plain, Size: 2374 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/atafb.c /linux/drivers/video/atafb.c
--- /linux.vanilla/drivers/video/atafb.c Tue Mar 27 20:32:55 2001
+++ /linux/drivers/video/atafb.c Thu Mar 29 21:04:50 2001
@@ -89,9 +89,9 @@
#define up(x, r) (((x) + (r) - 1) & ~((r)-1))

-static int default_par=0; /* default resolution (0=none) */
+static int default_par; /* default resolution (0=none) */

-static unsigned long default_mem_req=0;
+static unsigned long default_mem_req;

static int hwscroll=-1;

@@ -99,7 +99,7 @@

static int sttt_xres=640,st_yres=400,tt_yres=480;
static int sttt_xres_virtual=640,sttt_yres_virtual=400;
-static int ovsc_offset=0, ovsc_addlen=0;
+static int ovsc_offset, ovsc_addlen;

static struct atafb_par {
void *screen_base;
@@ -139,7 +139,7 @@
/* Don't calculate an own resolution, and thus don't change the one found when
* booting (currently used for the Falcon to keep settings for internal video
* hardware extensions (e.g. ScreenBlaster) */
-static int DontCalcRes = 0;
+static int DontCalcRes;

#ifdef ATAFB_FALCON
#define HHT hw.falcon.hht
@@ -171,11 +171,11 @@

static int screen_len;

-static int current_par_valid=0;
+static int current_par_valid;

-static int currcon=0;
+static int currcon;

-static int mono_moni=0;
+static int mono_moni;

static struct display disp;

@@ -192,9 +192,9 @@

static unsigned external_depth;
static int external_pmode;
-static void *external_addr = 0;
+static void *external_addr;
static unsigned long external_len;
-static unsigned long external_vgaiobase = 0;
+static unsigned long external_vgaiobase;
static unsigned int external_bitspercol = 6;

/*
@@ -242,7 +242,7 @@
#endif /* ATAFB_EXT */

-static int inverse=0;
+static int inverse;

extern int fontheight_8x8;
extern int fontwidth_8x8;
@@ -1469,9 +1469,9 @@
}

-static int f_change_mode = 0;
+static int f_change_mode;
static struct falcon_hw f_new_mode;
-static int f_pan_display = 0;
+static int f_pan_display;

static void falcon_get_par( struct atafb_par *par )
{
@@ -2865,7 +2865,7 @@
static char * strtoke(char * s,const char * ct)
{
char *sbegin, *send;
- static char *ssave = NULL;
+ static char *ssave;

sbegin = s ? s : ssave;
if (!sbegin) {

[-- Attachment #1.4: patch-clgenfb --]
[-- Type: text/plain, Size: 1621 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/clgenfb.c /linux/drivers/video/clgenfb.c
--- /linux.vanilla/drivers/video/clgenfb.c Tue Mar 27 20:32:55 2001
+++ /linux/drivers/video/clgenfb.c Thu Mar 29 21:10:12 2001
@@ -98,7 +98,7 @@
#ifndef CLGEN_NDEBUG
#define assert(expr) \
if(!(expr)) { \
- printk( "Assertion failed! %s,%s,%s,line=%d\n",\
+ printk(KERN_DEBUG "Assertion failed! %s,%s,%s,line=%d\n",\
#expr,__FILE__,__FUNCTION__,__LINE__); \
}
#else
@@ -407,7 +407,7 @@

static unsigned clgen_def_mode = 1;

-static int release_io_ports = 0;
+static int release_io_ports;

@@ -622,7 +622,7 @@
/*****************************************************************************/
/*** BEGIN Interface Used by the World ***************************************/

-static int opencount = 0;
+static int opencount;

/*--- Open /dev/fbx ---------------------------------------------------------*/
static int clgenfb_open (struct fb_info *info, int user)
@@ -1816,7 +1816,7 @@
* blank_mode == 4: powerdown
*/
unsigned char val;
- static int current_mode = 0;
+ static int current_mode;
struct clgenfb_info *fb_info = (struct clgenfb_info *) info;

DPRINTK ("ENTER, blank mode = %d\n", blank_mode);
@@ -2103,7 +2103,7 @@
static void switch_monitor (struct clgenfb_info *fb_info, int on)
{
#ifdef CONFIG_ZORRO /* only works on Zorro boards */
- static int IsOn = 0; /* XXX not ok for multiple boards */
+ static int IsOn; /* XXX not ok for multiple boards */

DPRINTK ("ENTER\n");

[-- Attachment #1.5: patch-cyberfb --]
[-- Type: text/plain, Size: 959 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/cyberfb.c /linux/drivers/video/cyberfb.c
--- /linux.vanilla/drivers/video/cyberfb.c Fri Feb 23 20:34:01 2001
+++ /linux/drivers/video/cyberfb.c Thu Mar 29 21:12:08 2001
@@ -122,8 +122,8 @@

static struct cyberfb_par current_par;

-static int current_par_valid = 0;
-static int currcon = 0;
+static int current_par_valid;
+static int currcon;

static struct display disp;
static struct fb_info fb_info;
@@ -221,7 +221,7 @@

#define NUM_TOTAL_MODES ARRAY_SIZE(cyberfb_predefined)

-static int Cyberfb_inverse = 0;
+static int Cyberfb_inverse;

/*
* Some default modes
@@ -1412,7 +1412,7 @@
volatile unsigned char *base)
{
volatile unsigned char *addr;
- static unsigned char cvportbits = 0; /* Mirror port bits here */
+ static unsigned char cvportbits; /* Mirror port bits here */
DPRINTK("ENTER\n");

addr = base + 0x40001;

[-- Attachment #1.6: patch-tdfxfb --]
[-- Type: text/plain, Size: 936 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/tdfxfb.c /linux//drivers/video/tdfxfb.c
--- /linux.vanilla/drivers/video/tdfxfb.c Tue Mar 27 20:32:57 2001
+++ /linux//drivers/video/tdfxfb.c Thu Mar 29 21:29:29 2001
@@ -458,7 +458,7 @@
void tdfxfb_setup(char *options,
int *ints);

-static int currcon = 0;
+static int currcon;

static struct fb_ops tdfxfb_ops = {
owner: THIS_MODULE,
@@ -491,14 +491,14 @@

static struct fb_info_tdfx fb_info;

-static int noaccel = 0;
-static int nopan = 0;
+static int noaccel;
+static int nopan;
static int nowrap = 1; // not implemented (yet)
-static int inverse = 0;
+static int inverse;
#ifdef CONFIG_MTRR
-static int nomtrr = 0;
+static int nomtrr;
#endif
-static int nohwcursor = 0;
+static int nohwcursor;
static char __initdata fontname[40] = { 0 };
static const char *mode_option __initdata = NULL;

[-- Attachment #1.7: patch-tgafb --]
[-- Type: text/plain, Size: 2407 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/tgafb.c /linux//drivers/video/tgafb.c
--- /linux.vanilla/drivers/video/tgafb.c Tue Mar 27 20:32:57 2001
+++ /linux//drivers/video/tgafb.c Thu Mar 29 22:01:09 2001
@@ -57,14 +57,14 @@

static struct tgafb_info fb_info;
static struct tgafb_par current_par;
-static int current_par_valid = 0;
+static int current_par_valid;
static struct display disp;

static char default_fontname[40] __initdata = { 0 };
static struct fb_var_screeninfo default_var;
-static int default_var_valid = 0;
+static int default_var_valid;

-static int currcon = 0;
+static int currcon;

static struct { u_char red, green, blue, pad; } palette[256];
#ifdef FBCON_HAS_CFB32
@@ -778,7 +778,7 @@

static int tgafb_blank(int blank, struct fb_info_gen *info)
{
- static int tga_vesa_blanked = 0;
+ static int tga_vesa_blanked;
u32 vhcr, vvcr, vvvr;
unsigned long flags;

@@ -921,14 +921,20 @@
int __init tgafb_init(void)
{
struct pci_dev *pdev;
+ int retval;

pdev = pci_find_device(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TGA, NULL);
if (!pdev)
return -ENXIO;

+ if ((retval = pci_enable_device(pdev)))
+ return retval;
+
/* divine board type */

- fb_info.tga_mem_base = (unsigned long)ioremap(pdev->resource[0].start, 0);
+ fb_info.tga_mem_base = (unsigned long)ioremap(pci_resource_start(pdev, 0), 0);
+ if (!fb_info.tga_mem_base)
+ return -ENOMEM;
fb_info.tga_type = (readl(fb_info.tga_mem_base) >> 12) & 0x0f;
fb_info.tga_regs_base = fb_info.tga_mem_base + TGA_REGS_OFFSET;
fb_info.tga_fb_base = (fb_info.tga_mem_base
@@ -979,11 +985,11 @@
fbgen_do_set_var(&disp.var, 1, &fb_info.gen);
fbgen_set_disp(-1, &fb_info.gen);
fbgen_install_cmap(0, &fb_info.gen);
- if (register_framebuffer(&fb_info.gen.info) < 0)
- return -EINVAL;
+ if ((retval = register_framebuffer(&fb_info.gen.info)))
+ return retval;
printk(KERN_INFO "fb%d: %s frame buffer device at 0x%lx\n",
GET_FB_IDX(fb_info.gen.info.node), fb_info.gen.info.modename,
- pdev->resource[0].start);
+ pci_resource_start(pdev, 0));
return 0;
}

@@ -994,6 +1000,7 @@

void __exit tgafb_cleanup(void)
{
+ iounmap((void *)fb_info.tga_mem_base);
unregister_framebuffer(&fb_info.gen.info);
}

[-- Attachment #1.8: patch-vesafb --]
[-- Type: text/plain, Size: 1741 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/vesafb.c /linux//drivers/video/vesafb.c
--- /linux.vanilla/drivers/video/vesafb.c Tue Mar 27 20:32:57 2001
+++ /linux//drivers/video/vesafb.c Thu Mar 29 22:13:55 2001
@@ -59,22 +59,11 @@
/* --------------------------------------------------------------------- */

static struct fb_var_screeninfo vesafb_defined = {
- 0,0,0,0, /* W,H, W, H (virtual) load xres,xres_virtual*/
- 0,0, /* virtual -> visible no offset */
- 8, /* depth -> load bits_per_pixel */
- 0, /* greyscale ? */
- {0,0,0}, /* R */
- {0,0,0}, /* G */
- {0,0,0}, /* B */
- {0,0,0}, /* transparency */
- 0, /* standard pixel format */
- FB_ACTIVATE_NOW,
- -1,-1,
- 0,
- 0L,0L,0L,0L,0L,
- 0L,0L,0, /* No sync info */
- FB_VMODE_NONINTERLACED,
- {0,0,0,0,0,0}
+ bits_per_pixel: 8, /* depth -> load bits_per_pixel */
+ activate: FB_ACTIVATE_NOW,
+ height: -1,
+ width: -1,
+ vmode: FB_VMODE_NONINTERLACED,
};

static struct display disp;
@@ -92,13 +81,13 @@
#endif
} fbcon_cmap;

-static int inverse = 0;
-static int mtrr = 0;
-static int currcon = 0;
+static int inverse;
+static int mtrr;
+static int currcon;

-static int pmi_setpal = 0; /* pmi for palette changes ??? */
-static int ypan = 0; /* 0..nothing, 1..ypan, 2..ywrap */
-static unsigned short *pmi_base = 0;
+static int pmi_setpal; /* pmi for palette changes ??? */
+static int ypan; /* 0..nothing, 1..ypan, 2..ywrap */
+static unsigned short *pmi_base;
static void (*pmi_start)(void);
static void (*pmi_pal)(void);

[-- Attachment #1.9: patch-vfb --]
[-- Type: text/plain, Size: 701 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/vfb.c /linux//drivers/video/vfb.c
--- /linux.vanilla/drivers/video/vfb.c Fri Feb 23 20:34:02 2001
+++ /linux//drivers/video/vfb.c Thu Mar 29 22:29:58 2001
@@ -43,7 +43,7 @@

static u_long videomemory, videomemorysize = VIDEOMEMSIZE;
MODULE_PARM(videomemorysize, "l");
-static int currcon = 0;
+static int currcon;
static struct display disp;
static struct fb_info fb_info;
static struct { u_char red, green, blue, pad; } palette[256];
@@ -68,7 +68,7 @@
0, FB_VMODE_NONINTERLACED
};

-static int vfb_enable = 0; /* disabled by default */
+static int vfb_enable; /* disabled by default */

/*

[-- Attachment #1.10: patch-vga16fb --]
[-- Type: text/plain, Size: 518 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/vga16fb.c /linux//drivers/video/vga16fb.c
--- /linux.vanilla/drivers/video/vga16fb.c Tue Mar 27 20:32:57 2001
+++ /linux//drivers/video/vga16fb.c Thu Mar 29 22:28:18 2001
@@ -102,7 +102,7 @@
static struct display disp;
static struct { u_short blue, green, red, pad; } palette[256];

-static int currcon = 0;
+static int currcon;

/* --------------------------------------------------------------------- */

[-- Attachment #1.11: patch-vgacon --]
[-- Type: text/plain, Size: 1601 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/vgacon.c /linux//drivers/video/vgacon.c
--- /linux.vanilla/drivers/video/vgacon.c Fri Feb 23 20:34:02 2001
+++ /linux//drivers/video/vgacon.c Thu Mar 29 21:17:57 2001
@@ -104,7 +104,7 @@
static u16 vga_video_port_val; /* Video register value port */
static unsigned int vga_video_num_columns; /* Number of text columns */
static unsigned int vga_video_num_lines; /* Number of text lines */
-static int vga_can_do_color = 0; /* Do we support colors? */
+static int vga_can_do_color; /* Do we support colors? */
static unsigned int vga_default_font_height; /* Height of default screen font */
static unsigned char vga_video_type; /* Card type */
static unsigned char vga_hardscroll_enabled;
@@ -112,7 +112,7 @@
/*
* SoftSDV doesn't have hardware assist VGA scrolling
*/
-static unsigned char vga_hardscroll_user_enable = 0;
+static unsigned char vga_hardscroll_user_enable;
#else
static unsigned char vga_hardscroll_user_enable = 1;
#endif
@@ -122,7 +122,7 @@
static int vga_is_gfx;
static int vga_512_chars;
static int vga_video_font_height;
-static unsigned int vga_rolled_over = 0;
+static unsigned int vga_rolled_over;

static int __init no_scroll(char *str)
@@ -965,7 +965,7 @@

static void vgacon_save_screen(struct vc_data *c)
{
- static int vga_bootup_console = 0;
+ static int vga_bootup_console;

if (!vga_bootup_console) {
/* This is a gross hack, but here is the only place we can

[-- Attachment #1.12: patch-virgefb --]
[-- Type: text/plain, Size: 841 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/virgefb.c /linux//drivers/video/virgefb.c
--- /linux.vanilla/drivers/video/virgefb.c Fri Feb 23 20:34:02 2001
+++ /linux//drivers/video/virgefb.c Thu Mar 29 21:27:53 2001
@@ -107,8 +107,8 @@

static struct virgefb_par current_par;

-static int current_par_valid = 0;
-static int currcon = 0;
+static int current_par_valid;
+static int currcon;

static struct display disp;
static struct fb_info fb_info;
@@ -141,7 +141,7 @@
void (*blank)(int blank);
} *fbhw;

-static int blit_maybe_busy = 0;
+static int blit_maybe_busy;

/*
* Frame Buffer Name
@@ -278,7 +278,7 @@
#define NUM_TOTAL_MODES ARRAY_SIZE(virgefb_predefined)

-static int Cyberfb_inverse = 0;
+static int Cyberfb_inverse;

/*
* Some default modes

[-- Attachment #1.13: patch-skeletonfb --]
[-- Type: text/plain, Size: 652 bytes --]

diff -ur -x .depend -x *.o -x *.flags /linux.vanilla/drivers/video/skeletonfb.c /linux//drivers/video/skeletonfb.c
--- /linux.vanilla/drivers/video/skeletonfb.c Fri Feb 23 20:34:02 2001
+++ /linux//drivers/video/skeletonfb.c Thu Mar 29 21:14:34 2001
@@ -65,13 +65,13 @@

static struct xxxfb_info fb_info;
static struct xxxfb_par current_par;
-static int current_par_valid = 0;
+static int current_par_valid;
static struct display disp;

static struct fb_var_screeninfo default_var;

-static int currcon = 0;
-static int inverse = 0;
+static int currcon;
+static int inverse;

int xxxfb_init(void);
int xxxfb_setup(char*);

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]