[PATCH 2/3] kvm tools: Fix compat message

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

 



compat_id is initialized to -1 for each type of device. We should add
compat message if the compat_id == -1 which means we haven't added
compat message for this type of device.

Signed-off-by: Asias He <asias.hejun@xxxxxxxxx>
---
 tools/kvm/virtio/9p.c      |    2 +-
 tools/kvm/virtio/balloon.c |    2 +-
 tools/kvm/virtio/blk.c     |    2 +-
 tools/kvm/virtio/console.c |    2 +-
 tools/kvm/virtio/net.c     |    2 +-
 tools/kvm/virtio/rng.c     |    2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index b388d66..b4341b9 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -1312,7 +1312,7 @@ int virtio_9p__register(struct kvm *kvm, const char *root, const char *tag_name)
 
 	list_add(&p9dev->list, &devs);
 
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-9p", "CONFIG_NET_9P_VIRTIO");
 
 	return err;
diff --git a/tools/kvm/virtio/balloon.c b/tools/kvm/virtio/balloon.c
index e442714..a838ff4 100644
--- a/tools/kvm/virtio/balloon.c
+++ b/tools/kvm/virtio/balloon.c
@@ -262,6 +262,6 @@ void virtio_bln__init(struct kvm *kvm)
 	virtio_init(kvm, &bdev, &bdev.vdev, &bln_dev_virtio_ops,
 		    VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_BLN, VIRTIO_ID_BALLOON, PCI_CLASS_BLN);
 
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-balloon", "CONFIG_VIRTIO_BALLOON");
 }
diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index 55ce26f..c7dfc81 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -249,7 +249,7 @@ static int virtio_blk__init_one(struct kvm *kvm, struct disk_image *disk)
 
 	disk_image__set_callback(bdev->disk, virtio_blk_complete);
 
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-blk", "CONFIG_VIRTIO_BLK");
 	return 0;
 }
diff --git a/tools/kvm/virtio/console.c b/tools/kvm/virtio/console.c
index 3493905..4bb1365 100644
--- a/tools/kvm/virtio/console.c
+++ b/tools/kvm/virtio/console.c
@@ -188,6 +188,6 @@ void virtio_console__init(struct kvm *kvm)
 {
 	virtio_init(kvm, &cdev, &cdev.vdev, &con_dev_virtio_ops,
 		    VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_CONSOLE, VIRTIO_ID_CONSOLE, PCI_CLASS_CONSOLE);
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-console", "CONFIG_VIRTIO_CONSOLE");
 }
diff --git a/tools/kvm/virtio/net.c b/tools/kvm/virtio/net.c
index da44198..ae17eb5 100644
--- a/tools/kvm/virtio/net.c
+++ b/tools/kvm/virtio/net.c
@@ -547,6 +547,6 @@ void virtio_net__init(const struct virtio_net_params *params)
 	else
 		virtio_net__io_thread_init(params->kvm, ndev);
 
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-net", "CONFIG_VIRTIO_NET");
 }
diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c
index 202104c..5aa632d 100644
--- a/tools/kvm/virtio/rng.c
+++ b/tools/kvm/virtio/rng.c
@@ -170,7 +170,7 @@ int virtio_rng__init(struct kvm *kvm)
 
 	list_add_tail(&rdev->list, &rdevs);
 
-	if (compat_id != -1)
+	if (compat_id == -1)
 		compat_id = virtio_compat_add_message("virtio-rng", "CONFIG_HW_RANDOM_VIRTIO");
 	return 0;
 cleanup:
-- 
1.7.10.2

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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