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 <tzafrir.cohen@xorcom.com>
This commit is contained in:
parent
0469efb733
commit
2ad4dc555f
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user