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

* Re: [PATCH] Add sysfs class support for CAPI
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2004-04-09 17:16 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Karsten Keil, Linux Kernel Mailing List, Linux ISDN Mailing List

On Fri, Apr 09, 2004 at 03:22:05PM +0200, Marcel Holtmann wrote:
> 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.

Looks good, but isn't there also a /dev/capi20.00 and so on device nodes
needed by this driver?  According to devices.txt those are valid
nodes...

thanks,

greg k-h

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

* Re: [PATCH] Add sysfs class support for CAPI
  2004-04-09 17:16 ` Greg KH
@ 2004-04-09 18:13   ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2004-04-09 18:13 UTC (permalink / raw)
  To: Greg KH; +Cc: Karsten Keil, Linux Kernel Mailing List, Linux ISDN Mailing List

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.
> 
> Looks good, but isn't there also a /dev/capi20.00 and so on device nodes
> needed by this driver?  According to devices.txt those are valid
> nodes...

according to devices.txt - yes. But I didn't found any references in the
source code nor any application using it. The /dev/capi20 device is a
multiplexing interface and the others must be somekind of relict. Maybe
Karsten knows the full story ;)

Regards

Marcel



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

* Re: [PATCH] Add sysfs class support for CAPI
  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:32 ` Greg KH
  2004-04-10 20:16   ` Marcel Holtmann
  1 sibling, 1 reply; 6+ messages in thread
From: Greg KH @ 2004-04-09 18:32 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Karsten Keil, Linux Kernel Mailing List, Linux ISDN Mailing List

On Fri, Apr 09, 2004 at 03:22:05PM +0200, Marcel Holtmann wrote:
> 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.

Looks good, applied, thanks.

greg k-h

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

* Re: [PATCH] Add sysfs class support for CAPI
  2004-04-09 18:32 ` Greg KH
@ 2004-04-10 20:16   ` Marcel Holtmann
  2004-04-12 23:45     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Marcel Holtmann @ 2004-04-10 20:16 UTC (permalink / raw)
  To: Greg KH; +Cc: Karsten Keil, Linux Kernel Mailing List, Linux ISDN Mailing List

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

Hi Greg,

this patch fixes a bug in the CAPI TTY support, because the ->name value
of the TTY driver shouldn't contain a "/". After changing this there are
now a "capi20" TTY device and a "capi20" control device and so I renamed
the control device to "capi". The userspace visible part must be done by
udev and I added these two rules to restore the old namespace:

	# CAPI devices
	KERNEL="capi",          NAME="capi20", SYMLINK="isdn/capi20"
	KERNEL="capi*",         NAME="capi/%n"

Regards

Marcel


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

===== drivers/isdn/capi/capi.c 1.52 vs edited =====
--- 1.52/drivers/isdn/capi/capi.c	Sat Apr 10 22:04:37 2004
+++ edited/drivers/isdn/capi/capi.c	Sat Apr 10 22:06:20 2004
@@ -1316,7 +1316,8 @@
 
 	drv->owner = THIS_MODULE;
 	drv->driver_name = "capi_nc";
-	drv->name = "capi/";
+	drv->devfs_name = "capi/";
+	drv->name = "capi";
 	drv->major = capi_ttymajor;
 	drv->minor_start = 0;
 	drv->type = TTY_DRIVER_TYPE_SERIAL;
@@ -1492,7 +1493,7 @@
 		return PTR_ERR(capi_class);
 	}
 
-	class_simple_device_add(capi_class, MKDEV(capi_major, 0), NULL, "capi20");
+	class_simple_device_add(capi_class, MKDEV(capi_major, 0), NULL, "capi");
 	devfs_mk_cdev(MKDEV(capi_major, 0), S_IFCHR | S_IRUSR | S_IWUSR,
 			"isdn/capi20");
 

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

* Re: [PATCH] Add sysfs class support for CAPI
  2004-04-10 20:16   ` Marcel Holtmann
@ 2004-04-12 23:45     ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2004-04-12 23:45 UTC (permalink / raw)
  To: Marcel Holtmann
  Cc: Karsten Keil, Linux Kernel Mailing List, Linux ISDN Mailing List

On Sat, Apr 10, 2004 at 10:16:27PM +0200, Marcel Holtmann wrote:
> Hi Greg,
> 
> this patch fixes a bug in the CAPI TTY support, because the ->name value
> of the TTY driver shouldn't contain a "/". After changing this there are
> now a "capi20" TTY device and a "capi20" control device and so I renamed
> the control device to "capi". The userspace visible part must be done by
> udev and I added these two rules to restore the old namespace:
> 
> 	# CAPI devices
> 	KERNEL="capi",          NAME="capi20", SYMLINK="isdn/capi20"
> 	KERNEL="capi*",         NAME="capi/%n"

Looks good.  I've applied your patch, and modified the udev main rules
file to add these rules.

thanks again,

greg k-h

^ 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