[PATCH kvmtool 03/24] virtio/vsock: Remove redundant state tracking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The core already tells us whether a device is being started or stopped.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@xxxxxxx>
---
 virtio/vsock.c | 10 +++++-----
 1 file 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)
-- 
2.36.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux