From 86901a4f35bf94ac804eaa86fbbadb8fab9fc807 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Sat, 19 Mar 2011 16:43:49 -0500 Subject: 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 --- drivers/dahdi/wctdm24xxp/base.c | 10 ++++++---- drivers/dahdi/wctdm24xxp/wctdm24xxp.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'drivers') 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 { -- cgit v1.2.3