patch-2.3.46 linux/drivers/video/fbmem.c

Next file: linux/drivers/video/matroxfb.c
Previous file: linux/drivers/video/cgsixfb.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/video/fbmem.c linux/drivers/video/fbmem.c
@@ -25,6 +25,7 @@
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
 #endif
+#include <linux/devfs_fs_kernel.h>
 
 #if defined(__mc68000__) || defined(CONFIG_APUS)
 #include <asm/setup.h>
@@ -567,10 +568,13 @@
 	release:	fb_release,
 };
 
+static devfs_handle_t devfs_handle = NULL;
+
 int
 register_framebuffer(struct fb_info *fb_info)
 {
 	int i, j;
+	char name_buf[8];
 	static int fb_ever_opened[FB_MAX];
 	static int first = 1;
 
@@ -597,12 +601,17 @@
 		first = 0;
 		take_over_console(&fb_con, first_fb_vc, last_fb_vc, fbcon_is_default);
 	}
+	sprintf (name_buf, "%d", i);
+	fb_info->devfs_handle =
+	    devfs_register (devfs_handle, name_buf, 0, DEVFS_FL_NONE,
+			    FB_MAJOR, i, S_IFCHR | S_IRUGO | S_IWUGO, 0, 0,
+			    &fb_fops, NULL);
 
 	return 0;
 }
 
 int
-unregister_framebuffer(const struct fb_info *fb_info)
+unregister_framebuffer(struct fb_info *fb_info)
 {
 	int i, j;
 
@@ -611,7 +620,11 @@
 		if (con2fb_map[j] == i)
 			return -EBUSY;
 	if (!registered_fb[i])
-		return -EINVAL; 
+		return -EINVAL;
+	devfs_unregister (fb_info->devfs_handle);
+	fb_info->devfs_handle = NULL;
+	devfs_unregister (fb_info->devfs_lhandle);
+	fb_info->devfs_lhandle = NULL;
 	registered_fb[i]=NULL;
 	num_registered_fb--;
 	return 0;
@@ -624,7 +637,8 @@
 
 	create_proc_read_entry("fb", 0, 0, fbmem_read_proc, NULL);
 
-	if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
+	devfs_handle = devfs_mk_dir (NULL, "fb", 0, NULL);
+	if (devfs_register_chrdev(FB_MAJOR,"fb",&fb_fops))
 		printk("unable to get major %d for fb devs\n", FB_MAJOR);
 
 	/*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)