Commit 3efbacde authored by Hanna V. Linder's avatar Hanna V. Linder Committed by Greg Kroah-Hartman

[PATCH] added class support to stallion.c

Here is a patch to add class support to the Stallion multiport
serial driver.
parent 17e8ea40
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/devfs_fs_kernel.h> #include <linux/devfs_fs_kernel.h>
#include <linux/device.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -732,6 +733,8 @@ static struct file_operations stl_fsiomem = { ...@@ -732,6 +733,8 @@ static struct file_operations stl_fsiomem = {
/*****************************************************************************/ /*****************************************************************************/
static struct class_simple *stallion_class;
#ifdef MODULE #ifdef MODULE
/* /*
...@@ -788,12 +791,15 @@ static void __exit stallion_module_exit(void) ...@@ -788,12 +791,15 @@ static void __exit stallion_module_exit(void)
restore_flags(flags); restore_flags(flags);
return; return;
} }
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++) {
devfs_remove("staliomem/%d", i); devfs_remove("staliomem/%d", i);
class_simple_device_remove(MKDEV(STL_SIOMEMMAJOR, i));
}
devfs_remove("staliomem"); devfs_remove("staliomem");
if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem"))) if ((i = unregister_chrdev(STL_SIOMEMMAJOR, "staliomem")))
printk("STALLION: failed to un-register serial memory device, " printk("STALLION: failed to un-register serial memory device, "
"errno=%d\n", -i); "errno=%d\n", -i);
class_simple_destroy(stallion_class);
if (stl_tmpwritebuf != (char *) NULL) if (stl_tmpwritebuf != (char *) NULL)
kfree(stl_tmpwritebuf); kfree(stl_tmpwritebuf);
...@@ -3181,10 +3187,12 @@ int __init stl_init(void) ...@@ -3181,10 +3187,12 @@ int __init stl_init(void)
printk("STALLION: failed to register serial board device\n"); printk("STALLION: failed to register serial board device\n");
devfs_mk_dir("staliomem"); devfs_mk_dir("staliomem");
stallion_class = class_simple_create(THIS_MODULE, "staliomem");
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i), devfs_mk_cdev(MKDEV(STL_SIOMEMMAJOR, i),
S_IFCHR|S_IRUSR|S_IWUSR, S_IFCHR|S_IRUSR|S_IWUSR,
"staliomem/%d", i); "staliomem/%d", i);
class_simple_device_add(stallion_class, MKDEV(STL_SIOMEMMAJOR, i), NULL, "staliomem/%d", i);
} }
stl_serial->owner = THIS_MODULE; stl_serial->owner = THIS_MODULE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment