linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* i810fb: trivial fixes and cleanups
@ 2003-01-02 13:35 Antonino Daplas
  2003-01-06 21:52 ` James Simmons
  0 siblings, 1 reply; 2+ messages in thread
From: Antonino Daplas @ 2003-01-02 13:35 UTC (permalink / raw)
  To: Linux Fbdev development list

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

Attached is a diff against linux-2.5.54.

1. i810fb_par should be built inf fb_set_par() instead of
fb_check_var().
2. changed __devinit*/__devexit* to __init/__exit.
3. removed unused/redundant variables

Tony 



[-- Attachment #2: i810fb.diff --]
[-- Type: text/x-patch, Size: 13076 bytes --]

diff -Naur linux-2.5.54/drivers/video/i810/i810.h linux/drivers/video/i810/i810.h
--- linux-2.5.54/drivers/video/i810/i810.h	2003-01-02 13:13:46.000000000 +0000
+++ linux/drivers/video/i810/i810.h	2003-01-02 13:13:18.000000000 +0000
@@ -212,9 +212,7 @@
 
 struct gtt_data {
 	agp_memory *i810_fb_memory;
-	agp_memory *i810_iring_memory;
 	agp_memory *i810_cursor_memory;
-	agp_memory *i810_pixmap_memory;
 };
 
 struct mode_registers {
diff -Naur linux-2.5.54/drivers/video/i810/i810_accel.c linux/drivers/video/i810/i810_accel.c
--- linux-2.5.54/drivers/video/i810/i810_accel.c	2003-01-02 13:13:46.000000000 +0000
+++ linux/drivers/video/i810/i810_accel.c	2003-01-02 13:13:16.000000000 +0000
@@ -27,7 +27,6 @@
 }                                                                      
 
 extern inline void flush_cache(void);
-extern int reinit_agp(struct fb_info *info);
 
 /************************************************************/
 
@@ -343,7 +342,7 @@
 	dy = rect->dy;
 	height = rect->height;
 
-	dest = p->fix.smem_start +  (dy * p->fix.line_length) + dx;
+	dest = p->fix.smem_start + (dy * p->fix.line_length) + dx;
 	color_blit(width, height, p->fix.line_length, dest, rop, color, 
 		   par->blit_bpp, par);
 }
@@ -394,11 +393,6 @@
 			 PAT_COPY_ROP, par->blit_bpp, par);
 }
 
-/*
- * Blitting is done at 8x8 pixel-array at a time.  If map is not 
- * monochrome or not a multiple of 8x8 pixels, cfb_imageblit will
- * be called instead.  
- */
 void i810fb_imageblit(struct fb_info *p, struct fb_image *image)
 {
 	struct i810fb_par *par = (struct i810fb_par *) p->par;
@@ -422,9 +416,6 @@
 		bg = image->bg_color;
 		break;
 	case 16:
-		fg = ((u32 *)(p->pseudo_palette))[image->fg_color];
-		bg = ((u32 *)(p->pseudo_palette))[image->bg_color];
-		break;
 	case 24:
 		fg = ((u32 *)(p->pseudo_palette))[image->fg_color];
 		bg = ((u32 *)(p->pseudo_palette))[image->bg_color];
diff -Naur linux-2.5.54/drivers/video/i810/i810_dvt.c linux/drivers/video/i810/i810_dvt.c
--- linux-2.5.54/drivers/video/i810/i810_dvt.c	2003-01-02 13:13:46.000000000 +0000
+++ linux/drivers/video/i810/i810_dvt.c	2003-01-02 13:13:16.000000000 +0000
@@ -218,7 +218,7 @@
 	u32 diff = 0, diff_best = 0xFFFFFFFF, i = 0, i_best = 0; 
 	u8 hfl;
 
-	hfl =  (u8) ((xres >> 3) - 1);
+	hfl = (u8) ((xres >> 3) - 1);
 	for (i = 0; i < ARRAY_SIZE(std_modes); i++) { 
 		if (std_modes[i].cr01 == hfl) { 
 			if (std_modes[i].pixclock <= par->regs.pixclock)
diff -Naur linux-2.5.54/drivers/video/i810/i810_main.c linux/drivers/video/i810/i810_main.c
--- linux-2.5.54/drivers/video/i810/i810_main.c	2003-01-02 13:13:46.000000000 +0000
+++ linux/drivers/video/i810/i810_main.c	2003-01-02 13:13:16.000000000 +0000
@@ -1221,7 +1221,7 @@
 
     	memset(fix, 0, sizeof(struct fb_fix_screeninfo));
 
-    	strcpy(fix->id, i810fb_name);
+    	strcpy(fix->id, "I810");
     	fix->smem_start = par->fb.physical;
     	fix->smem_len = par->fb.size;
     	fix->type = FB_TYPE_PACKED_PIXELS;
@@ -1519,15 +1519,9 @@
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	u32 total;
 	u8 *mmio = par->mmio_start_virtual;
-	int xoffset = var->xoffset, yoffset = var->yoffset;
 	
-	if (xoffset < 0 ||
-	    xoffset+var->xres > var->xres_virtual ||
-	    yoffset < 0 ||
-	    yoffset+var->yres > var->yres_virtual) 
-		return -EINVAL;
-
-	total = xoffset * par->depth + yoffset * info->fix.line_length;
+	total = var->xoffset * par->depth + 
+		var->yoffset * info->fix.line_length;
 	i810_writel(DPLYBASE, mmio, par->fb.physical + total);
 
 	return 0;
@@ -1575,6 +1569,7 @@
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 
+	decode_var(&info->var, par, info);
 	i810_load_regs(par);
 	i810_init_cursor(par);
 	par->cursor_reset = 1;
@@ -1586,7 +1581,6 @@
 static int i810fb_check_var(struct fb_var_screeninfo *var, 
 			    struct fb_info *info)
 {
-	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	int err;
 
 	if (IS_DVT) {
@@ -1604,7 +1598,6 @@
 
 	i810fb_fill_var_timings(var);
 	set_color_bitfields(var);
-	decode_var(&info->var, par, info);
 	return 0;
 }
 
@@ -1699,13 +1692,14 @@
     .fb_copyarea =       i810fb_copyarea,
     .fb_imageblit =      i810fb_imageblit,
     .fb_cursor =         i810fb_cursor,
+    .fb_sync =           i810fb_sync,
 };
 
 /***********************************************************************
  *                  AGP resource allocation                            *
  ***********************************************************************/
   
-static void __devinit i810_fix_pointers(struct i810fb_par *par)
+static void __init i810_fix_pointers(struct i810fb_par *par)
 {
       	par->fb.physical = par->aperture.physical+(par->fb.offset << 12);
 	par->fb.virtual = par->aperture.virtual+(par->fb.offset << 12);
@@ -1721,7 +1715,7 @@
 		(par->pixmap.offset << 12);
 }
 
-static void __devinit i810_fix_offsets(struct i810fb_par *par)
+static void __init i810_fix_offsets(struct i810fb_par *par)
 {
 	if (vram + 1 > par->aperture.size >> 20)
 		vram = (par->aperture.size >> 20) - 1;
@@ -1744,7 +1738,7 @@
 	par->cursor_heap.size = 4096;
 }
 
-static int __devinit i810_alloc_agp_mem(struct fb_info *info)
+static int __init i810_alloc_agp_mem(struct fb_info *info)
 {
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
 	int size;
@@ -1809,7 +1803,7 @@
  * Sets the the user monitor's horizontal and vertical
  * frequency limits
  */
-static void __devinit i810_init_monspecs(struct fb_info *info)
+static void __init i810_init_monspecs(struct fb_info *info)
 {
 	if (!hsync1)
 		hsync1 = HFMIN;
@@ -1837,8 +1831,8 @@
  * @par: pointer to i810fb_par structure
  * @info: pointer to current fb_info structure
  */
-static void __devinit i810_init_defaults(struct i810fb_par *par, 
-					 struct fb_info *info)
+static void __init i810_init_defaults(struct i810fb_par *par, 
+				      struct fb_info *info)
 {
 	if (voffset) {
 		v_offset_default = voffset;
@@ -1866,16 +1860,16 @@
 		vyres = (vram << 20)/(xres*bpp >> 3);
 
 	par->i810fb_ops = i810fb_ops;
-	i810fb_default.xres = xres;
-	i810fb_default.yres = yres;
-	i810fb_default.yres_virtual = vyres;
-	i810fb_default.bits_per_pixel = bpp;
+	info->var.xres = xres;
+	info->var.yres = yres;
+	info->var.yres_virtual = vyres;
+	info->var.bits_per_pixel = bpp;
 	
 	if (dcolor)
-		i810fb_default.nonstd = 1;
+		info->var.nonstd = 1;
 
 	if (par->dev_flags & HAS_ACCELERATION) 
-		i810fb_default.accel_flags = 1;
+		info->var.accel_flags = 1;
 
 	i810_init_monspecs(info);
 }
@@ -1884,7 +1878,7 @@
  * i810_init_device - initialize device
  * @par: pointer to i810fb_par structure
  */
-static void __devinit i810_init_device(struct i810fb_par *par)
+static void __init i810_init_device(struct i810fb_par *par)
 {
 	u8 reg, *mmio = par->mmio_start_virtual;
 
@@ -1905,7 +1899,7 @@
 	i810fb_init_ringbuffer(par);
 }
 
-static int __devinit 
+static int __init 
 i810_allocate_pci_resource(struct i810fb_par *par, 
 			   const struct pci_device_id *entry)
 {
@@ -2014,7 +2008,7 @@
 	return 0;
 }
 
-static int __devinit i810fb_init_pci (struct pci_dev *dev, 
+static int __init i810fb_init_pci (struct pci_dev *dev, 
 				      const struct pci_device_id *entry)
 {
 	struct fb_info    *info;
@@ -2061,7 +2055,6 @@
 	
 	fb_alloc_cmap(&info->cmap, 256, 0);
 
-	info->var = i810fb_default;
 	if ((err = info->fbops->fb_check_var(&info->var, info))) {
 		i810fb_release_resource(info, par);
 		return err;
@@ -2082,6 +2075,7 @@
 			  info->var.hsync_len + info->var.right_margin);
 	vfreq = hfreq/(info->var.yres + info->var.upper_margin +
 		       info->var.vsync_len + info->var.lower_margin);
+
       	printk("fb: %s v%d.%d.%d%s, Tony Daplas\n"
       	       "     Video RAM      : %dK\n" 
 	       "     Mode           : %dx%d-%dbpp@%dHz\n"
@@ -2098,7 +2092,6 @@
 	       (ext_vga) ? "en" : "dis", (IS_DVT) ? 
 	       "Intel(R) DVT" : "VESA GTF (US)");
 
-	
 	return 0;
 }
 
@@ -2144,7 +2137,7 @@
 		kfree(info);
 }
 
-static void __devexit i810fb_remove_pci(struct pci_dev *dev)
+static void __exit i810fb_remove_pci(struct pci_dev *dev)
 {
 	struct fb_info *info = pci_get_drvdata(dev);
 	struct i810fb_par *par = (struct i810fb_par *) info->par;
diff -Naur linux-2.5.54/drivers/video/i810/i810_main.h linux/drivers/video/i810/i810_main.h
--- linux-2.5.54/drivers/video/i810/i810_main.h	2003-01-02 13:13:46.000000000 +0000
+++ linux/drivers/video/i810/i810_main.h	2003-01-02 13:13:18.000000000 +0000
@@ -14,9 +14,8 @@
 #ifndef __I810_MAIN_H__
 #define __I810_MAIN_H__
 
-
 /* PCI */
-static const char *i810_pci_list[] __devinitdata = {
+static const char *i810_pci_list[] __initdata = {
 	"Intel(R) 810 Framebuffer Device"                                 ,
 	"Intel(R) 810-DC100 Framebuffer Device"                           ,
 	"Intel(R) 810E Framebuffer Device"                                ,
@@ -25,7 +24,7 @@
 	"Intel(R) 815 (Internal Graphics with AGP) Framebuffer Device"  
 };
 
-static struct pci_device_id i810fb_pci_tbl[] __devinitdata = {
+static struct pci_device_id i810fb_pci_tbl[] __initdata = {
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810_IG1, 
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 
 	{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82810_IG3,
@@ -41,64 +40,32 @@
 	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 5 }
 };	  
 	             
-static int  __devinit i810fb_init_pci (struct pci_dev *dev, 
+static int  __init i810fb_init_pci (struct pci_dev *dev, 
 				       const struct pci_device_id *entry);
-static void __devexit i810fb_remove_pci(struct pci_dev *dev);
+static void __exit i810fb_remove_pci(struct pci_dev *dev);
 
 static struct pci_driver i810fb_driver = {
 	.name     =	"i810fb",
 	.id_table =	i810fb_pci_tbl,
 	.probe    =	i810fb_init_pci,
-	.remove   =	__devexit_p(i810fb_remove_pci),
+	.remove   =	__exit_p(i810fb_remove_pci),
 };	
 
-static int i810_init  __devinitdata = 0;
-static int vram       __devinitdata = 4;
-static int bpp        __devinitdata = 8;
-static int mtrr       __devinitdata = 0;
-static int accel      __devinitdata = 0;
-static int hsync1     __devinitdata = 0;
-static int hsync2     __devinitdata = 0;
-static int vsync1     __devinitdata = 0;
-static int vsync2     __devinitdata = 0;
-static int xres       __devinitdata = 640;
-static int yres       __devinitdata = 480;
-static int vyres      __devinitdata = 0;
-static int sync       __devinitdata = 0;
-static int ext_vga    __devinitdata = 0;
-static int dcolor     __devinitdata = 0;
-
-/* "use once" vars */
-static char i810fb_name[16]  = "i810fb";
-static struct fb_var_screeninfo i810fb_default __devinitdata = {
-	/* 640x480, 8 bpp */
-	.xres           = 640, 
-	.yres           = 480, 
-	.xres_virtual   = 640, 
-	.yres_virtual   = 480,
-	.xoffset        = 0, 
-	.yoffset        = 0, 
-	.bits_per_pixel = 8, 
-	.grayscale      = 0,
-	.red            = {0, 8, 0}, 
-	.green          = {0, 8, 0}, 
-	.blue           = {0, 8, 0}, 
-	.transp         = {0, 0, 0},
-	.nonstd         = 0, 
-	.activate       = 0, 
-	.height         = -1, 
-	.width          = -1, 
-	.accel_flags    = 0, 
-	.pixclock       = 20000, 
-	.left_margin    = 64, 
-	.right_margin   = 64, 
-	.upper_margin   = 32, 
-	.lower_margin   = 32, 
-	.hsync_len      = 64, 
-	.vsync_len      = 2,
-	.sync           = 0, 
-	.vmode          = FB_VMODE_NONINTERLACED
-};
+static int i810_init  __initdata = 0;
+static int vram       __initdata = 4;
+static int bpp        __initdata = 8;
+static int mtrr       __initdata = 0;
+static int accel      __initdata = 0;
+static int hsync1     __initdata = 0;
+static int hsync2     __initdata = 0;
+static int vsync1     __initdata = 0;
+static int vsync2     __initdata = 0;
+static int xres       __initdata = 640;
+static int yres       __initdata = 480;
+static int vyres      __initdata = 0;
+static int sync       __initdata = 0;
+static int ext_vga    __initdata = 0;
+static int dcolor     __initdata = 0;
 
 /*
  * voffset - framebuffer offset in MiB from aperture start address.  In order for
@@ -124,8 +91,8 @@
  * 
  * Experiment with v_offset to find out which works best for you.
  */
-static u32 v_offset_default __devinitdata; /* For 32 MiB Aper size, 8 should be the default */
-static u32 voffset          __devinitdata = 0;
+static u32 v_offset_default __initdata; /* For 32 MiB Aper size, 8 should be the default */
+static u32 voffset          __initdata = 0;
 
 static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor);
 
@@ -173,7 +140,7 @@
 
 #ifdef CONFIG_MTRR
 #define KERNEL_HAS_MTRR 1
-static inline void __devinit set_mtrr(struct i810fb_par *par)
+static inline void __init set_mtrr(struct i810fb_par *par)
 {
 	par->mtrr_reg = mtrr_add((u32) par->aperture.physical, 
 		 par->aperture.size, MTRR_TYPE_WRCOMB, 1);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-06 21:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-02 13:35 i810fb: trivial fixes and cleanups Antonino Daplas
2003-01-06 21:52 ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).