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: <10820509121239@kroah.com> (raw)
In-Reply-To: <10820509124057@kroah.com>
ChangeSet 1.1643.36.12, 2004/04/08 14:45:41-07:00, hannal@us.ibm.com
[PATCH] add class support to dsp56k.c
Here is a patch that adds sysfs class support to /drivers/char/dsp56k.c
drivers/char/dsp56k.c | 27 +++++++++++++++++++++++++--
1 files changed, 25 insertions(+), 2 deletions(-)
diff -Nru a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
--- a/drivers/char/dsp56k.c Thu Apr 15 10:20:35 2004
+++ b/drivers/char/dsp56k.c Thu Apr 15 10:20:35 2004
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
+#include <linux/device.h>
#include <asm/atarihw.h>
#include <asm/traps.h>
@@ -149,6 +150,8 @@
int tx_wsize, rx_wsize;
} dsp56k;
+static struct class_simple *dsp56k_class;
+
static int dsp56k_reset(void)
{
u_char status;
@@ -502,6 +505,8 @@
static int __init dsp56k_init_driver(void)
{
+ int err = 0;
+
if(!MACH_IS_ATARI || !ATARIHW_PRESENT(DSP56K)) {
printk("DSP56k driver: Hardware not present\n");
return -ENODEV;
@@ -511,17 +516,35 @@
printk("DSP56k driver: Unable to register driver\n");
return -ENODEV;
}
+ dsp56k_class = class_simple_create(THIS_MODULE, "dsp56k");
+ if (IS_ERR(dsp56k_class)) {
+ err = PTR_ERR(dsp56k_class);
+ goto out_chrdev;
+ }
+ class_simple_device_add(dsp56k_class, MKDEV(DSP56K_MAJOR, 0), NULL, "dsp56k");
- devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
+ err = devfs_mk_cdev(MKDEV(DSP56K_MAJOR, 0),
S_IFCHR | S_IRUSR | S_IWUSR, "dsp56k");
+ if(err)
+ goto out_class;
printk(banner);
- return 0;
+ goto out;
+
+out_class:
+ class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
+ class_simple_destroy(dsp56k_class);
+out_chrdev:
+ unregister_chrdev(DSP56K_MAJOR, "dsp56k");
+out:
+ return err;
}
module_init(dsp56k_init_driver);
static void __exit dsp56k_cleanup_driver(void)
{
+ class_simple_device_remove(MKDEV(DSP56K_MAJOR, 0));
+ class_simple_destroy(dsp56k_class);
unregister_chrdev(DSP56K_MAJOR, "dsp56k");
devfs_remove("dsp56k");
}
next prev parent reply other threads:[~2004-04-15 18:18 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 [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
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=10820509121239@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.