[dahdi-commits] sruffell: linux/trunk r10395 - /linux/trunk/drivers/dahdi/wct4xxp/base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Tue Jan 3 13:25:46 CST 2012


Author: sruffell
Date: Tue Jan  3 13:25:42 2012
New Revision: 10395

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10395
Log:
wct4xxp: Reduce time spent waiting for auth done bit on TE820.

It is not necessary to wait a full second for the donebit.

Signed-off-by: Shaun Ruffell <sruffell at digium.com>
Acked-by: Russ Meyerriecks <rmeyerriecks at digium.com>

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

Modified: linux/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=10395&r1=10394&r2=10395
==============================================================================
--- linux/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ linux/trunk/drivers/dahdi/wct4xxp/base.c Tue Jan  3 13:25:42 2012
@@ -4888,19 +4888,21 @@
 
 	/* TE820 Auth Check */
 	if (is_octal(wc)) {
+		unsigned long stop = jiffies + HZ;
 		uint32_t donebit;
 
+		t4_pci_out(wc, WC_LEDS2, WC_SET_AUTH);
 		donebit = t4_pci_in(wc, WC_LEDS2);
-		t4_pci_out(wc, WC_LEDS2, WC_SET_AUTH);
-
-		msleep(1000);
-
-		donebit = t4_pci_in(wc, WC_LEDS2);
-		if (!(donebit & WC_GET_AUTH)) {
-			/* Encryption check failed, stop operation */
-			dev_info(&wc->dev->dev, "Failed encryption check. "\
-						"Unloading driver.\n");
-			return -EIO;
+		while (!(donebit & WC_GET_AUTH)) {
+			if (time_after(jiffies, stop)) {
+				/* Encryption check failed, stop operation */
+				dev_info(&wc->dev->dev,
+					 "Failed encryption check. "
+					 "Unloading driver.\n");
+				return -EIO;
+			}
+			msleep(20);
+			donebit = t4_pci_in(wc, WC_LEDS2);
 		}
 	}
 




More information about the dahdi-commits mailing list