diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2022-06-07 18:02:18 +0100 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2022-06-09 13:44:14 +0100 |
commit | a8e397bb9dd9ab651eaa43cb3b5293928f172d12 (patch) | |
tree | e998c2cbd1948bd55f86dd36d0f0436aa23d4fa4 | |
parent | 3a1e36e4bf499c5c98425f8a3f6c3df580404983 (diff) | |
download | kvmtool-a8e397bb9dd9ab651eaa43cb3b5293928f172d12.tar.gz |
virtio/vsock: Remove redundant state tracking
The core already tells us whether a device is being started or stopped.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Link: https://lore.kernel.org/r/20220607170239.120084-4-jean-philippe.brucker@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | virtio/vsock.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/virtio/vsock.c b/virtio/vsock.c index 64b4e95a..780169b1 100644 --- a/virtio/vsock.c +++ b/virtio/vsock.c @@ -31,7 +31,6 @@ struct vsock_dev { struct virtio_device vdev; struct list_head list; struct kvm *kvm; - bool started; }; static u8 *get_config(struct kvm *kvm, void *dev) @@ -140,15 +139,16 @@ static void notify_status(struct kvm *kvm, void *dev, u32 status) struct vsock_dev *vdev = dev; int r, start; - start = !!(status & VIRTIO_CONFIG_S_DRIVER_OK); - if (vdev->started == start) + if (status & VIRTIO__STATUS_START) + start = 1; + else if (status & VIRTIO__STATUS_STOP) + start = 0; + else return; r = ioctl(vdev->vhost_fd, VHOST_VSOCK_SET_RUNNING, &start); if (r != 0) die("VHOST_VSOCK_SET_RUNNING failed %d", errno); - - vdev->started = start; } static int notify_vq(struct kvm *kvm, void *dev, u32 vq) |