[svn-commits] sruffell: branch linux/sruffell/dahdi-linux-cmdqueue r6032 - /linux/team/sruf...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Feb 24 13:37:01 CST 2009
Author: sruffell
Date: Tue Feb 24 13:37:00 2009
New Revision: 6032
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6032
Log:
Moved the alarm processing out of the interrupt handler.
By moving the alarm processing out of the interrupt handler, there is no need
for any extra code to support queueing up register reads when in interrupt
context.
Modified:
linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c
linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h
Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c?view=diff&rev=6032&r1=6031&r2=6032
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/base.c Tue Feb 24 13:37:00 2009
@@ -8,7 +8,7 @@
* Matthew Fredrickson <creslin at digium.com>
* William Meadows <wmeadows at digium.com>
*
- * Copyright (C) 2007-2008, Digium, Inc.
+ * Copyright (C) 2007-2009, Digium, Inc.
*
* All rights reserved.
*
@@ -36,6 +36,7 @@
#include <linux/proc_fs.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
+#include <linux/workqueue.h>
#include <linux/delay.h>
#include <dahdi/kernel.h>
@@ -112,19 +113,7 @@
static struct t1_desc te122 = { "Wildcard TE122", 0 };
static struct t1_desc te121 = { "Wildcard TE121", 0 };
-int schluffen(wait_queue_head_t *q)
-{
- DECLARE_WAITQUEUE(wait, current);
- add_wait_queue(q, &wait);
- current->state = TASK_INTERRUPTIBLE;
- if (!signal_pending(current)) schedule();
- current->state = TASK_RUNNING;
- remove_wait_queue(q, &wait);
- if (signal_pending(current)) return -ERESTARTSYS;
- return(0);
-}
-
-static inline struct command * get_free_cmd(struct t1 *wc)
+static struct command * get_free_cmd(struct t1 *wc)
{
struct command *cmd = NULL;
unsigned long flags;
@@ -138,7 +127,7 @@
return cmd;
}
-static inline void free_cmd(struct t1 *wc, struct command *cmd)
+static void free_cmd(struct t1 *wc, struct command *cmd)
{
unsigned long flags;
spin_lock_irqsave(&wc->cmd_list_lock, flags);
@@ -146,7 +135,7 @@
spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
}
-static inline struct command * get_pending_cmd(struct t1 *wc)
+static struct command * get_pending_cmd(struct t1 *wc)
{
struct command *cmd = NULL;
unsigned long flags;
@@ -159,7 +148,7 @@
return cmd;
}
-static inline void submit_cmd(struct t1 *wc, struct command *cmd)
+static void submit_cmd(struct t1 *wc, struct command *cmd)
{
unsigned long flags;
if (cmd->flags & (__CMD_RD | __CMD_PINS))
@@ -169,14 +158,14 @@
spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
}
-static inline void resend_cmds(struct t1 *wc)
+static void resend_cmds(struct t1 *wc)
{
unsigned long flags;
spin_lock_irqsave(&wc->cmd_list_lock, flags);
list_splice_init(&wc->active_cmds, &wc->pending_cmds);
spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
}
-static inline void cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int eframe, int slot)
+static void cmd_dequeue(struct t1 *wc, volatile unsigned char *writechunk, int eframe, int slot)
{
struct command *curcmd=NULL;
@@ -229,10 +218,6 @@
/* Nobody is waiting on writes...so let's just
* free them here. */
list_move(&cmd->node, &wc->free_cmds);
- } else if (cmd->flags & __CMD_ISR) {
- /* If it was an isr read, someone will still want to get
- * the result. */
- list_move(&cmd->node, &wc->complete_isr_read_cmds);
} else {
cmd->data |= readchunk[CMD_BYTE(cmd->cs_slot, 2, IS_VPM)];
list_del_init(&cmd->node);
@@ -273,45 +258,6 @@
return t1_setreg_full(wc, addr, val, NOT_VPM);
}
-/***************************************************************************
- * clean_leftovers()
- *
- * Check for unconsumed isr register reads and clean them up.
- **************************************************************************/
-static inline void clean_leftovers(struct t1 *wc)
-{
- unsigned long flags;
- spin_lock_irqsave(&wc->cmd_list_lock, flags);
- if (!list_empty(&wc->complete_isr_read_cmds)) {
- debug_printk(1,"leftover isr reads!");
- list_splice_init(&wc->complete_isr_read_cmds, &wc->free_cmds);
- }
- spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
-}
-
-/********************************************************************
- * t1_getreg_isr()
- *
- * Called in interrupt context to retrieve a value already requested
- * by the normal t1_getreg().
- *******************************************************************/
-static inline int t1_getreg_isr(struct t1 *wc, const int addr)
-{
- unsigned long flags;
- int ret = -1;
- struct command *cur, *temp;
- spin_lock_irqsave(&wc->cmd_list_lock, flags);
- list_for_each_entry_safe(cur, temp, &wc->complete_isr_read_cmds, node) {
- if (addr == cur->address) {
- ret = cur->data;
- list_move(&cur->node, &wc->free_cmds);
- break;
- }
- }
- spin_unlock_irqrestore(&wc->cmd_list_lock, flags);
- return ret;
-}
-
static inline int t1_getreg_full(struct t1 *wc, int addr, int vpm_num)
{
struct command *cmd = NULL;
@@ -348,31 +294,24 @@
return ret;
}
-static inline int t1_getreg(struct t1 *wc, int addr, int inisr)
-{
- inisr = 0; /* TODO: Remove this */
+static int t1_getreg(struct t1 *wc, int addr)
+{
return t1_getreg_full(wc, addr, NOT_VPM);
}
-static inline int t1_setleds(struct t1 *wc, int leds, const int inisr)
+static void t1_setleds(struct t1 *wc, int leds)
{
struct command *cmd;
leds = ~leds & 0x0E; /* invert the LED bits (3 downto 1)*/
-retry:
- cmd = get_free_cmd(wc);
- if (cmd) {
- cmd->flags |= __CMD_LEDS;
- cmd->address = leds;
- submit_cmd(wc, cmd);
- return 0;
- } else if (inisr) {
- return -1;
- } else {
- msleep(1);
- goto retry;
- }
- /* should not get here. */
+
+ while (!(cmd = get_free_cmd(wc))) {
+ msleep(10);
+ }
+
+ cmd->flags |= __CMD_LEDS;
+ cmd->address = leds;
+ submit_cmd(wc, cmd);
}
static inline int t1_getpins(struct t1 *wc, int inisr)
@@ -764,39 +703,15 @@
return 0;
}
-static inline void __t1_check_sigbits_reads(struct t1 *wc)
-{
- int i;
+static inline void t1_check_sigbits(struct t1 *wc)
+{
+ int a,i,rxs;
if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
return;
if (wc->spantype == TYPE_E1) {
for (i = 0; i < 15; i++) {
- if (t1_getreg(wc, 0x71 + i, 1))
- wc->isrreaderrors++;
- }
- } else if (wc->span.lineconfig & DAHDI_CONFIG_D4) {
- for (i = 0; i < 24; i+=4) {
- if (t1_getreg(wc, 0x70 + (i >> 2), 1))
- wc->isrreaderrors++;
- }
- } else {
- for (i = 0; i < 24; i+=2) {
- if (t1_getreg(wc, 0x70 + (i >> 1), 1))
- wc->isrreaderrors++;
- }
- }
-}
-
-static inline void __t1_check_sigbits(struct t1 *wc)
-{
- int a,i,rxs;
-
- if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
- return;
- if (wc->spantype == TYPE_E1) {
- for (i = 0; i < 15; i++) {
- a = t1_getreg_isr(wc, 0x71 + i);
+ a = t1_getreg(wc, 0x71 + i);
if (a > -1) {
/* Get high channel in low bits */
rxs = (a & 0xf);
@@ -819,7 +734,7 @@
}
} else if (wc->span.lineconfig & DAHDI_CONFIG_D4) {
for (i = 0; i < 24; i+=4) {
- a = t1_getreg_isr(wc, 0x70 + (i>>2));
+ a = t1_getreg(wc, 0x70 + (i>>2));
if (a > -1) {
/* Get high channel in low bits */
rxs = (a & 0x3) << 2;
@@ -858,7 +773,7 @@
}
} else {
for (i = 0; i < 24; i+=2) {
- a = t1_getreg_isr(wc, 0x70 + (i>>1));
+ a = t1_getreg(wc, 0x70 + (i>>1));
if (a > -1) {
/* Get high channel in low bits */
rxs = (a & 0xf);
@@ -1133,7 +1048,7 @@
module_printk("Unable to register span with DAHDI\n");
return -1;
}
- wc->initialized = 1;
+ atomic_set(&wc->initialized, 1);
return 0;
}
@@ -1179,20 +1094,20 @@
wc->chanmap = chanmap_t1;
/* what version of the FALC are we using? */
reg = t1_setreg(wc, 0x4a, 0xaa);
- reg = t1_getreg(wc, 0x4a, 0);
+ reg = t1_getreg(wc, 0x4a);
debug_printk(1, "FALC version: %08x\n", reg);
/* make sure reads and writes work */
for (x = 0; x < 256; x++) {
t1_setreg(wc, 0x14, x);
- if ((reg = t1_getreg(wc, 0x14, 0)) != x)
+ if ((reg = t1_getreg(wc, 0x14)) != x)
module_printk("Wrote '%x' but read '%x'\n", x, reg);
}
/* all LED's blank */
wc->ledtestreg = UNSET_LED_ORANGE(wc->ledtestreg);
wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg);
- t1_setleds(wc, wc->ledtestreg, 0);
+ t1_setleds(wc, wc->ledtestreg);
#ifdef VPM_SUPPORT
t1_vpm150m_init(wc);
@@ -1209,20 +1124,7 @@
return 0;
}
-static inline void __t1_check_alarms_reads(struct t1 *wc)
-{
- if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
- return;
-
- if (t1_getreg(wc, 0x4c, 1))
- wc->isrreaderrors++;
- if (t1_getreg(wc, 0x20, 1))
- wc->isrreaderrors++;
- if (t1_getreg(wc, 0x4d, 1))
- wc->isrreaderrors++;
-}
-
-static inline void __t1_check_alarms(struct t1 *wc)
+static inline void t1_check_alarms(struct t1 *wc)
{
unsigned char c,d;
int alarms;
@@ -1232,9 +1134,9 @@
if (!(wc->span.flags & DAHDI_FLAG_RUNNING))
return;
- c = t1_getreg_isr(wc, 0x4c);
- fmr4 = t1_getreg_isr(wc, 0x20); /* must read this even if we don't use it */
- d = t1_getreg_isr(wc, 0x4d);
+ c = t1_getreg(wc, 0x4c);
+ fmr4 = t1_getreg(wc, 0x20); /* must read this even if we don't use it */
+ d = t1_getreg(wc, 0x4d);
/* Assume no alarms */
alarms = 0;
@@ -1307,7 +1209,7 @@
/* Keep track of recovering */
if ((!alarms) && wc->span.alarms)
- wc->alarmtimer = DAHDI_ALARMSETTLE_TIME;
+ wc->alarmtimer = jiffies + 5*HZ;
if (wc->alarmtimer)
alarms |= DAHDI_ALARM_RECOVER;
@@ -1330,86 +1232,55 @@
if (wc->span.mainttimer || wc->span.maintstat)
alarms |= DAHDI_ALARM_LOOPBACK;
wc->span.alarms = alarms;
- spin_unlock(&wc->reglock);
dahdi_alarm_notify(&wc->span);
- spin_lock(&wc->reglock);
-}
-
-static inline void __handle_leds(struct t1 *wc)
-{
+}
+
+static void handle_leds(struct t1 *wc)
+{
+ unsigned char led;
+ unsigned long flags;
+
+ led = wc->ledtestreg;
+
if (wc->span.alarms & (DAHDI_ALARM_RED | DAHDI_ALARM_BLUE)) {
- wc->blinktimer++;
- if (wc->blinktimer == 160)
- wc->ledtestreg = SET_LED_RED(wc->ledtestreg);
- if (wc->blinktimer == 480) {
- wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg);
- wc->blinktimer = 0;
+ if (time_after(jiffies, wc->blinktimer)) {
+ wc->blinktimer = jiffies + 16*(HZ/100);
+ led = (led & __LED_GREEN) ? UNSET_LED_REDGREEN(led) : SET_LED_RED(led);
}
} else if (wc->span.alarms & DAHDI_ALARM_YELLOW) {
- wc->yellowtimer++;
- if (!(wc->yellowtimer % 2))
- wc->ledtestreg = SET_LED_RED(wc->ledtestreg);
- else
- wc->ledtestreg = SET_LED_GREEN(wc->ledtestreg);
+ if (time_after(jiffies, wc->blinktimer)) {
+ wc->blinktimer = jiffies + HZ/100;
+ led = (led & __LED_RED) ? SET_LED_GREEN(led) : SET_LED_RED(led);
+ }
} else {
if (wc->span.maintstat != DAHDI_MAINT_NONE)
- wc->ledtestreg = SET_LED_ORANGE(wc->ledtestreg);
+ led = SET_LED_ORANGE(led);
else
- wc->ledtestreg = UNSET_LED_ORANGE(wc->ledtestreg);
+ led = UNSET_LED_ORANGE(led);
if (wc->span.flags & DAHDI_FLAG_RUNNING)
- wc->ledtestreg = SET_LED_GREEN(wc->ledtestreg);
+ led = SET_LED_GREEN(led);
else
- wc->ledtestreg = UNSET_LED_REDGREEN(wc->ledtestreg);
- }
-
- if (wc->ledtestreg != wc->ledlastvalue) {
- t1_setleds(wc, wc->ledtestreg, 1);
- wc->ledlastvalue = wc->ledtestreg;
- }
-}
-
-
-static void __t1_do_counters(struct t1 *wc)
+ led = UNSET_LED_REDGREEN(led);
+ }
+
+ if (led != wc->ledlastvalue) {
+ spin_lock_irqsave(&wc->reglock, flags);
+ wc->ledlastvalue = led;
+ wc->ledtestreg = led;
+ spin_unlock_irqrestore(&wc->reglock, flags);
+ t1_setleds(wc, led);
+ }
+}
+
+
+static void t1_do_counters(struct t1 *wc)
{
if (wc->alarmtimer) {
- if (!--wc->alarmtimer) {
+ if (time_after(jiffies, wc->alarmtimer)) {
wc->span.alarms &= ~(DAHDI_ALARM_RECOVER);
+ wc->alarmtimer = 0;
dahdi_alarm_notify(&wc->span);
}
- }
-}
-
-static inline void t1_isr_misc(struct t1 *wc)
-{
- const unsigned int x = wc->intcount & 0x3f;
- int buffer_count = voicebus_current_latency(wc->vb);
-
- if (unlikely(!wc->initialized)) return;
-
- __handle_leds(wc);
-
- __t1_do_counters(wc);
-
- if ( 0 == x ) {
- __t1_check_sigbits_reads(wc);
- }
- else if ( 1 == x ) {
- if (!(wc->intcount & 0x30)) {
- __t1_check_alarms_reads(wc);
- wc->alarms_read=1;
- }
- }
- else if ( x == buffer_count*2) {
- __t1_check_sigbits(wc);
- }
- else if ( x == (buffer_count*2)+1 ) {
- if (wc->alarms_read) {
- __t1_check_alarms(wc);
- wc->alarms_read=0;
- }
- }
- else if ( x == (buffer_count*2)+2) {
- clean_leftovers(wc);
}
}
@@ -1420,14 +1291,14 @@
int chan;
/* Calculate Transmission */
- if (likely(wc->initialized)) {
+ if (likely(atomic_read(&wc->initialized))) {
spin_unlock(&wc->reglock);
dahdi_transmit(&wc->span);
spin_lock(&wc->reglock);
}
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
- if (likely(wc->initialized)) {
+ if (likely(atomic_read(&wc->initialized))) {
for (chan = 0; chan < wc->span.channels; chan++)
writechunk[(chan+1)*2] = wc->chans[chan]->writechunk[x];
}
@@ -1456,7 +1327,7 @@
unsigned char expected;
for (x = 0; x < DAHDI_CHUNKSIZE; x++) {
- if (likely(wc->initialized)) {
+ if (likely(atomic_read(&wc->initialized))) {
for (chan = 0; chan < wc->span.channels; chan++) {
wc->chans[chan]->readchunk[x]= readchunk[(chan+1)*2];
}
@@ -1468,7 +1339,7 @@
if (wc->rxident != expected) {
wc->span.irqmisses++;
resend_cmds(wc);
- if (unlikely(debug && wc->initialized))
+ if (unlikely(debug && atomic_read(&wc->initialized)))
module_printk("oops: rxident=%d expected=%d x=%d\n", wc->rxident, expected, x);
}
}
@@ -1481,7 +1352,7 @@
}
/* echo cancel */
- if (likely(wc->initialized)) {
+ if (likely(atomic_read(&wc->initialized))) {
spin_unlock(&wc->reglock);
for (x = 0; x < wc->span.channels; x++) {
dahdi_ec_chunk(wc->chans[x], wc->chans[x]->readchunk, wc->ec_chunk2[x]);
@@ -1491,9 +1362,6 @@
dahdi_receive(&wc->span);
spin_lock(&wc->reglock);
}
-
- /* Wake up anyone sleeping to read/write a new register */
- wake_up_interruptible(&wc->regq);
}
static void
@@ -1509,7 +1377,6 @@
wc->txints++;
t1_transmitprep(wc, vbb);
wc->intcount++;
- t1_isr_misc(wc);
spin_unlock(&wc->reglock);
voicebus_transmit(wc->vb, vbb);
}
@@ -1528,6 +1395,32 @@
spin_unlock(&wc->reglock);
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+static void timer_work_func(void *param)
+{
+ struct t1 *wc = param;
+#else
+static void timer_work_func(struct work_struct *work)
+{
+ struct t1 *wc = container_of(work, struct t1, timer_work);
+#endif
+ /* Called once every 100ms */
+ if (unlikely(!atomic_read(&wc->initialized))) return;
+ handle_leds(wc);
+ t1_do_counters(wc);
+ t1_check_alarms(wc);
+ t1_check_sigbits(wc);
+ mod_timer(&wc->timer, jiffies + HZ/10);
+}
+
+static void
+te12xp_timer(unsigned long data)
+{
+ struct t1 *wc = (struct t1 *)data;
+ schedule_work(&wc->timer_work);
+ return;
+}
+
static int __devinit te12xp_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
{
struct t1 *wc;
@@ -1561,7 +1454,6 @@
INIT_LIST_HEAD(&wc->active_cmds);
INIT_LIST_HEAD(&wc->pending_cmds);
INIT_LIST_HEAD(&wc->free_cmds);
- INIT_LIST_HEAD(&wc->complete_isr_read_cmds);
for (x = 0; x < MAX_COMMANDS; ++x) {
INIT_LIST_HEAD(&wc->cmds[x].node);
free_cmd(wc, &wc->cmds[x]);
@@ -1569,7 +1461,20 @@
wc->variety = d->name;
wc->txident = 1;
- init_waitqueue_head(&wc->regq);
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
+ wc->timer.function = te12xp_timer;
+ wc->timer.data = (unsigned long)wc;
+ init_timer(&wc->timer);
+# else
+ setup_timer(&wc->timer, te12xp_timer, (unsigned long)wc);
+# endif
+
+# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ INIT_WORK(&wc->timer_work, timer_work_func, wc);
+# else
+ INIT_WORK(&wc->timer_work, timer_work_func);
+# endif
+
snprintf(wc->name, sizeof(wc->name)-1, "wcte12xp%d", index);
if ((res = voicebus_init(pdev, SFRAME_SIZE, wc->name,
t1_handle_receive, t1_handle_transmit, wc,
@@ -1602,6 +1507,7 @@
memset(wc->chans[x], 0, sizeof(*wc->chans[x]));
}
+ mod_timer(&wc->timer, jiffies + HZ/10);
t1_software_init(wc);
if (voicebus_current_latency(wc->vb) > startinglatency) {
/* The voicebus library increased the latency during
@@ -1635,6 +1541,9 @@
if (!wc)
return;
+ del_timer_sync(&wc->timer);
+ flush_scheduled_work();
+ del_timer_sync(&wc->timer);
#ifdef VPM_SUPPORT
if(vpm150m) {
clear_bit(VPM150M_DTMFDETECT, &vpm150m->control);
@@ -1648,8 +1557,8 @@
voicebus_release(wc->vb);
wc->vb = NULL;
- if (debug && wc->isrreaderrors)
- debug_printk(1, "isrreaderrors=%d\n", wc->isrreaderrors);
+ if (debug && atomic_read(&wc->isrreaderrors))
+ debug_printk(1, "isrreaderrors=%d\n", atomic_read(&wc->isrreaderrors));
#ifdef VPM_SUPPORT
if(vpm150m) {
Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c?view=diff&rev=6032&r1=6031&r2=6032
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/vpmadt032.c Tue Feb 24 13:37:00 2009
@@ -296,11 +296,10 @@
static inline int vpm150m_io_wait(struct t1 *wc)
{
int x;
- int ret=0;
for (x=0; x < VPM150M_MAX_COMMANDS;) {
if (wc->vpm150m->cmdq[x].flags) {
- if ((ret=schluffen(&wc->regq))) {
- return ret;
+ if (msleep_interruptible(1)) {
+ return -EINTR;
}
x=0;
}
@@ -308,7 +307,7 @@
++x;
}
}
- return ret;
+ return 0;
}
static int t1_vpm150m_getreg_full_async(struct t1 *wc, int pagechange, unsigned int len,
@@ -351,8 +350,8 @@
}
else {
spin_unlock_irqrestore(&wc->reglock, flags);
- if ((ret=schluffen(&wc->regq))) {
- return ret;
+ if (msleep_interruptible(1)) {
+ return -EINTR;
}
spin_lock_irqsave(&wc->reglock, flags);
ret = -EBUSY;
@@ -370,8 +369,8 @@
ret = t1_vpm150m_getreg_full_async(wc, pagechange, len, addr, outbuf, &hit);
if (!hit) {
if ( -EBUSY == ret ) {
- if ((ret = schluffen(&wc->regq)))
- return ret;
+ if (msleep_interruptible(1))
+ return -EINTR;
}
BUG_ON( 0 != ret);
}
@@ -385,7 +384,7 @@
{
unsigned long flags;
struct vpm150m_cmd *hit;
- int ret, i;
+ int i;
do {
spin_lock_irqsave(&wc->reglock, flags);
hit = vpm150m_empty_slot(wc);
@@ -400,8 +399,8 @@
}
spin_unlock_irqrestore(&wc->reglock, flags);
if (!hit) {
- if ((ret = schluffen(&wc->regq)))
- return ret;
+ if (msleep_interruptible(1))
+ return -EINTR;
}
} while (!hit);
return (hit) ? 0 : -1;
@@ -735,7 +734,7 @@
spin_unlock_irqrestore(&wc->reglock, flags);
for (i = 0; i < 10; i++)
- schluffen(&wc->regq);
+ msleep_interruptible(1);
debug_printk(1, "Looking for VPMADT032 by testing page access: ");
for (i = 0; i < 0xf; i++) {
@@ -854,7 +853,7 @@
set_bit(VPM150M_HPIRESET, &vpm150m->control);
while (test_bit(VPM150M_HPIRESET, &vpm150m->control))
- schluffen(&wc->regq);
+ msleep(1);
module_printk("VPMADT032 Loading firmware... ");
downloadstatus = gpakDownloadDsp(vpm150m->dspid, &fw);
@@ -872,7 +871,7 @@
set_bit(VPM150M_SWRESET, &vpm150m->control);
while (test_bit(VPM150M_SWRESET, &vpm150m->control))
- schluffen(&wc->regq);
+ msleep(1);
msleep(700);
#if 0
Modified: linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h
URL: http://svn.digium.com/svn-view/dahdi/linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h?view=diff&rev=6032&r1=6031&r2=6032
==============================================================================
--- linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h (original)
+++ linux/team/sruffell/dahdi-linux-cmdqueue/drivers/dahdi/wcte12xp/wcte12xp.h Tue Feb 24 13:37:00 2009
@@ -75,7 +75,7 @@
#define SET_LED_GREEN(a) (a | __LED_GREEN) & ~__LED_RED
#define UNSET_LED_ORANGE(a) a & ~__LED_ORANGE
-#define UNSET_LED_REDGREEN(a) a | __LED_RED | __LED_GREEN
+#define UNSET_LED_REDGREEN(a) (a & ~(__LED_RED | __LED_GREEN))
#define CMD_WR(a,b) (((a) << 8) | (b) | __CMD_WR)
#define CMD_RD(a) (((a) << 8) | __CMD_RD)
@@ -94,21 +94,15 @@
extern spinlock_t ifacelock;
struct command {
- unsigned short address;
- unsigned char data;
- unsigned char ident;
- unsigned int flags;
- unsigned char cs_slot;
- unsigned char vpm_num; /* ignored for all but vpm commmands */
+ u8 data;
+ u8 ident;
+ u8 cs_slot;
+ u8 vpm_num; /* ignored for all but vpm commmands */
+ u16 address;
+ u32 flags;
struct list_head node;
struct completion complete;
};
-
-/* TODO
-struct cmdq {
- struct command cmds[MAX_COMMANDS];
-};
-*/
struct vpm150m;
@@ -131,30 +125,27 @@
unsigned int intcount;
int sync;
int dead;
- int blinktimer;
- int alarmtimer;
- int yellowtimer;
+ unsigned long blinktimer;
int ledlastvalue;
int alarms_read;
int checktiming; /* Set >0 to cause the timing source to be checked */
int loopupcnt;
int loopdowncnt;
- int initialized;
+ atomic_t initialized;
+ unsigned long alarmtimer;
int *chanmap;
unsigned char ledtestreg;
unsigned char ec_chunk1[32][DAHDI_CHUNKSIZE];
unsigned char ec_chunk2[32][DAHDI_CHUNKSIZE];
struct dahdi_span span; /* Span */
struct dahdi_chan *chans[32]; /* Channels */
- wait_queue_head_t regq;
- /* struct cmdq cmdq; */
struct command dummy; /* preallocate for dummy noop command */
unsigned char ctlreg;
unsigned int rxints;
unsigned int txints;
int usecount;
struct voicebus* vb;
- unsigned int isrreaderrors;
+ atomic_t isrreaderrors;
#ifdef VPM_SUPPORT
int vpm;
struct vpm150m *vpm150m;
@@ -162,7 +153,7 @@
unsigned long dtmfmask;
unsigned long dtmfmutemask;
#endif
- /* Preallocted memory for the commands. */
+ /* Preallocted memory for the commands. TODO remove this. */
struct command cmds[MAX_COMMANDS];
/* The lists we're interested in. */
@@ -170,7 +161,8 @@
struct list_head pending_cmds;
struct list_head active_cmds;
struct list_head free_cmds;
- struct list_head complete_isr_read_cmds;
+ struct timer_list timer;
+ struct work_struct timer_work;
};
More information about the svn-commits
mailing list