Page MenuHomeFreeBSD

D31833.diff
No OneTemporary

D31833.diff

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -755,7 +755,7 @@
{
int error;
- GIANT_REQUIRED;
+ bus_topo_assert();
error = bus_generic_suspend(dev);
if (error == 0)
@@ -768,7 +768,7 @@
acpi_resume(device_t dev)
{
- GIANT_REQUIRED;
+ bus_topo_assert();
acpi_set_power_children(dev, ACPI_STATE_D0);
@@ -779,7 +779,7 @@
acpi_shutdown(device_t dev)
{
- GIANT_REQUIRED;
+ bus_topo_assert();
/* Allow children to shutdown first. */
bus_generic_shutdown(dev);
diff --git a/sys/dev/bhnd/bhnd.c b/sys/dev/bhnd/bhnd.c
--- a/sys/dev/bhnd/bhnd.c
+++ b/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);
diff --git a/sys/dev/bhnd/bhnd_subr.c b/sys/dev/bhnd/bhnd_subr.c
--- a/sys/dev/bhnd/bhnd_subr.c
+++ b/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)
diff --git a/sys/dev/hid/hidbus.c b/sys/dev/hid/hidbus.c
--- a/sys/dev/hid/hidbus.c
+++ b/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);
diff --git a/sys/dev/hid/hmt.c b/sys/dev/hid/hmt.c
--- a/sys/dev/hid/hmt.c
+++ b/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);
diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -377,6 +377,8 @@
int bmsr, first, i, nchildren, phymax, phymin, rv;
uint32_t phymask;
+ bus_topo_assert();
+
if (phyloc != MII_PHY_ANY && offloc != MII_OFFSET_ANY) {
printf("%s: phyloc and offloc specified\n", __func__);
return (EINVAL);
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
--- a/sys/kern/subr_bus.c
+++ b/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)
{
@@ -2102,7 +2109,7 @@
/* We should preserve the devclass (or lack of) set by the bus. */
int hasclass = (child->devclass != NULL);
- GIANT_REQUIRED;
+ bus_topo_assert();
dc = dev->devclass;
if (!dc)
@@ -2920,7 +2927,7 @@
{
int error;
- GIANT_REQUIRED;
+ bus_topo_assert();
if (dev->state >= DS_ALIVE)
return (-1);
@@ -2954,7 +2961,7 @@
{
int error;
- GIANT_REQUIRED;
+ bus_topo_assert();
error = device_probe(dev);
if (error == -1)
@@ -3052,7 +3059,7 @@
{
int error;
- GIANT_REQUIRED;
+ bus_topo_assert();
PDEBUG(("%s", DEVICENAME(dev)));
if (dev->busy > 0)
diff --git a/sys/sys/bus.h b/sys/sys/bus.h
--- a/sys/sys/bus.h
+++ b/sys/sys/bus.h
@@ -745,6 +745,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.

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 11, 4:03 AM (18 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15749882
Default Alt Text
D31833.diff (3 KB)

Event Timeline