[svn-commits] sruffell: branch linux/sruffell/wctdm24xxp-updates r10128 - /linux/team/sruff...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Aug 12 19:36:15 CDT 2011


Author: sruffell
Date: Fri Aug 12 19:36:11 2011
New Revision: 10128

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10128
Log:
wctdm24xxp: '% operator' -> 'time_after()'.

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 are not called for every tick.

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=10128&r1=10127&r2=10128
==============================================================================
--- 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:11 2011
@@ -1928,10 +1928,12 @@
 	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 == get_dahdi_chan(wc, mod)->rxhooksig)) {
@@ -2360,8 +2362,9 @@
 {
 	struct fxs *const fxs = &mod->mod.fxs;
 
-	if (!(wc->framecount % 10000)) {
+	if (time_after(wc->framecount, fxs->check_alarm)) {
 		/* Accept an alarm once per 10 seconds */
+		fxs->check_alarm = wc->framecount + (1000*10);
 		if (fxs->palarms)
 			fxs->palarms--;
 	}
@@ -2369,8 +2372,11 @@
 
 	wctdm_proslic_check_oppending(wc, mod);
 
-	if (!(wc->framecount & 0xfc))	/* every 256ms */
+	if (time_after(wc->framecount, fxs->check_proslic)) {
+		fxs->check_proslic = wc->framecount + 250; /* every 250ms */
 		wctdm_proslic_recheck_sanity(wc, mod);
+	}
+
 	if (SLIC_LF_RINGING == fxs->lasttxhook) {
 		/* RINGing, prepare for OHT */
 		fxs->ohttimer = OHT_TIMER << 3;

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=10128&r1=10127&r2=10128
==============================================================================
--- 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:11 2011
@@ -161,6 +161,7 @@
 	int neonmwi_last_voltage;
 	unsigned int neonmwi_debounce;
 	unsigned int neonmwi_offcounter;
+	unsigned long display_fxovoltage;
 };
 
 struct fxs {
@@ -187,6 +188,8 @@
 	int vmwi_linereverse;
 	int reversepolarity;	/* polarity reversal */
 	struct calregs calregs;
+	unsigned long check_alarm;
+	unsigned long check_proslic;
 };
 
 struct qrv {




More information about the svn-commits mailing list