linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Greg Kroah-Hartman <greg@kroah.com>, Karsten Keil <kkeil@suse.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux ISDN Mailing List <isdn4linux@listserv.isdn4linux.de>
Subject: [PATCH] Add sysfs class support for CAPI
Date: Fri, 09 Apr 2004 15:22:05 +0200	[thread overview]
Message-ID: <1081516925.13202.8.camel@pegasus> (raw)

[-- 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");
 

             reply	other threads:[~2004-04-09 13:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-09 13:22 Marcel Holtmann [this message]
2004-04-09 17:16 ` [PATCH] Add sysfs class support for CAPI 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

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=1081516925.13202.8.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=greg@kroah.com \
    --cc=isdn4linux@listserv.isdn4linux.de \
    --cc=kkeil@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).