Second part of the kldload patches for cardbus.  This makes
	kldload of a driver for a device that's inserted now appears
	to work.  To make it work, we only do a power cycle of the card
	if there's no children drivers attached.

	This likely is papering over bogosities in the power system.  The
	power sequence needs to be re-written, so I'll not worry about
	the papering over until the re-write.
This commit is contained in:
Warner Losh 2003-02-12 05:57:02 +00:00
parent 78b389be87
commit 9476c349dd

View File

@ -313,6 +313,17 @@ cardbus_driver_added(device_t cbdev, driver_t *driver)
DEVICE_IDENTIFY(driver, cbdev);
device_get_children(cbdev, &devlist, &numdevs);
/*
* If there are no drivers attached, but there are children,
* then power the card up.
*/
for (i = 0; i < numdevs; i++) {
dev = devlist[i];
if (device_get_state(dev) != DS_NOTPRESENT)
break;
}
if (i > 0 && i == numdevs)
POWER_ENABLE_SOCKET(device_get_parent(cbdev), cbdev);
for (i = 0; i < numdevs; i++) {
dev = devlist[i];
if (device_get_state(dev) != DS_NOTPRESENT)