public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Add sysfs class support for CAPI
@ 2004-04-09 13:22 Marcel Holtmann
  2004-04-09 17:16 ` Greg KH
  2004-04-09 18:32 ` Greg KH
  0 siblings, 2 replies; 6+ messages in thread
From: Marcel Holtmann @ 2004-04-09 13:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Karsten Keil
  Cc: Linux Kernel Mailing List, Linux ISDN Mailing List

[-- Attachment #1: Type: text/plain, Size: 151 bytes --]

Hi Greg,

here is a patch that adds class support to the ISDN CAPI module. Without
it udev won't create the /dev/capi20 device node.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1451 bytes --]

===== drivers/isdn/capi/capi.c 1.51 vs edited =====
--- 1.51/drivers/isdn/capi/capi.c	Mon Mar 29 16:25:54 2004
+++ edited/drivers/isdn/capi/capi.c	Fri Apr  9 00:00:37 2004
@@ -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 @@
 
 /* -------- driver information -------------------------------------- */
 
+static struct class_simple *capi_class;
+
 int capi_major = 68;		/* allocated */
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
 #define CAPINC_NR_PORTS	32
@@ -1483,11 +1486,20 @@
 		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;
 	}
@@ -1514,6 +1526,8 @@
 {
 	proc_exit();
 
+	class_simple_device_remove(MKDEV(capi_major, 0));
+	class_simple_destroy(capi_class);
 	unregister_chrdev(capi_major, "capi20");
 	devfs_remove("isdn/capi20");
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-04-12 23:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-04-09 13:22 [PATCH] Add sysfs class support for CAPI Marcel Holtmann
2004-04-09 17:16 ` Greg KH
2004-04-09 18:13   ` Marcel Holtmann
2004-04-09 18:32 ` Greg KH
2004-04-10 20:16   ` Marcel Holtmann
2004-04-12 23:45     ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox