From: Andrew Morton <akpm@osdl.org>

- Coding style fixes

- Remove unneeded typecasts

- namespace fixes

- arcfb_setup() is only needed for static builds

  (this all seems wrong - why does fb_get_options() exist now that module
  parameters can be passed to static drivers from the kernel command line?)


Cc: Jaya Kumar <jayalk@intworks.biz>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: <linux-fbdev-devel@lists.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/video/arcfb.c |   77 ++++++++++++++++++++++++--------------------------
 1 files changed, 38 insertions(+), 39 deletions(-)

diff -puN drivers/video/arcfb.c~framebuffer-driver-for-arc-lcd-board-tidy drivers/video/arcfb.c
--- 25/drivers/video/arcfb.c~framebuffer-driver-for-arc-lcd-board-tidy	2005-06-05 22:23:08.000000000 -0700
+++ 25-akpm/drivers/video/arcfb.c	2005-06-05 22:27:07.000000000 -0700
@@ -44,10 +44,11 @@
 #include <linux/vmalloc.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <asm/uaccess.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 
+#include <asm/uaccess.h>
+
 #define ceil64(a) (a|0x3F)
 #define floor8(a) (a&(~0x07))
 #define floorXres(a,info) (a&(~(xres - 1)))
@@ -81,17 +82,14 @@ static struct fb_var_screeninfo arcfb_va
 	.nonstd		= 1,
 };
 
-unsigned long arcfb_num_cols;
-unsigned long arcfb_num_rows;
-unsigned long data_io_addr;
-unsigned long ctl_io_addr;
-unsigned long splashvalue;
-unsigned long tuhold;
-unsigned int nosplash;
-unsigned int arcfb_enable;
-
-int arcfb_init(void);
-int arcfb_setup(char*);
+static unsigned long arcfb_num_cols;
+static unsigned long arcfb_num_rows;
+static unsigned long data_io_addr;
+static unsigned long ctl_io_addr;
+static unsigned long splashvalue;
+static unsigned long tuhold;
+static unsigned int nosplash;
+static unsigned int arcfb_enable;
 
 /* ks108 chipset specific defines and code */
 
@@ -149,10 +147,10 @@ static void ks108_clear_lcd(struct arcfb
 {
 	int i,j;
 
-	for (i=0; i <= 8; i++) {
+	for (i = 0; i <= 8; i++) {
 		ks108_set_yaddr(par, chipindex, i);
 		ks108_set_xaddr(par, chipindex, 0);
-		for (j=0; j < 64; j++) {
+		for (j = 0; j < 64; j++) {
 			ks108_writeb_data(par, chipindex,
 				(unsigned char) splashvalue);
 		}
@@ -163,15 +161,17 @@ static void ks108_clear_lcd(struct arcfb
 
 static int arcfb_open(struct fb_info *info, int user)
 {
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
+
 	atomic_inc(&par->ref_count);
 	return 0;
 }
 
 static int arcfb_release(struct fb_info *info, int user)
 {
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
 	int count = atomic_read(&par->ref_count);
+
 	if (!count)
 		return -EINVAL;
 	atomic_dec(&par->ref_count);
@@ -182,13 +182,12 @@ static int arcfb_pan_display(struct fb_v
 				struct fb_info *info)
 {
 	int i;
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
 
 	if ((var->vmode & FB_VMODE_YWRAP) && (var->yoffset < 64)
 		&& (info->var.yres <= 64)) {
-		for (i=0; i < arcfb_num_cols; i++) {
+		for (i = 0; i < arcfb_num_cols; i++)
 			ks108_set_start_line(par, i, var->yoffset);
-		}
 		info->var.yoffset = var->yoffset;
 		return 0;
 	}
@@ -224,8 +223,8 @@ static void arcfb_lcd_update_page(struct
 	bitmask=1;
 	rightshift=0;
 	while (left <= right) {
-		val = 0; i=0;
-		for (i=0; i < 8; i++) {
+		val = 0;
+		for (i = 0; i < 8; i++) {
 			if ( i > rightshift) {
 				val |= (*(src + (i*linesize)) & bitmask)
 						<< (i - rightshift);
@@ -283,13 +282,13 @@ static void arcfb_lcd_update_horiz(struc
 
 	distance = h;
 	upper = floor8(top);
-	lower = min( (upper + distance - 1), ceil64(upper) );
+	lower = min(upper + distance - 1, ceil64(upper));
 
 	while (distance > 0) {
-		distance -= ( (lower - upper) + 1 );
+		distance -= ((lower - upper) + 1);
 		arcfb_lcd_update_vert(par, upper, lower, left, right);
 		upper = lower + 1;
-		lower = min( (upper + distance - 1), ceil64(upper) );
+		lower = min(upper + distance - 1, ceil64(upper));
 	}
 }
 
@@ -304,19 +303,19 @@ static void arcfb_lcd_update(struct arcf
 	unsigned int left, right, distance;
 	distance = w;
 	left = dx;
-	right = min( (left + w - 1), ceil64(left) );
+	right = min(left + w - 1, ceil64(left));
 
 	while (distance > 0) {
-		arcfb_lcd_update_horiz(par,left,right,dy,h);
+		arcfb_lcd_update_horiz(par, left, right, dy, h);
 		distance -= ((right - left) + 1);
 		left = right + 1;
-		right = min((left + distance - 1), ceil64(left));
+		right = min(left + distance - 1, ceil64(left));
 	}
 }
 
 void arcfb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
 {
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
 	int y, h;
 
 	cfb_fillrect(info, rect);
@@ -332,7 +331,7 @@ void arcfb_fillrect(struct fb_info *info
 void arcfb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
 {
 	unsigned int y, h;
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
 
 	cfb_copyarea(info, area);
 
@@ -347,7 +346,7 @@ void arcfb_copyarea(struct fb_info *info
 void arcfb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
 	unsigned int y, h;
-	struct arcfb_par *par = (struct arcfb_par *) info->par;
+	struct arcfb_par *par = info->par;
 
 	cfb_imageblit(info, image);
 
@@ -383,14 +382,13 @@ static ssize_t arcfb_write(struct file *
 	inode = file->f_dentry->d_inode;
 	fbidx = iminor(inode);
 	info = registered_fb[fbidx];
-	par = (struct arcfb_par *) info->par;
-
+	par = info->par;
 
 	if (!info || !info->screen_base)
 		return -ENODEV;
 
 	xres = info->var.xres;
-	fbmemlength = ( xres * info->var.yres)/8;
+	fbmemlength = (xres * info->var.yres)/8;
 
 	if (p > fbmemlength)
 		return -ENOSPC;
@@ -428,7 +426,8 @@ static ssize_t arcfb_write(struct file *
 	return err;
 }
 
-int __init arcfb_setup(char *options)
+#ifndef MODULE
+static int __init arcfb_setup(char *options)
 {
 	char *this_opt;
 
@@ -462,6 +461,7 @@ int __init arcfb_setup(char *options)
 	}
 	return 0;
 }
+#endif
 
 static void arcfb_platform_release(struct device *device)
 {
@@ -507,7 +507,7 @@ static int __init arcfb_probe(struct dev
 
 	info->var = arcfb_var;
 	info->fix = arcfb_fix;
-	par = (struct arcfb_par *) info->par;
+	par = info->par;
 	par->info = info;
 	par->data_io_addr = data_io_addr;
 	par->ctl_io_addr = ctl_io_addr;
@@ -525,7 +525,7 @@ static int __init arcfb_probe(struct dev
 	       info->node, videomemorysize >> 10);
 
 	/* this inits the lcd but doesn't clear dirty pixels */
-	for (i=0; i < (arcfb_num_cols*arcfb_num_rows); i++) {
+	for (i = 0; i < arcfb_num_cols * arcfb_num_rows; i++) {
 		ks108_writeb_ctl(par, i, KS_DPY_OFF);
 		ks108_set_start_line(par, i, 0);
 		ks108_set_yaddr(par, i, 0);
@@ -535,7 +535,7 @@ static int __init arcfb_probe(struct dev
 
 	/* if we were told to splash the screen, we just clear it */
 	if (!nosplash) {
-		for (i=0; i < (arcfb_num_cols*arcfb_num_rows); i++) {
+		for (i = 0; i < arcfb_num_cols * arcfb_num_rows; i++) {
 			printk(KERN_INFO "fb%d: splashing lcd %d\n",
 				info->node, i);
 			ks108_set_start_line(par, i, 0);
@@ -578,7 +578,7 @@ static struct platform_device arcfb_devi
 	}
 };
 
-int __init arcfb_init(void)
+static int __init arcfb_init(void)
 {
 	int ret;
 
@@ -625,4 +625,3 @@ module_exit(arcfb_exit);
 MODULE_DESCRIPTION("fbdev driver for Arc monochrome LCD board");
 MODULE_AUTHOR("Jaya Kumar");
 MODULE_LICENSE("GPL");
-
_