summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2012-01-03 19:25:42 +0000
committerShaun Ruffell <sruffell@digium.com>2012-01-03 19:25:42 +0000
commitaee885b93bc0185a829b98aa45f5616b3d4b6789 (patch)
treeba6fdae6628370ce6f1fe98c051f931b956cbf82
parent1e69005f8ecaac520232f22d889feb553752e48e (diff)
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@digium.com> Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10395 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r--drivers/dahdi/wct4xxp/base.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/dahdi/wct4xxp/base.c b/drivers/dahdi/wct4xxp/base.c
index c91ce59..7127561 100644
--- a/drivers/dahdi/wct4xxp/base.c
+++ b/drivers/dahdi/wct4xxp/base.c
@@ -4888,19 +4888,21 @@ static int t4_hardware_init_1(struct t4 *wc, unsigned int cardflags)
/* TE820 Auth Check */
if (is_octal(wc)) {
+ unsigned long stop = jiffies + HZ;
uint32_t donebit;
- 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);
}
}