[svn-commits] sruffell: linux/trunk r9538 - /linux/trunk/drivers/dahdi/voicebus/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 15 17:53:30 UTC 2010


Author: sruffell
Date: Wed Dec 15 11:53:25 2010
New Revision: 9538

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=9538
Log:
vpmadt032: Convert ifacelock from rwlock to plain spinlock.

rwlock is slower than normal spinlocks and this lock is rarely contended
for.  Also noticed that the vpmadt032_module_init function is now (was
already) redundant since all the elements initialized in it were already
initialized.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Kinsey Moore <kmoore at digium.com>
Acked-By: Russ Meyerriecks <rmeyerriecks at digium.com>

Modified:
    linux/trunk/drivers/dahdi/voicebus/GpakCust.c
    linux/trunk/drivers/dahdi/voicebus/GpakCust.h
    linux/trunk/drivers/dahdi/voicebus/voicebus.c

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.c?view=diff&rev=9538&r1=9537&r2=9538
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.c Wed Dec 15 11:53:25 2010
@@ -49,7 +49,7 @@
 #include "voicebus.h"
 #include "vpmadtreg.h"
 
-static rwlock_t ifacelock;
+static DEFINE_SPINLOCK(ifacelock);
 static struct vpmadt032 *ifaces[MAX_DSP_CORES];
 
 #define vpm_info(vpm, format, arg...)         \
@@ -59,13 +59,13 @@
 {
 	struct vpmadt032 *ret;
 
-	read_lock(&ifacelock);
+	spin_lock(&ifacelock);
 	if (ifaces[dspid]) {
 		ret = ifaces[dspid];
 	} else {
 		ret = NULL;
 	}
-	read_unlock(&ifacelock);
+	spin_unlock(&ifacelock);
 	return ret;
 }
 
@@ -539,7 +539,7 @@
 
 	/* Place this structure in the ifaces array so that the DspId from the
 	 * Gpak Library can be used to locate it. */
-	write_lock(&ifacelock);
+	spin_lock(&ifacelock);
 	for (i=0; i<MAX_DSP_CORES; ++i) {
 		if (NULL == ifaces[i]) {
 			ifaces[i] = vpm;
@@ -547,7 +547,7 @@
 			break;
 		}
 	}
-	write_unlock(&ifacelock);
+	spin_unlock(&ifacelock);
 
 	if (-1 == vpm->dspid) {
 		kfree(vpm);
@@ -822,19 +822,12 @@
 	}
 
 	BUG_ON(ifaces[vpm->dspid] != vpm);
-	write_lock(&ifacelock);
+	spin_lock(&ifacelock);
 	ifaces[vpm->dspid] = NULL;
-	write_unlock(&ifacelock);
+	spin_unlock(&ifacelock);
 	kfree(vpm);
 }
 EXPORT_SYMBOL(vpmadt032_free);
-
-int vpmadt032_module_init(void)
-{
-	rwlock_init(&ifacelock);
-	memset(ifaces, 0, sizeof(ifaces));
-	return 0;
-}
 
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  * gpakReadDspMemory - Read DSP memory.

Modified: linux/trunk/drivers/dahdi/voicebus/GpakCust.h
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/GpakCust.h?view=diff&rev=9538&r1=9537&r2=9538
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/GpakCust.h (original)
+++ linux/trunk/drivers/dahdi/voicebus/GpakCust.h Wed Dec 15 11:53:25 2010
@@ -191,8 +191,6 @@
 }
 
 
-int vpmadt032_module_init(void);
-
 typedef __u16 DSP_WORD;			/* 16 bit DSP word */
 typedef __u32 DSP_ADDRESS;		/* 32 bit DSP address */
 typedef __u32 GPAK_FILE_ID;		/* G.PAK Download file identifier */

Modified: linux/trunk/drivers/dahdi/voicebus/voicebus.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/voicebus/voicebus.c?view=diff&rev=9538&r1=9537&r2=9538
==============================================================================
--- linux/trunk/drivers/dahdi/voicebus/voicebus.c (original)
+++ linux/trunk/drivers/dahdi/voicebus/voicebus.c Wed Dec 15 11:53:25 2010
@@ -1979,17 +1979,12 @@
 
 static int __init voicebus_module_init(void)
 {
-	int res;
-
 	/* This registration with dahdi.ko will fail since the span is not
 	 * defined, but it will make sure that this module is a dependency of
 	 * dahdi.ko, so that when it is being unloded, this module will be
 	 * unloaded as well. */
 	dahdi_register(NULL, 0);
 	spin_lock_init(&loader_list_lock);
-	res = vpmadt032_module_init();
-	if (res)
-		return res;
 	return 0;
 }
 




More information about the svn-commits mailing list