From 2ad4dc555f220aca8a2fa22eed88bb0f8b94865c Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Sun, 28 Jul 2013 16:12:00 +0300 Subject: [PATCH] xpp: fix waitfor_xpds race at startup * If userspace would run modprobe xpp_usb && cat /sys/bus/astribanks/devices/xbus-00/waitfor_xpds it would return immediately rather than wait for the Astribank to initialize. * We sometimes managed to read before getting the reply from the astribank. * Now we don't trust unit count at such an early stage. * Instread we wait for the Astribank to reach a stable state (READY or FAIL) before finish waiting for this astribank. Internal-Issue-ID: Xorcom-1502 Signed-off-by: Tzafrir Cohen --- drivers/dahdi/xpp/xbus-core.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c index ed589be..c2fb00f 100644 --- a/drivers/dahdi/xpp/xbus-core.c +++ b/drivers/dahdi/xpp/xbus-core.c @@ -1592,8 +1592,6 @@ static bool xpds_done(xbus_t *xbus) { if (XBUS_IS(xbus, FAIL)) return 1; /* Nothing to wait for */ - if (!XBUS_IS(xbus, RECVD_DESC)) - return 1; /* We are not in the initialization phase */ if (xbus->worker.xpds_init_done) return 1; /* All good */ /* Keep waiting */ @@ -1622,14 +1620,9 @@ int waitfor_xpds(xbus_t *xbus, char *buf) len = -ENODEV; goto out; } - if (worker->num_units == 0) { - XBUS_ERR(xbus, "No cards. Skipping.\n"); - goto out; - } XBUS_DBG(DEVICES, xbus, - "Waiting for card init of %d XPD's max %d seconds (%p)\n", - worker->num_units, INITIALIZATION_TIMEOUT / HZ, - &worker->wait_for_xpd_initialization); + "Waiting for card init of XPDs max %d seconds\n", + INITIALIZATION_TIMEOUT / HZ); ret = wait_event_interruptible_timeout(worker-> wait_for_xpd_initialization,