[dahdi-commits] sruffell: linux/trunk r8124 - /linux/trunk/drivers/dahdi/wctdm24xxp/base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Fri Feb 26 10:40:56 CST 2010


Author: sruffell
Date: Fri Feb 26 10:40:45 2010
New Revision: 8124

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=8124
Log:
wctdm24xxp: Do not assume CONFIG_HZ==100 for delays.

Modified:
    linux/trunk/drivers/dahdi/wctdm24xxp/base.c

Modified: linux/trunk/drivers/dahdi/wctdm24xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wctdm24xxp/base.c?view=diff&rev=8124&r1=8123&r2=8124
==============================================================================
--- linux/trunk/drivers/dahdi/wctdm24xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wctdm24xxp/base.c Fri Feb 26 10:40:45 2010
@@ -1246,13 +1246,11 @@
 static int wait_access(struct wctdm *wc, int card)
 {
     unsigned char data=0;
-    long origjiffies;
     int count = 0;
 
     #define MAX 10 /* attempts */
 
 
-    origjiffies = jiffies;
     /* Wait for indirect access */
     while (count++ < MAX)
 	 {
@@ -2263,9 +2261,7 @@
 
 /*******************************The following is the manual gain mismatch calibration****************************/
 /*******************************This is also available as a function *******************************************/
-	// Delay 10ms
-	origjiffies=jiffies; 
-	while ((jiffies-origjiffies) < 1);
+	msleep(10);
 	wctdm_proslic_setreg_indirect(wc, card, 88,0);
 	wctdm_proslic_setreg_indirect(wc,card,89,0);
 	wctdm_proslic_setreg_indirect(wc,card,90,0);
@@ -2279,8 +2275,7 @@
 	for ( i=0x1f; i>0; i--)
 	{
 		wctdm_setreg(wc, card, 98,i);
-		origjiffies=jiffies; 
-		while ((jiffies-origjiffies) < 4);
+		msleep(40);
 		if ((wctdm_getreg(wc, card, 88)) == 0)
 			break;
 	} // for
@@ -2288,8 +2283,7 @@
 	for ( i=0x1f; i>0; i--)
 	{
 		wctdm_setreg(wc, card, 99,i);
-		origjiffies=jiffies; 
-		while ((jiffies-origjiffies) < 4);
+		msleep(40);
 		if ((wctdm_getreg(wc, card, 89)) == 0)
 			break;
 	}//for
@@ -2297,8 +2291,7 @@
 /*******************************The preceding is the manual gain mismatch calibration****************************/
 /**********************************The following is the longitudinal Balance Cal***********************************/
 	wctdm_setreg(wc,card,64,1);
-	while ((jiffies-origjiffies) < 10) /*  Sleep 100? */
-		;
+	msleep(100);
 
 	wctdm_setreg(wc, card, 64, 0);
 	wctdm_setreg(wc, card, 23, 0x4);  // enable interrupt for the balance Cal
@@ -2329,7 +2322,7 @@
 	/* Wait for it to finish */
 	origjiffies = jiffies;
 	while (wctdm_getreg(wc, card, 96)) {
-		if ((jiffies - origjiffies) > 2 * HZ) {
+		if (time_after(jiffies, (origjiffies + (2*HZ)))) {
 			dev_notice(&wc->vb.pdev->dev, "Timeout waiting for calibration of module %d\n", card);
 			return -1;
 		}




More information about the dahdi-commits mailing list