diff options
author | Shaun Ruffell <sruffell@digium.com> | 2011-03-19 16:43:49 -0500 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2011-04-15 14:19:01 -0500 |
commit | 86901a4f35bf94ac804eaa86fbbadb8fab9fc807 (patch) | |
tree | 93937e223cc0014d0bceb6736d9626e0d2ddd8e1 | |
parent | ad05721aaa734fbf81a68b9738b51081da33e32f (diff) |
wctdm24xxp: Check current time is after expected time.
The modulo operator expects that the check function is called each and
every time the condition variable changes. If we switch to using
"time_after" macros and friends, we can still catch our condition even
if we're not called for every tick.
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
-rw-r--r-- | drivers/dahdi/wctdm24xxp/base.c | 10 | ||||
-rw-r--r-- | drivers/dahdi/wctdm24xxp/wctdm24xxp.h | 1 |
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/dahdi/wctdm24xxp/base.c b/drivers/dahdi/wctdm24xxp/base.c index 4968673..2fe0bdd 100644 --- a/drivers/dahdi/wctdm24xxp/base.c +++ b/drivers/dahdi/wctdm24xxp/base.c @@ -1815,10 +1815,12 @@ wctdm_voicedaa_check_hook(struct wctdm *wc, struct wctdm_module *const mod) b = mod->isrshadow[1]; /* Voltage */ abs_voltage = abs(b); - if (fxovoltage) { - if (!(wc->framecount % 100)) { - dev_info(&wc->vb.pdev->dev, "Port %d: Voltage: %d Debounce %d\n", mod->card + 1, b, fxo->battdebounce); - } + if (fxovoltage && time_after(wc->framecount, fxo->display_fxovoltage)) { + /* Every 100 ms */ + fxo->display_fxovoltage = wc->framecount + 100; + dev_info(&wc->vb.pdev->dev, + "Port %d: Voltage: %d Debounce %d\n", + mod->card + 1, b, fxo->battdebounce); } if (unlikely(DAHDI_RXSIG_INITIAL == mod->chan->chan.rxhooksig)) { diff --git a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h index 721d26c..535cf8e 100644 --- a/drivers/dahdi/wctdm24xxp/wctdm24xxp.h +++ b/drivers/dahdi/wctdm24xxp/wctdm24xxp.h @@ -158,6 +158,7 @@ struct fxo { int neonmwi_last_voltage; unsigned int neonmwi_debounce; unsigned int neonmwi_offcounter; + unsigned long display_fxovoltage; }; struct fxs { |