DORMANTno replies

[PATCH] igafb: New framebuffer_alloc API and class_dev changes

From: Kronos <hidden>
Date: 2003-09-15 20:16:18

Hi,
this patch converts driver/video/igafb.c to framebuffer_alloc. It also
has some compilation fixes:

======== drivers/video/igafb.c 1.20 ========
D 1.20 03/09/12 00:06:04+02:00 kronos@kronoz.cjb.net 21 20 12/14/562
P drivers/video/igafb.c
C - remove useless static struct fb_info
C - switch to framebuffer_alloc
C - compilation fixes
------------------------------------------------

===== drivers/video/igafb.c 1.19 vs 1.20 =====
--- 1.19/drivers/video/igafb.c	Fri Aug 22 08:27:08 2003
+++ 1.20/drivers/video/igafb.c	Fri Sep 12 00:06:04 2003
@@ -66,12 +66,10 @@
 	unsigned long io_base;
 };
 
-struct fb_info fb_info;
-
 struct fb_fix_screeninfo igafb_fix __initdata = {
         .id		= "IGA 1682",
-	.type		= FB_TYPE_PACKED_PIXELS;
-	.mmio_len 	= 1000;
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.mmio_len 	= 1000,
 };
 
 struct fb_var_screeninfo default_var = {
@@ -300,17 +298,17 @@
 	if (regno < 16) {
 		switch (info->var.bits_per_pixel) {
 		case 16:
-			info->pseudo_palette[regno] = 
+			((u32 *)info->pseudo_palette)[regno] = 
 				(regno << 10) | (regno << 5) | regno;
 			break;
 		case 24:
-			info->pseudo_palette[regno] = 
+			((u32 *)info->pseudo_palette)[regno] = 
 				(regno << 16) | (regno << 8) | regno;
 		break;
 		case 32:
 			{ int i;
 			i = (regno << 8) | regno;
-			info->pseudo_palette[regno] = (i << 16) | i;
+			((u32 *)info->pseudo_palette)[regno] = (i << 16) | i;
 			}
 			break;
 		}
@@ -358,12 +356,13 @@
 
 	info->fbops = &igafb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
-	info->dev = &dev->dev;
 
-	fb_alloc_cmap(info->cmap, video_cmap_len, 0);
+	fb_alloc_cmap(&info->cmap, video_cmap_len, 0);
 
-	if (register_framebuffer(info) < 0)
+	if (register_framebuffer(info) < 0) {
+		kfree(info);
 		return 0;
+	}
 
 	printk("fb%d: %s frame buffer device at 0x%08lx [%dMB VRAM]\n",
 	       info->node, info->fix.id, 
@@ -400,16 +399,15 @@
 		iga2000 = 1;
 	}
 	
-	size = sizeof(struct fb_info) + sizeof(struct iga_par) + sizeof(u32)*16;
+	size = sizeof(struct iga_par) + sizeof(u32)*16;
 
-        info = kmalloc(size, GFP_ATOMIC);
+        info = framebuffer_alloc(size, &pdev->dev);
         if (!info) {
                 printk("igafb_init: can't alloc fb_info\n");
                 return -ENOMEM;
         }
-        memset(info, 0, size);
 
-	par = (struct iga_par *) (info + 1);
+	par = info->par;
 	
 
 	if ((addr = pdev->resource[0].start) == 0) {

Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
Do, or do not. There is no try.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help