From: Asias He Date: Tue, 5 Jun 2012 16:40:42 +0000 (+0800) Subject: kvm tools: Fix compat message X-Git-Tag: next-20120724~32^2~103^2~2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=e3f105a5c6ff110bfec5a33e7e07c1aaed23621e;p=karo-tx-linux.git kvm tools: Fix compat message 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 Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c index b388d6613183..b4341b91e974 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 e442714186d3..a838ff463854 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 55ce26fc6386..c7dfc813a5cc 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 3493905e2f1a..4bb13652d23b 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 da4419815b0d..ae17eb5ea0d0 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 202104cfb784..5aa632d2f355 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: