From 9476c349dd4fa62258d11309fa008330834b68f1 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 12 Feb 2003 05:57:02 +0000 Subject: [PATCH] MFp4: 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. --- sys/dev/cardbus/cardbus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 01e7700746f..48a58fcf617 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -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)