summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2010-03-22 09:20:37 +0000
committerShaun Ruffell <sruffell@digium.com>2010-03-22 09:20:37 +0000
commit44de2fe35d90fca285af3c0781cc5e6e34d88550 (patch)
tree41173ba3394f0334a6a12278df09eaf7cffbc60f
parent7991bff1f358e06b188ee6aa3622d16ddecaa510 (diff)
wcte12xp, wctdm24xxp: Do not keep individual free lists for VPM commands.
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@8375 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/voicebus/GpakCust.c28
-rw-r--r--drivers/dahdi/voicebus/GpakCust.h2
-rw-r--r--drivers/dahdi/wctdm24xxp/base.c3
-rw-r--r--drivers/dahdi/wcte12xp/base.c3
4 files changed, 10 insertions, 26 deletions
diff --git a/drivers/dahdi/voicebus/GpakCust.c b/drivers/dahdi/voicebus/GpakCust.c
index 2804d27..06e73be 100644
--- a/drivers/dahdi/voicebus/GpakCust.c
+++ b/drivers/dahdi/voicebus/GpakCust.c
@@ -72,21 +72,12 @@ static inline struct vpmadt032 *find_iface(const unsigned short dspid)
static struct vpmadt032_cmd *vpmadt032_get_free_cmd(struct vpmadt032 *vpm)
{
- unsigned long flags;
struct vpmadt032_cmd *cmd;
might_sleep();
- spin_lock_irqsave(&vpm->list_lock, flags);
- if (list_empty(&vpm->free_cmds)) {
- spin_unlock_irqrestore(&vpm->list_lock, flags);
- cmd = kmalloc(sizeof(struct vpmadt032_cmd), GFP_KERNEL);
- if (unlikely(!cmd))
- return NULL;
- memset(cmd, 0, sizeof(*cmd));
- } else {
- cmd = list_entry(vpm->free_cmds.next, struct vpmadt032_cmd, node);
- list_del_init(&cmd->node);
- spin_unlock_irqrestore(&vpm->list_lock, flags);
- }
+ cmd = kmalloc(sizeof(struct vpmadt032_cmd), GFP_KERNEL);
+ if (unlikely(!cmd))
+ return NULL;
+ memset(cmd, 0, sizeof(*cmd));
init_completion(&cmd->complete);
return cmd;
}
@@ -140,8 +131,9 @@ static int vpmadt032_getreg_full_return(struct vpmadt032 *vpm, int pagechange,
ret = wait_for_completion_timeout(&cmd->complete, HZ/5);
if (unlikely(!ret)) {
spin_lock_irqsave(&vpm->list_lock, flags);
- list_add_tail(&cmd->node, &vpm->free_cmds);
+ list_del(&cmd->node);
spin_unlock_irqrestore(&vpm->list_lock, flags);
+ kfree(cmd);
return -EIO;
}
@@ -151,10 +143,8 @@ static int vpmadt032_getreg_full_return(struct vpmadt032 *vpm, int pagechange,
ret = 0;
}
- /* Just throw this command back on the ready list. */
- spin_lock_irqsave(&vpm->list_lock, flags);
- list_add_tail(&cmd->node, &vpm->free_cmds);
- spin_unlock_irqrestore(&vpm->list_lock, flags);
+ list_del(&cmd->node);
+ kfree(cmd);
return 0;
}
@@ -532,7 +522,6 @@ vpmadt032_alloc(struct vpmadt032_options *options, const char *board_name)
spin_lock_init(&vpm->list_lock);
spin_lock_init(&vpm->change_list_lock);
INIT_LIST_HEAD(&vpm->change_list);
- INIT_LIST_HEAD(&vpm->free_cmds);
INIT_LIST_HEAD(&vpm->pending_cmds);
INIT_LIST_HEAD(&vpm->active_cmds);
sema_init(&vpm->sem, 1);
@@ -714,7 +703,6 @@ void vpmadt032_free(struct vpmadt032 *vpm)
spin_lock_irqsave(&vpm->list_lock, flags);
list_splice(&vpm->pending_cmds, &local_list);
list_splice(&vpm->active_cmds, &local_list);
- list_splice(&vpm->free_cmds, &local_list);
spin_unlock_irqrestore(&vpm->list_lock, flags);
while (!list_empty(&local_list)) {
diff --git a/drivers/dahdi/voicebus/GpakCust.h b/drivers/dahdi/voicebus/GpakCust.h
index b4b523e..70704b0 100644
--- a/drivers/dahdi/voicebus/GpakCust.h
+++ b/drivers/dahdi/voicebus/GpakCust.h
@@ -118,8 +118,6 @@ struct vpmadt032 {
spinlock_t change_list_lock;
struct list_head change_list;
spinlock_t list_lock;
- /* Commands that are ready to be used. */
- struct list_head free_cmds;
/* Commands that are waiting to be processed. */
struct list_head pending_cmds;
/* Commands that are currently in progress by the VPM module */
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c
index 71073dd..02e85f0 100644
--- a/drivers/dahdi/wctdm24xxp/base.c
+++ b/drivers/dahdi/wctdm24xxp/base.c
@@ -785,8 +785,7 @@ static inline void cmd_decipher_vpmadt032(struct wctdm *wc, const u8 *readchunk)
cmd->data = (0xff & readchunk[CMD_BYTE(25, 1, 0)]) << 8;
cmd->data |= readchunk[CMD_BYTE(25, 2, 0)];
if (cmd->desc & __VPM150M_WR) {
- /* Writes do not need any acknowledgement */
- list_add_tail(&cmd->node, &vpm->free_cmds);
+ kfree(&cmd->node);
} else {
cmd->desc |= __VPM150M_FIN;
complete(&cmd->complete);
diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c
index 3ac2727..2d82e3f 100644
--- a/drivers/dahdi/wcte12xp/base.c
+++ b/drivers/dahdi/wcte12xp/base.c
@@ -258,8 +258,7 @@ inline void cmd_decipher_vpmadt032(struct t1 *wc, const u8 *readchunk)
cmd->data = (0xff & readchunk[CMD_BYTE(2, 1, 1)]) << 8;
cmd->data |= readchunk[CMD_BYTE(2, 2, 1)];
if (cmd->desc & __VPM150M_WR) {
- /* Writes do not need any acknowledgement */
- list_add_tail(&cmd->node, &vpm->free_cmds);
+ kfree(&cmd->node);
} else {
cmd->desc |= __VPM150M_FIN;
complete(&cmd->complete);