[PATCH] framebuffer devfs support (umm redone..)

Mark 'segfault' Guzman (segfault@ntplx.com)
Wed, 29 Jul 1998 23:07:26 -0400


--RnlQjJ0d97Da+TV1
Content-Type: text/plain; charset=us-ascii

Welp i went back and noticed my stupidity (thanks to many emails notifying me of it)
now the code is in fbmem.c only. I changed it to make only numerical entries in /dev/fb
and link them as fb<device number> in /dev. It also now only creates entries for the devices
you have. Works perfectly on my box. If anybody has any complaints, suggestions, objections
tell me. If something seems wrong, it probably is so tell me.
Sincerely,
Mark Guzman

--RnlQjJ0d97Da+TV1
Content-Type: text/plain; charset=us-ascii
Content-Description: Framebuffer Devfs patch
Content-Disposition: attachment; filename="fbdevfs.patch"

--- /mnt/src/linux/drivers/char/fbmem.c Wed Jul 29 17:37:05 1998
+++ drivers/char/fbmem.c Wed Jul 29 17:26:43 1998
@@ -28,6 +28,9 @@
#ifdef CONFIG_KMOD
#include <linux/kmod.h>
#endif
+#ifdef CONFIG_DEVFS_FS
+#include <linux/devfs_fs.h>
+#endif /*CONFIG_DEVFS_FS*/

#ifdef __mc68000__
#include <asm/setup.h>
@@ -478,7 +481,7 @@
int i, j;
static int fb_ever_opened[FB_MAX];
static int first = 1;
-
+
if (num_registered_fb == FB_MAX)
return -ENXIO;
num_registered_fb++;
@@ -500,9 +503,9 @@

if (first) {
first = 0;
- take_over_console(&fb_con, 12, MAX_NR_CONSOLES-1, 1);
+ take_over_console(&fb_con, 0, MAX_NR_CONSOLES-1, 1);
}
-
+
return 0;
}

@@ -526,6 +529,44 @@
static struct proc_dir_entry *proc_fbmem;
#endif

+/* segfault - July 28 1998 - framebuffer devfs support */
+/* `- added this to make it work right w/ devfs */
+#ifdef CONFIG_DEVFS_FS
+#define FB_MINOR 0
+#define DEVFS_FB_DIRECTORY "fb"
+char *
+framebuffer_make_lnkname(char *buf, char *name, int idx) {
+ sprintf(buf, "%s%d", name, idx);
+ return buf;
+}
+char *
+framebuffer_make_name(char *buf, int idx) {
+ sprintf(buf, DEVFS_FB_DIRECTORY "/" "%d", idx);
+ return buf;
+}
+/* Register framebuffer entries */
+void
+framebuffer_register_devfs(void)
+{
+ char name_buf[32];
+ char lnk_buf[32];
+ int j;
+
+ for (j=0; j<num_registered_fb || j==0; j++) {
+ framebuffer_make_name(name_buf, j); /* create the actual chardev name*/
+ devfs_register(name_buf, 0, DEVFS_FL_TOLERANT,
+ FB_MAJOR, FB_MINOR+(j*0x20),
+ S_IFCHR | S_IRUGO | S_IWUGO, 0, 0, &fb_fops, NULL);
+ framebuffer_make_lnkname(lnk_buf, "fb", j); /* create the symlnk name*/
+ devfs_mk_symlink(NULL, lnk_buf, 0,
+ DEVFS_FL_TOLERANT,
+ name_buf, 0, NULL);
+ }
+}
+#endif /*CONFIG_DEVFS_FS*/
+/* segfault - July 28 1998 - framebuffer support for devfs*/
+
+
__initfunc(void
fbmem_init(void))
{
@@ -537,6 +578,7 @@
proc_fbmem->read_proc = fbmem_read_proc;
#endif

+ framebuffer_register_devfs(); /*register all the fb devices*/
if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
printk("unable to get major %d for fb devs\n", FB_MAJOR);

@@ -651,3 +693,4 @@

EXPORT_SYMBOL(register_framebuffer);
EXPORT_SYMBOL(unregister_framebuffer);
+EXPORT_SYMBOL(framebuffer_register_devfs);

--RnlQjJ0d97Da+TV1--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html