[svn-commits] rmudgett: mISDN/trunk r107 - /mISDN/trunk/drivers/isdn/hardware/mISDN/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon May 11 12:56:21 CDT 2009


Author: rmudgett
Date: Mon May 11 12:56:17 2009
New Revision: 107

URL: http://svn.asterisk.org/svn-view/thirdparty?view=rev&rev=107
Log:
mISDN unload causes a kernel panic when using kernel 2.6.29.1

Patch supplied by customer.

JIRA ABE-1839

Modified:
    mISDN/trunk/drivers/isdn/hardware/mISDN/core.c
    mISDN/trunk/drivers/isdn/hardware/mISDN/hfc_multi.c
    mISDN/trunk/drivers/isdn/hardware/mISDN/stack.c
    mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_inst.c
    mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_obj.c

Modified: mISDN/trunk/drivers/isdn/hardware/mISDN/core.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDN/trunk/drivers/isdn/hardware/mISDN/core.c?view=diff&rev=107&r1=106&r2=107
==============================================================================
--- mISDN/trunk/drivers/isdn/hardware/mISDN/core.c (original)
+++ mISDN/trunk/drivers/isdn/hardware/mISDN/core.c Mon May 11 12:56:17 2009
@@ -724,7 +724,6 @@
 			obj->id);
 	if (core_debug & DEBUG_CORE_FUNC)
 		printk(KERN_DEBUG "mISDN_register: obj(%p)\n", obj);
-#ifndef SYSFS_SUPPORT_2_6_24
 	retval = mISDN_register_sysfs_obj(obj);
 	if (retval) {
 		printk(KERN_ERR "mISDN_register class_device_register return(%d)\n", retval);
@@ -732,7 +731,6 @@
 		list_del(&obj->list);
 		write_unlock_irqrestore(&mISDN_objects_lock, flags);
 	}
-#endif
 	return(retval);
 }
 

Modified: mISDN/trunk/drivers/isdn/hardware/mISDN/hfc_multi.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDN/trunk/drivers/isdn/hardware/mISDN/hfc_multi.c?view=diff&rev=107&r1=106&r2=107
==============================================================================
--- mISDN/trunk/drivers/isdn/hardware/mISDN/hfc_multi.c (original)
+++ mISDN/trunk/drivers/isdn/hardware/mISDN/hfc_multi.c Mon May 11 12:56:17 2009
@@ -3700,7 +3700,7 @@
 
 
 	for (i=0;i<32;i++) {
-		if (hc->chan[i].ch && test_bit(FLG_DCHANNEL, &hc->chan[i].ch->Flags)  &&
+		if (hc->chan[i].port == port && hc->chan[i].ch && test_bit(FLG_DCHANNEL, &hc->chan[i].ch->Flags)  &&
 		    hc->chan[i].ch->timer.function != NULL ) {
 			del_timer(&hc->chan[i].ch->timer);
 			hc->chan[i].ch->timer.function = NULL;
@@ -3710,7 +3710,7 @@
 	/* free channels */
 	i = 0;
 	while(i < 32) {
-		if (hc->chan[i].ch) {
+		if (hc->chan[i].port == port && hc->chan[i].ch) {
 			if (debug & DEBUG_HFCMULTI_INIT)
 				printk(KERN_DEBUG "%s: free port %d %c-channel %d (1..32)\n",
 				       __FUNCTION__, hc->chan[i].port,
@@ -3812,6 +3812,8 @@
 		case MGR_RELEASE | INDICATION:
 		if (debug & DEBUG_HFCMULTI_MGR)
 			printk(KERN_DEBUG "%s: MGR_RELEASE = remove port from mISDN\n", __FUNCTION__);
+		if (test_bit(FLG_DCHANNEL, &chan->Flags))
+			release_port(hc, hc->chan[i].port);
 		break;
 #ifdef FIXME
 		case MGR_CONNECT | REQUEST:

Modified: mISDN/trunk/drivers/isdn/hardware/mISDN/stack.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDN/trunk/drivers/isdn/hardware/mISDN/stack.c?view=diff&rev=107&r1=106&r2=107
==============================================================================
--- mISDN/trunk/drivers/isdn/hardware/mISDN/stack.c (original)
+++ mISDN/trunk/drivers/isdn/hardware/mISDN/stack.c Mon May 11 12:56:17 2009
@@ -654,9 +654,7 @@
 new_stack(mISDNstack_t *master, mISDNinstance_t *inst)
 {
 	mISDNstack_t	*newst;
-#ifndef SYSFS_SUPPORT_2_6_24
 	int		err;
-#endif
 	u_long		flags;
 
 	if (core_debug & DEBUG_CORE_FUNC)
@@ -699,13 +697,11 @@
 	if (inst) {
 		inst->st = newst;
 	}
-#ifndef SYSFS_SUPPORT_2_6_24
 	err = mISDN_register_sysfs_stack(newst);
 	if (err) {
 		// FIXME error handling
 		printk(KERN_ERR "Stack id %x not registered in sysfs\n", newst->id);
 	}
-#endif
 	if (core_debug & DEBUG_CORE_FUNC)
 		printk(KERN_DEBUG "Stack id %x added\n", newst->id);
 	kernel_thread(mISDNStackd, (void *)newst, 0);
@@ -798,9 +794,7 @@
 	if (core_debug & DEBUG_CORE_FUNC)
 		printk(KERN_DEBUG "%s: st(%p:%08x)\n", __FUNCTION__, st, st->id);
 
-#ifndef SYSFS_SUPPORT_2_6_24
 	mISDN_unregister_sysfs_st(st);
-#endif
 	if (st->parent)
 		st->parent = NULL;
 	if (!list_empty(&st->prereg)) {

Modified: mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_inst.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_inst.c?view=diff&rev=107&r1=106&r2=107
==============================================================================
--- mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_inst.c (original)
+++ mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_inst.c Mon May 11 12:56:17 2009
@@ -167,7 +167,11 @@
 
 #ifdef SYSFS_SUPPORT
 out_unreg:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+	device_unregister(&inst->class_dev);
+#else
 	class_device_unregister(&inst->class_dev);
+#endif
 	return(err);
 #endif
 }

Modified: mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_obj.c
URL: http://svn.asterisk.org/svn-view/thirdparty/mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_obj.c?view=diff&rev=107&r1=106&r2=107
==============================================================================
--- mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_obj.c (original)
+++ mISDN/trunk/drivers/isdn/hardware/mISDN/sysfs_obj.c Mon May 11 12:56:17 2009
@@ -95,13 +95,21 @@
 MISDN_PROTO(mISDNobject, DPROTO, S_IRUGO);
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
 static void release_mISDN_obj(struct device *dev)
+#else
+static void release_mISDN_obj(struct class_device *dev)
+#endif
 {
 #ifdef SYSFS_SUPPORT
 	mISDNobject_t	*obj = to_mISDNobject(dev);
 
 	if ( core_debug & DEBUG_SYSFS) 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+		printk(KERN_INFO "release object class dev %s\n", dev->bus_id);
+#else
 		printk(KERN_INFO "release object class dev %s\n", dev->class_id);
+#endif
 
 	if (obj->owner)
 #ifdef MODULE_MKOBJ_POINTER
@@ -119,7 +127,7 @@
 #ifndef CLASS_WITHOUT_OWNER
 	.owner		= THIS_MODULE,
 #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
 	.release	= &release_mISDN_obj,
 #else
 	.dev_release	= &release_mISDN_obj,
@@ -170,7 +178,11 @@
 
 #ifdef SYSFS_SUPPORT
 out_unreg:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
+	device_unregister(&obj->class_dev);
+#else
 	class_device_unregister(&obj->class_dev);
+#endif
 #endif
 
 out:




More information about the svn-commits mailing list