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:53 -0700 [thread overview]
Message-ID: <1082050913417@kroah.com> (raw)
In-Reply-To: <10820509121239@kroah.com>
ChangeSet 1.1643.36.13, 2004/04/08 14:53:05-07:00, hannal@us.ibm.com
[PATCH] Add sysfs class support to fs/coda/psdev.c
Here is a patch to add class support to psdev.c.
I have verified it compiles and works.
fs/coda/psdev.c | 36 +++++++++++++++++++++++++++++++-----
1 files changed, 31 insertions(+), 5 deletions(-)
diff -Nru a/fs/coda/psdev.c b/fs/coda/psdev.c
--- a/fs/coda/psdev.c Thu Apr 15 10:20:31 2004
+++ b/fs/coda/psdev.c Thu Apr 15 10:20:31 2004
@@ -37,6 +37,7 @@
#include <linux/init.h>
#include <linux/list.h>
#include <linux/smp_lock.h>
+#include <linux/device.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/poll.h>
@@ -61,6 +62,7 @@
struct venus_comm coda_comms[MAX_CODADEVS];
+static struct class_simple coda_psdev_class;
/*
* Device operations
@@ -358,20 +360,38 @@
static int init_coda_psdev(void)
{
- int i;
+ int i, err = 0;
if (register_chrdev(CODA_PSDEV_MAJOR,"coda_psdev",
&coda_psdev_fops)) {
printk(KERN_ERR "coda_psdev: unable to get major %d\n",
CODA_PSDEV_MAJOR);
return -EIO;
}
+ coda_psdev_class = class_simple_create(THIS_MODULE, "coda_psdev");
+ if (IS_ERR(coda_psdev_class)) {
+ err = PTR_ERR(coda_psdev_class);
+ goto out_chrdev;
+ }
devfs_mk_dir ("coda");
for (i = 0; i < MAX_CODADEVS; i++) {
- devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i),
+ class_simple_device_add(coda_psdev_class, MKDEV(CODA_PSDEV_MAJOR,i),
+ NULL, "cfs%d", i);
+ err = devfs_mk_cdev(MKDEV(CODA_PSDEV_MAJOR, i),
S_IFCHR|S_IRUSR|S_IWUSR, "coda/%d", i);
+ if (err)
+ goto out_class;
}
coda_sysctl_init();
- return 0;
+ goto out;
+
+out_class:
+ for (i = 0; i < MAX_CODADEVS; i++)
+ class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i));
+ class_simple_destroy(coda_psdev_class);
+out_chrdev:
+ unregister_chrdev(CODA_PSDEV_MAJOR, "coda_psdev");
+out:
+ return err;
}
@@ -408,8 +428,11 @@
}
return 0;
out:
- for (i = 0; i < MAX_CODADEVS; i++)
+ for (i = 0; i < MAX_CODADEVS; i++) {
+ class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i));
devfs_remove("coda/%d", i);
+ }
+ class_simple_destroy(coda_psdev_class);
devfs_remove("coda");
unregister_chrdev(CODA_PSDEV_MAJOR,"coda_psdev");
coda_sysctl_clean();
@@ -427,8 +450,11 @@
if ( err != 0 ) {
printk("coda: failed to unregister filesystem\n");
}
- for (i = 0; i < MAX_CODADEVS; i++)
+ for (i = 0; i < MAX_CODADEVS; i++) {
+ class_simple_device_remove(MKDEV(CODA_PSDEV_MAJOR, i));
devfs_remove("coda/%d", i);
+ }
+ class_simple_destroy(coda_psdev_class);
devfs_remove("coda");
unregister_chrdev(CODA_PSDEV_MAJOR, "coda_psdev");
coda_sysctl_clean();
next prev parent reply other threads:[~2004-04-15 17:47 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
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
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=1082050913417@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