kernel: guarantee availability of drivers based on dependency levels

The question of how to handle a partially-restored world state begs for
an elegant symmetrical answer, but that doesn't work unless both kernels
do the save/restore for themselves. So far, things have worked out
because any order works since interrupts are disabled therefore
partially-restored drivers are inactive.

However the USB module requires waits that are best performed with
timers, so the order cannot be chosen arbitrarily. This commit enforces
a gint-centric order where code from a gint driver is only run when all
lower-level drivers are active. This solves some pretty bad freezes with
the USB module.
This commit is contained in:
Lephe 2021-04-11 18:36:07 +02:00
parent 18f9a18925
commit fb8d1525f4
No known key found for this signature in database
GPG key ID: 1BBA026E13FC0495

View file

@ -100,7 +100,7 @@ static void drivers_switch(int who)
/* Restore the other context */
ctx_restore(who ? &sys_ctx : &gint_ctx);
for driver_asc(d)
for driver_dsc(d)
{
if(!d->ctx_save || !d->ctx_restore) continue;
d->ctx_restore(who ? d->sys_ctx : d->gint_ctx);