Commit 78d35ef9 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Greg Kroah-Hartman

[PATCH] Add sysfs class support for CAPI

here is a patch that adds class support to the ISDN CAPI module. Without
it udev won't create the /dev/capi20 device node.
parent 1328cf26
......@@ -37,6 +37,7 @@
#include <linux/capi.h>
#include <linux/kernelcapi.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/isdn/capiutil.h>
#include <linux/isdn/capicmd.h>
......@@ -56,6 +57,8 @@ MODULE_LICENSE("GPL");
/* -------- driver information -------------------------------------- */
static struct class_simple *capi_class;
int capi_major = 68; /* allocated */
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
#define CAPINC_NR_PORTS 32
......@@ -1479,11 +1482,20 @@ static int __init capi_init(void)
return -EIO;
}
capi_class = class_simple_create(THIS_MODULE, "capi");
if (IS_ERR(capi_class)) {
unregister_chrdev(capi_major, "capi20");
return PTR_ERR(capi_class);
}
class_simple_device_add(capi_class, MKDEV(capi_major, 0), NULL, "capi20");
devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR,
"isdn/capi20");
#ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
if (capinc_tty_init() < 0) {
class_simple_device_remove(MKDEV(capi_major, 0));
class_simple_destroy(capi_class);
unregister_chrdev(capi_major, "capi20");
return -ENOMEM;
}
......@@ -1510,6 +1522,8 @@ static void __exit capi_exit(void)
{
proc_exit();
class_simple_device_remove(MKDEV(capi_major, 0));
class_simple_destroy(capi_class);
unregister_chrdev(capi_major, "capi20");
devfs_remove("isdn/capi20");
......
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