diff options
author | Shaun Ruffell <sruffell@digium.com> | 2010-12-15 17:53:25 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2010-12-15 17:53:25 +0000 |
commit | e515fa15a3dd599df6e93bba086a92c49c5f9887 (patch) | |
tree | a779306075e49afdd980d10cf04a8f2b91a0a1b9 /drivers/dahdi/voicebus | |
parent | 5282d83137d7c1f894f0792f0a7b09ec3520d282 (diff) |
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@digium.com>
Acked-by: Kinsey Moore <kmoore@digium.com>
Acked-By: Russ Meyerriecks <rmeyerriecks@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9538 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/voicebus')
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.c | 21 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/GpakCust.h | 2 | ||||
-rw-r--r-- | drivers/dahdi/voicebus/voicebus.c | 5 |
3 files changed, 7 insertions, 21 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c index d33779d..1d3d26e 100644 --- a/drivers/dahdi/voicebus/GpakCust.c +++ b/drivers/dahdi/voicebus/GpakCust.c @@ -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 @@ static inline struct vpmadt032 *find_iface(const unsigned short dspid) { 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 @@ vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name) /* 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 @@ vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name) break; } } - write_unlock(&ifacelock); + spin_unlock(&ifacelock); if (-1 == vpm->dspid) { kfree(vpm); @@ -822,20 +822,13 @@ void vpmadt032_free(struct vpmadt032 *vpm) } 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. * diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h index 64ef44a..10965a8 100644 --- a/drivers/dahdi/voicebus/GpakCust.h +++ b/drivers/dahdi/voicebus/GpakCust.h @@ -191,8 +191,6 @@ static inline void vpmadt032_resend(struct vpmadt032 *vpm) } -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 */ diff --git a/drivers/dahdi/voicebus/voicebus.c b/drivers/dahdi/voicebus/voicebus.c index c57c757..63aba52 100644 --- a/drivers/dahdi/voicebus/voicebus.c +++ b/drivers/dahdi/voicebus/voicebus.c @@ -1979,17 +1979,12 @@ EXPORT_SYMBOL(vpmadtreg_unregister); 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; } |