Remove some strange code that allocates memory and then immediately

frees it again. The idea was to perform M_WAITOK allocations in a
process context to reduce the risk of later interrupt-context
M_NOWAIT allocations failing, but in fact this code can be called
from contexts where it is not desirable to sleep (e.g. if_start
routines), so it causes lots of witness "could sleep" warnings.
This commit is contained in:
Ian Dowse 2002-07-30 23:26:22 +00:00
parent 04f3985d88
commit b4dc6ff9bc

View File

@ -581,32 +581,8 @@ uhci_detach(struct uhci_softc *sc, int flags)
usbd_status
uhci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size)
{
struct uhci_softc *sc = (struct uhci_softc *)bus;
u_int32_t n;
/*
* XXX
* Since we are allocating a buffer we can assume that we will
* need TDs for it. Since we don't want to allocate those from
* an interrupt context, we allocate them here and free them again.
* This is no guarantee that we'll get the TDs next time...
*/
n = size / 8;
if (n > 16) {
u_int32_t i;
uhci_soft_td_t **stds;
DPRINTF(("uhci_allocm: get %d TDs\n", n));
stds = malloc(sizeof(uhci_soft_td_t *) * n, M_TEMP,
M_WAITOK|M_ZERO);
for(i=0; i < n; i++)
stds[i] = uhci_alloc_std(sc);
for(i=0; i < n; i++)
if (stds[i] != NULL)
uhci_free_std(sc, stds[i]);
free(stds, M_TEMP);
}
return (usb_allocmem(&sc->sc_bus, size, 0, dma));
return (usb_allocmem(&((struct uhci_softc *)bus)->sc_bus, size, 0,
dma));
}
void