Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/virtio/random/virtio_random.c
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Lines | vtrnd_detach(device_t dev) | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
KASSERT( | KASSERT( | ||||
atomic_load_explicit(&g_vtrnd_softc, memory_order_acquire) == sc, | atomic_load_explicit(&g_vtrnd_softc, memory_order_acquire) == sc, | ||||
("only one global instance at a time")); | ("only one global instance at a time")); | ||||
random_source_deregister(&random_vtrnd); | random_source_deregister(&random_vtrnd); | ||||
atomic_store_explicit(&g_vtrnd_softc, NULL, memory_order_release); | atomic_store_explicit(&g_vtrnd_softc, NULL, memory_order_release); | ||||
/* | |||||
* Unfortunately, deregister does not guarantee our source callback | |||||
* will not be invoked after it returns. Use a kludge to prevent some, | |||||
* but not all, possible races. | |||||
*/ | |||||
tsleep_sbt(&g_vtrnd_softc, 0, "vtrnddet", mstosbt(50), 0, C_HARDCLOCK); | |||||
return (0); | return (0); | ||||
markm: Yay!! | |||||
} | } | ||||
static void | static void | ||||
vtrnd_negotiate_features(device_t dev) | vtrnd_negotiate_features(device_t dev) | ||||
{ | { | ||||
struct vtrnd_softc *sc; | struct vtrnd_softc *sc; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |
Yay!!