[PATCH] neofb: New framebuffer_alloc API and class_dev changes

DORMANTno replies

From: Kronos <hidden>
Date: 2003-09-15 20:28:37

Hi,
this patch converts driver/video/neofb.c to framebuffer_alloc:

======== drivers/video/neofb.c 1.34 ========
D 1.34 03/09/13 23:59:03+02:00 kronos@kronoz.cjb.net 41 40 10/11/2303
P drivers/video/neofb.c
C switch to framebuffer_alloc
------------------------------------------------

===== drivers/video/neofb.c 1.33 vs 1.34 =====
--- 1.33/drivers/video/neofb.c	Fri Aug 22 08:27:08 2003
+++ 1.34/drivers/video/neofb.c	Sat Sep 13 23:59:03 2003
@@ -2001,15 +2001,12 @@
 	struct fb_info *info;
 	struct neofb_par *par;
 
-	info = kmalloc(sizeof(struct fb_info) + sizeof(struct neofb_par) + 
-		       sizeof(u32) * 17, GFP_KERNEL);
+	info = framebuffer_alloc(sizeof(struct neofb_par) + sizeof(u32) * 17, &dev->dev);
 
 	if (!info)
 		return NULL;
 
-	memset(info, 0, sizeof(struct fb_info) + sizeof(struct neofb_par) + sizeof(u32) * 17);
-
-	par = (struct neofb_par *) (info + 1);
+	par = info->par;
 
 	info->fix.accel = id->driver_data;
 
@@ -2059,9 +2056,8 @@
 
 	info->fbops = &neofb_ops;
 	info->flags = FBINFO_FLAG_DEFAULT;
-	info->par = par;
 	info->pseudo_palette = (void *) (par + 1);
-	info->dev = &dev->dev;
+	info->release = &release_neofb_par;
 
 	fb_alloc_cmap(&info->cmap, NR_PALETTE, 0);
 
@@ -2156,6 +2152,13 @@
 	return err;
 }
 
+static void release_neofb_par(struct fb_info *info) {
+	fb_alloc_cmap(&info->cmap, 0, 0);
+
+	neo_unmap_video(info);
+	neo_unmap_mmio(info);
+}
+
 static void __devexit neofb_remove(struct pci_dev *dev)
 {
 	struct fb_info *info = pci_get_drvdata(dev);
@@ -2171,10 +2174,6 @@
 		if (unregister_framebuffer(info))
 			printk(KERN_WARNING
 			       "neofb: danger danger!  Oopsen imminent!\n");
-
-		neo_unmap_video(info);
-		neo_unmap_mmio(info);
-		neo_free_fb_info(info);
 
 		/*
 		 * Ensure that the driver data is no longer

======== include/video/neomagic.h 1.6 ========
D 1.6 03/09/14 18:25:54+02:00 kronos@kronoz.cjb.net 7 6 4/0/206
P include/video/neomagic.h
C add prototype of release_neofb_par
------------------------------------------------

===== include/video/neomagic.h 1.5 vs 1.6 =====
--- 1.5/include/video/neomagic.h	Mon Aug 11 21:46:24 2003
+++ 1.6/include/video/neomagic.h	Sun Sep 14 18:25:54 2003
@@ -71,6 +71,8 @@
 
 #ifdef __KERNEL__
 
+#include <linux/fb.h>
+
 #ifdef NEOFB_DEBUG
 # define DBG(x)		printk (KERN_DEBUG "neofb: %s\n", (x));
 #else
@@ -202,5 +204,7 @@
 	int y_res;
 	int mode;
 } biosMode;
+
+static void release_neofb_par(struct fb_info *);
 
 #endif

Luca
-- 
Reply-To: kronos@kronoz.cjb.net
Home: http://kronoz.cjb.net
La differenza fra l'intelligenza e la stupidita`?
All'intelligenza c'e` un limite.


-------------------------------------------------------
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