[svn-commits] sruffell: branch linux/sruffell/wctdm24xxp-updates r10137 - /linux/team/sruff...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Aug 12 19:36:53 CDT 2011
Author: sruffell
Date: Fri Aug 12 19:36:49 2011
New Revision: 10137
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10137
Log:
wctdm24xxp: Use our own list for IRQ commands.
Really only *necessary* when SLAB debugging is enabled, but in that
case, can reduce the chance of latency bumps when first loading the
driver.
Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Modified:
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=10137&r1=10136&r2=10137
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/base.c Fri Aug 12 19:36:49 2011
@@ -1020,7 +1020,7 @@
return;
}
- kfree(cmd);
+ list_add(&cmd->node, &wc->free_isr_commands);
switch (mod->type) {
case FXS:
@@ -1052,9 +1052,18 @@
{
struct wctdm_cmd *cmd;
- cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
- if (unlikely(!cmd))
+ if (!list_empty(&wc->free_isr_commands)) {
+ cmd = list_entry(wc->free_isr_commands.next,
+ struct wctdm_cmd, node);
+ list_del(&cmd->node);
+ } else {
+ if (printk_ratelimit())
+ printk("blah\n");
return;
+ cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+ if (unlikely(!cmd))
+ return;
+ }
cmd->cmd = CMD_RD(address);
cmd->complete = NULL;
@@ -4956,6 +4965,7 @@
list_splice_init(&mod->pending_cmds, &local_list);
list_splice_init(&mod->active_cmds, &local_list);
}
+ list_splice_init(&wc->free_isr_commands, &local_list);
spin_unlock_irqrestore(&wc->reglock, flags);
while (!list_empty(&local_list)) {
@@ -5542,6 +5552,32 @@
if (NONE == wc->mods[i].type)
wc->tdm410leds |= (1 << i);
}
+}
+
+/**
+ * wctdm_allocate_irq_commands -
+ * @wc: The board which we're allocating for.
+ * @count: The number of IRQ commands to allocate.
+ *
+ * We need a minimum of 4 * the current latency worth of commands for each
+ * analog module.
+ */
+static void wctdm_allocate_irq_commands(struct wctdm *wc, unsigned int count)
+{
+ int i;
+ unsigned long flags;
+ LIST_HEAD(local_list);
+
+ for (i = 0; i < count; ++i) {
+ struct wctdm_cmd *cmd;
+ cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
+ if (cmd)
+ list_add(&cmd->node, &local_list);
+ }
+
+ spin_lock_irqsave(&wc->reglock, flags);
+ list_splice(&local_list, &wc->free_isr_commands);
+ spin_unlock_irqrestore(&wc->reglock, flags);
}
#ifdef USE_ASYNC_INIT
@@ -5589,6 +5625,7 @@
spin_lock_init(&wc->frame_list_lock);
init_waitqueue_head(&wc->regq);
spin_lock_init(&wc->reglock);
+ INIT_LIST_HEAD(&wc->free_isr_commands);
wc->oldsync = -1;
wc->board_name = kasprintf(GFP_KERNEL, "%s%d", wctdm_driver.name, pos);
@@ -5828,6 +5865,7 @@
}
}
+ wctdm_allocate_irq_commands(wc, anamods * latency * 4);
wc->not_ready--;
dev_info(&wc->vb.pdev->dev,
Modified: linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h
URL: http://svnview.digium.com/svn/dahdi/linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h?view=diff&rev=10137&r1=10136&r2=10137
==============================================================================
--- linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h (original)
+++ linux/team/sruffell/wctdm24xxp-updates/drivers/dahdi/wctdm24xxp/wctdm24xxp.h Fri Aug 12 19:36:49 2011
@@ -276,6 +276,7 @@
spinlock_t reglock; /* held when accessing anything affecting the module array */
wait_queue_head_t regq;
+ struct list_head free_isr_commands;
struct wctdm_module mods[NUM_MODULES];
More information about the svn-commits
mailing list