diff options
| author | Conrad Meyer <cem@FreeBSD.org> | 2019-05-27 00:55:46 +0000 |
|---|---|---|
| committer | Conrad Meyer <cem@FreeBSD.org> | 2019-05-27 00:55:46 +0000 |
| commit | af8f74ad14988f7cb8030dd31272e43d670b46c6 (patch) | |
| tree | d0d46573686877db90593b84c222a443bf570541 /sys/dev/virtio | |
| parent | b1adb000cdc2b7967ec035556f294d337e3ab117 (diff) | |
Notes
Diffstat (limited to 'sys/dev/virtio')
| -rw-r--r-- | sys/dev/virtio/random/virtio_random.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/sys/dev/virtio/random/virtio_random.c b/sys/dev/virtio/random/virtio_random.c index 15311b9e6fbc..01403fac77f5 100644 --- a/sys/dev/virtio/random/virtio_random.c +++ b/sys/dev/virtio/random/virtio_random.c @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include <dev/virtio/virtqueue.h> struct vtrnd_softc { - device_t vtrnd_dev; uint64_t vtrnd_features; struct callout vtrnd_callout; struct virtqueue *vtrnd_vq; @@ -58,8 +57,8 @@ static int vtrnd_probe(device_t); static int vtrnd_attach(device_t); static int vtrnd_detach(device_t); -static void vtrnd_negotiate_features(struct vtrnd_softc *); -static int vtrnd_alloc_virtqueue(struct vtrnd_softc *); +static void vtrnd_negotiate_features(device_t); +static int vtrnd_alloc_virtqueue(device_t); static void vtrnd_harvest(struct vtrnd_softc *); static void vtrnd_timer(void *); @@ -129,14 +128,13 @@ vtrnd_attach(device_t dev) int error; sc = device_get_softc(dev); - sc->vtrnd_dev = dev; callout_init(&sc->vtrnd_callout, 1); virtio_set_feature_desc(dev, vtrnd_feature_desc); - vtrnd_negotiate_features(sc); + vtrnd_negotiate_features(dev); - error = vtrnd_alloc_virtqueue(sc); + error = vtrnd_alloc_virtqueue(dev); if (error) { device_printf(dev, "cannot allocate virtqueue\n"); goto fail; @@ -164,24 +162,21 @@ vtrnd_detach(device_t dev) } static void -vtrnd_negotiate_features(struct vtrnd_softc *sc) +vtrnd_negotiate_features(device_t dev) { - device_t dev; - uint64_t features; - - dev = sc->vtrnd_dev; - features = VTRND_FEATURES; + struct vtrnd_softc *sc; - sc->vtrnd_features = virtio_negotiate_features(dev, features); + sc = device_get_softc(dev); + sc->vtrnd_features = virtio_negotiate_features(dev, VTRND_FEATURES); } static int -vtrnd_alloc_virtqueue(struct vtrnd_softc *sc) +vtrnd_alloc_virtqueue(device_t dev) { - device_t dev; + struct vtrnd_softc *sc; struct vq_alloc_info vq_info; - dev = sc->vtrnd_dev; + sc = device_get_softc(dev); VQ_ALLOC_INFO_INIT(&vq_info, 0, NULL, sc, &sc->vtrnd_vq, "%s request", device_get_nameunit(dev)); |
