diff options
| author | Alex Bennée <alex.bennee@linaro.org> | 2022-08-02 10:49:58 +0100 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2022-10-07 09:41:51 -0400 |
| commit | 9f6bcfd99f46377888059d8539befec9505f57fb (patch) | |
| tree | 7ebee167ba59b63f6c9058217b0f86c1336cd547 /hw/virtio/vhost-vsock.c | |
| parent | a27612311988aff8f29a68ed5eaecde3bf6cdf99 (diff) | |
| download | focaccia-qemu-9f6bcfd99f46377888059d8539befec9505f57fb.tar.gz focaccia-qemu-9f6bcfd99f46377888059d8539befec9505f57fb.zip | |
hw/virtio: move vm_running check to virtio_device_started
All the boilerplate virtio code does the same thing (or should at least) of checking to see if the VM is running before attempting to start VirtIO. Push the logic up to the common function to avoid getting a copy and paste wrong. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20220802095010.3330793-11-alex.bennee@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-vsock.c')
| -rw-r--r-- | hw/virtio/vhost-vsock.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c index 0338de892f..8031c164a5 100644 --- a/hw/virtio/vhost-vsock.c +++ b/hw/virtio/vhost-vsock.c @@ -70,13 +70,9 @@ static int vhost_vsock_set_running(VirtIODevice *vdev, int start) static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status) { VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev); - bool should_start = status & VIRTIO_CONFIG_S_DRIVER_OK; + bool should_start = virtio_device_started(vdev, status); int ret; - if (!vdev->vm_running) { - should_start = false; - } - if (vvc->vhost_dev.started == should_start) { return; } |