Apparently, the probe routine in if_ndis_usb.c can be called twice

for a given device in some circumstances, so move the PDO creation
to the attach routine so we don't end up creating two PDOs.

Also, when we skip the call to ndis_convert_res() in if_ndis.c:ndis_attach(),
initialize sc->ndis_block->nmb_rlist to NULL. We don't explicitly zero
the miniport block, so this will make sure ndis_unload_driver() does
the right thing.
This commit is contained in:
wpaul 2005-02-24 22:54:15 +00:00
parent b5521d6df7
commit 9ad2b03bb5
2 changed files with 9 additions and 9 deletions

View File

@ -508,6 +508,8 @@ ndis_attach(dev)
/* Do resource conversion. */
if (sc->ndis_iftype == PCMCIABus || sc->ndis_iftype == PCIBus)
ndis_convert_res(sc);
else
sc->ndis_block->nmb_rlist = NULL;
/* Install our RX and TX interrupt handlers. */
sc->ndis_block->nmb_senddone_func = ndis_txeof_wrap;

View File

@ -129,18 +129,10 @@ DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0);
USB_MATCH(ndisusb)
{
USB_MATCH_START(ndisusb, uaa);
driver_object *drv;
drv = windrv_lookup(NULL, "USB Bus");
if (drv == NULL)
if (windrv_lookup(NULL, "USB Bus") == NULL)
return(UMATCH_NONE);
if (0) {
/* Create PDO for this device instance */
windrv_create_pdo(drv, self);
return(0);
}
if (uaa->iface != NULL)
return(UMATCH_NONE);
@ -151,11 +143,17 @@ USB_ATTACH(ndisusb)
{
USB_ATTACH_START(ndisusb, dummy, uaa);
struct ndis_softc *sc;
driver_object *drv;
sc = (struct ndis_softc *)dummy;
sc->ndis_dev = self;
/* Create PDO for this device instance */
drv = windrv_lookup(NULL, "USB Bus");
windrv_create_pdo(drv, self);
if (ndis_attach(self) != 0)
USB_ATTACH_ERROR_RETURN;