From c6df6f5322f7004c71216391e1c0b374d853704a Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 9 Dec 2021 17:04:45 -0700 Subject: Create wrapper for Giant taken for newbus Create a wrapper for newbus to take giant and for busses to take it too. bus_topo_lock() should be called before interacting with newbus routines and unlocked with bus_topo_unlock(). If you need the topology lock for some reason, bus_topo_mtx() will provide that. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D31831 --- sys/dev/drm2/drm_dp_iic_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/dev/drm2') diff --git a/sys/dev/drm2/drm_dp_iic_helper.c b/sys/dev/drm2/drm_dp_iic_helper.c index 35318c11c388..c3f980a3342f 100644 --- a/sys/dev/drm2/drm_dp_iic_helper.c +++ b/sys/dev/drm2/drm_dp_iic_helper.c @@ -228,12 +228,12 @@ iic_dp_aux_add_bus(device_t dev, const char *name, int idx, error; static int dp_bus_counter; - mtx_lock(&Giant); + bus_topo_lock(); idx = atomic_fetchadd_int(&dp_bus_counter, 1); ibus = device_add_child(dev, "drm_iic_dp_aux", idx); if (ibus == NULL) { - mtx_unlock(&Giant); + bus_topo_unlock(); DRM_ERROR("drm_iic_dp_aux bus %d creation error\n", idx); return (-ENXIO); } @@ -241,7 +241,7 @@ iic_dp_aux_add_bus(device_t dev, const char *name, error = device_probe_and_attach(ibus); if (error != 0) { device_delete_child(dev, ibus); - mtx_unlock(&Giant); + bus_topo_unlock(); DRM_ERROR("drm_iic_dp_aux bus %d attach failed, %d\n", idx, error); return (-error); @@ -256,7 +256,7 @@ iic_dp_aux_add_bus(device_t dev, const char *name, *bus = ibus; *adapter = data->port; } - mtx_unlock(&Giant); + bus_topo_unlock(); return (-error); } -- cgit v1.3