From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core update for 2.6.6-rc1
Date: Thu, 15 Apr 2004 10:41:52 -0700 [thread overview]
Message-ID: <1082050912368@kroah.com> (raw)
In-Reply-To: <10820509122120@kroah.com>
ChangeSet 1.1643.36.7, 2004/03/22 11:47:06-08:00, kronos@kronoz.cjb.net
[PATCH] Sysfs for framebuffer
the following patch (against 2.6.5-rc2) teaches fb to use class_simple.
With this patch udev will automagically create device nodes for each
framebuffer registered. Once all drivers are converted to
framebuffer_{alloc,release} we can switch to our own class.
This is what sysfs dir looks like:
notebook:~# tree /sys/class/graphics/
/sys/class/graphics/
`-- fb0
`-- dev
drivers/video/fbmem.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
diff -Nru a/drivers/video/fbmem.c b/drivers/video/fbmem.c
--- a/drivers/video/fbmem.c Thu Apr 15 10:20:59 2004
+++ b/drivers/video/fbmem.c Thu Apr 15 10:20:59 2004
@@ -32,6 +32,9 @@
#include <linux/kmod.h>
#endif
#include <linux/devfs_fs_kernel.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/device.h>
#if defined(__mc68000__) || defined(CONFIG_APUS)
#include <asm/setup.h>
@@ -1251,6 +1254,8 @@
#endif
};
+static struct class_simple *fb_class;
+
/**
* register_framebuffer - registers a frame buffer device
* @fb_info: frame buffer info structure
@@ -1265,6 +1270,7 @@
register_framebuffer(struct fb_info *fb_info)
{
int i;
+ struct class_device *c;
if (num_registered_fb == FB_MAX)
return -ENXIO;
@@ -1273,6 +1279,12 @@
if (!registered_fb[i])
break;
fb_info->node = i;
+
+ c = class_simple_device_add(fb_class, MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
+ if (IS_ERR(c)) {
+ /* Not fatal */
+ printk(KERN_WARNING "Unable to create class_device for framebuffer %d; errno = %ld\n", i, PTR_ERR(c));
+ }
if (fb_info->pixmap.addr == NULL) {
fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL);
@@ -1338,6 +1350,7 @@
kfree(fb_info->sprite.addr);
registered_fb[i]=NULL;
num_registered_fb--;
+ class_simple_device_remove(MKDEV(FB_MAJOR, i));
return 0;
}
@@ -1398,6 +1411,12 @@
devfs_mk_dir("fb");
if (register_chrdev(FB_MAJOR,"fb",&fb_fops))
printk("unable to get major %d for fb devs\n", FB_MAJOR);
+
+ fb_class = class_simple_create(THIS_MODULE, "graphics");
+ if (IS_ERR(fb_class)) {
+ printk(KERN_WARNING "Unable to create fb class; errno = %ld\n", PTR_ERR(fb_class));
+ fb_class = NULL;
+ }
#ifdef CONFIG_FB_OF
if (ofonly) {
next prev parent reply other threads:[~2004-04-15 17:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-15 17:35 [BK PATCH] Driver Core update for 2.6.6-rc1 Greg KH
2004-04-15 17:41 ` [PATCH] " Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH [this message]
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
2004-04-15 17:41 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1082050912368@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox