diff options
author | Warner Losh <imp@FreeBSD.org> | 2021-12-09 23:52:55 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2021-12-10 00:04:58 +0000 |
commit | 96e500a3f9f0e317875b5d5c2097df804106bc3f (patch) | |
tree | ddb56268307b117a3f6f05a9e2a903bb9149c06f /sys/dev/sound/pci/hda/hdaa.c | |
parent | d14bc7230ba5c26de7d793ae3947e7571dc8fb7c (diff) | |
download | src-96e500a3f9f0e317875b5d5c2097df804106bc3f.tar.gz src-96e500a3f9f0e317875b5d5c2097df804106bc3f.zip |
hda: Push giant / newbus topo lock down a layer
Rather than picking up Giant at the start of these sysctl handlers, push
acquiring Giant down a layer to protect walking the children and also
to add/delete children for the reconfigure.
Sponsored by: Netflix
Reviewed by: mav, jhb
Differential Revision: https://reviews.freebsd.org/D33057
Diffstat (limited to 'sys/dev/sound/pci/hda/hdaa.c')
-rw-r--r-- | sys/dev/sound/pci/hda/hdaa.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/sound/pci/hda/hdaa.c b/sys/dev/sound/pci/hda/hdaa.c index 82c309996d75..ddc22c3bc139 100644 --- a/sys/dev/sound/pci/hda/hdaa.c +++ b/sys/dev/sound/pci/hda/hdaa.c @@ -6463,16 +6463,25 @@ hdaa_sysctl_reconfig(SYSCTL_HANDLER_ARGS) HDA_BOOTHVERBOSE( device_printf(dev, "Reconfiguration...\n"); ); - if ((error = device_delete_children(dev)) != 0) + + bus_topo_lock(); + + if ((error = device_delete_children(dev)) != 0) { + bus_topo_unlock(); return (error); + } hdaa_lock(devinfo); hdaa_unconfigure(dev); hdaa_configure(dev); hdaa_unlock(devinfo); bus_generic_attach(dev); + bus_topo_unlock(); HDA_BOOTHVERBOSE( device_printf(dev, "Reconfiguration done\n"); ); + + bus_topo_unlock(); + return (0); } @@ -6669,7 +6678,7 @@ hdaa_attach(device_t dev) devinfo, 0, hdaa_sysctl_gpo_config, "A", "GPO configuration"); SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, - "reconfig", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, + "reconfig", CTLTYPE_INT | CTLFLAG_RW, dev, 0, hdaa_sysctl_reconfig, "I", "Reprocess configuration"); SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, |