Index: sys/dev/acpica/acpi.c =================================================================== --- sys/dev/acpica/acpi.c +++ sys/dev/acpica/acpi.c @@ -738,7 +738,7 @@ { int error; - GIANT_REQUIRED; + bus_topo_assert(); error = bus_generic_suspend(dev); if (error == 0) @@ -751,7 +751,7 @@ acpi_resume(device_t dev) { - GIANT_REQUIRED; + bus_topo_assert(); acpi_set_power_children(dev, ACPI_STATE_D0); @@ -762,7 +762,7 @@ acpi_shutdown(device_t dev) { - GIANT_REQUIRED; + bus_topo_assert(); /* Allow children to shutdown first. */ bus_generic_shutdown(dev); Index: sys/dev/bhnd/bhnd.c =================================================================== --- sys/dev/bhnd/bhnd.c +++ sys/dev/bhnd/bhnd.c @@ -374,7 +374,7 @@ u_int max_latency; int error; - GIANT_REQUIRED; /* for newbus */ + bus_topo_assert(); if (device_get_parent(child) != dev) return (EINVAL); @@ -490,7 +490,7 @@ struct bhnd_resource *r; device_t pmu_dev; - GIANT_REQUIRED; /* for newbus */ + bus_topo_assert(); sc = device_get_softc(dev); Index: sys/dev/bhnd/bhnd_subr.c =================================================================== --- sys/dev/bhnd/bhnd_subr.c +++ sys/dev/bhnd/bhnd_subr.c @@ -2185,8 +2185,7 @@ device_t nvram; device_t parent; - /* Make sure we're holding Giant for newbus */ - GIANT_REQUIRED; + bus_topo_assert(); /* Look for a directly-attached NVRAM child */ if ((nvram = device_find_child(dev, "bhnd_nvram", -1)) != NULL) Index: sys/dev/hid/hidbus.c =================================================================== --- sys/dev/hid/hidbus.c +++ sys/dev/hid/hidbus.c @@ -544,7 +544,7 @@ device_t *children, child; int ccount, i; - GIANT_REQUIRED; + bus_topo_assert(); /* Get a list of all hidbus children */ if (device_get_children(bus, &children, &ccount) != 0) @@ -724,7 +724,7 @@ bool is_bus; int error; - GIANT_REQUIRED; + bus_topo_assert(); is_bus = device_get_devclass(dev) == hidbus_devclass; bus = is_bus ? dev : device_get_parent(dev); Index: sys/dev/hid/hmt.c =================================================================== --- sys/dev/hid/hmt.c +++ sys/dev/hid/hmt.c @@ -869,7 +869,7 @@ device_t hconf; int err; - GIANT_REQUIRED; + bus_topo_assert(); /* Find touchpad's configuration TLC */ hconf = hidbus_find_child(device_get_parent(sc->dev), @@ -886,7 +886,7 @@ if (device_get_devclass(hconf) != hconf_devclass) return (ENXIO); - /* hconf_set_input_mode can drop the Giant while sleeping */ + /* hconf_set_input_mode can drop the the topo lock while sleeping */ device_busy(hconf); err = hconf_set_input_mode(hconf, mode); device_unbusy(hconf); Index: sys/kern/subr_bus.c =================================================================== --- sys/kern/subr_bus.c +++ sys/kern/subr_bus.c @@ -867,6 +867,13 @@ DEFINE_CLASS(null, null_methods, 0); +void +bus_topo_assert() +{ + + GIANT_REQUIRED; +} + struct mtx * bus_topo_mtx(void) { @@ -2101,7 +2108,7 @@ int result, pri = 0; int hasclass = (child->devclass != NULL); - GIANT_REQUIRED; + bus_topo_assert(); dc = dev->devclass; if (!dc) @@ -2925,7 +2932,7 @@ { int error; - GIANT_REQUIRED; + bus_topo_assert(); if (dev->state >= DS_ALIVE && (dev->flags & DF_REBID) == 0) return (-1); @@ -2959,7 +2966,7 @@ { int error; - GIANT_REQUIRED; + bus_topo_assert(); error = device_probe(dev); if (error == -1) @@ -3057,7 +3064,7 @@ { int error; - GIANT_REQUIRED; + bus_topo_assert(); PDEBUG(("%s", DEVICENAME(dev))); if (dev->busy > 0) Index: sys/sys/bus.h =================================================================== --- sys/sys/bus.h +++ sys/sys/bus.h @@ -742,6 +742,7 @@ void bus_topo_lock(void); void bus_topo_unlock(void); struct mtx * bus_topo_mtx(void); +void bus_topo_assert(void); /** * Shorthands for constructing method tables.