[zaptel-commits] trunk r1155 - in /trunk: ztd-eth.c ztd-loc.c ztdynamic.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Thu Jun 22 10:28:57 MST 2006


Author: tilghman
Date: Thu Jun 22 12:28:56 2006
New Revision: 1155

URL: http://svn.digium.com/view/zaptel?rev=1155&view=rev
Log:
Bug 7284 - Properly lock ztdynamic modules under kernel 2.6

Modified:
    trunk/ztd-eth.c
    trunk/ztd-loc.c
    trunk/ztdynamic.c

Modified: trunk/ztd-eth.c
URL: http://svn.digium.com/view/zaptel/trunk/ztd-eth.c?rev=1155&r1=1154&r2=1155&view=diff
==============================================================================
--- trunk/ztd-eth.c (original)
+++ trunk/ztd-eth.c Thu Jun 22 12:28:56 2006
@@ -266,6 +266,8 @@
 		kfree(z);
 #ifndef LINUX26
 		MOD_DEC_USE_COUNT;
+#else
+		module_put(THIS_MODULE);
 #endif
 	}
 }
@@ -359,13 +361,16 @@
 			sprintf(src + strlen(src), "%02x:", z->dev->dev_addr[x]);
 		sprintf(src + strlen(src), "%02x", z->dev->dev_addr[5]);
 		printk("TDMoE: Added new interface for %s at %s (addr=%s, src=%s, subaddr=%d)\n", span->name, z->dev->name, addr, src, ntohs(z->subaddr));
-			
+
 		spin_lock_irqsave(&zlock, flags);
 		z->next = zdevs;
 		zdevs = z;
 		spin_unlock_irqrestore(&zlock, flags);
 #ifndef LINUX26
 		MOD_INC_USE_COUNT;
+#else
+		if(!try_module_get(THIS_MODULE))
+			printk("TDMoE: Unable to increment module use count\n");
 #endif
 	}
 	return z;

Modified: trunk/ztd-loc.c
URL: http://svn.digium.com/view/zaptel/trunk/ztd-loc.c?rev=1155&r1=1154&r2=1155&view=diff
==============================================================================
--- trunk/ztd-loc.c (original)
+++ trunk/ztd-loc.c Thu Jun 22 12:28:56 2006
@@ -162,6 +162,8 @@
 		printk("TDMoL: Removed interface for %s, key %d id %d\n", z->span->name, z->key, z->id);
 #ifndef LINUX26
 		MOD_DEC_USE_COUNT;
+#else
+		module_put(THIS_MODULE);
 #endif
 		kfree(z);
 	}
@@ -229,6 +231,9 @@
 		spin_unlock_irqrestore(&zlock, flags);
 #ifndef LINUX26
 		MOD_INC_USE_COUNT;
+#else
+		if(!try_module_get(THIS_MODULE))
+			printk("TDMoL: Unable to increment module use count\n");
 #endif
 
 		printk("TDMoL: Added new interface for %s, key %d id %d\n", span->name, z->key, z->id);

Modified: trunk/ztdynamic.c
URL: http://svn.digium.com/view/zaptel/trunk/ztdynamic.c?rev=1155&r1=1154&r2=1155&view=diff
==============================================================================
--- trunk/ztdynamic.c (original)
+++ trunk/ztdynamic.c Thu Jun 22 12:28:56 2006
@@ -497,6 +497,9 @@
 	}
 #ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#else
+	if(!try_module_get(THIS_MODULE))
+		printk("TDMoX: Unable to increment module use count\n");
 #endif	
 	return 0;
 }
@@ -516,6 +519,8 @@
 		dynamic_destroy(z);
 #ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#else
+	module_put(THIS_MODULE);
 #endif	
 	return 0;
 }



More information about the zaptel-commits mailing list