From 267bf33d97879c71356ea16a4e67a7391b697d66 Mon Sep 17 00:00:00 2001 From: Xiao Wang Date: Tue, 7 Jul 2015 09:18:54 +0200 Subject: [PATCH 080/100] virtio-pci: drop identical virtio_pci_cap Message-id: <1436260751-25015-52-git-send-email-jasowang@redhat.com> Patchwork-id: 66825 O-Subject: [RHEL7.2 qemu-kvm-rhev PATCH V2 51/68] virtio-pci: drop identical virtio_pci_cap Bugzilla: 1227343 RH-Acked-by: Michael S. Tsirkin RH-Acked-by: David Gibson RH-Acked-by: Laurent Vivier RH-Acked-by: Thomas Huth From: Gerd Hoffmann Now the three struct virtio_pci_caps are identical, lets drop two of them ;) Signed-off-by: Gerd Hoffmann Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin (cherry picked from commit cc52ea90f835aa66d431db712b22f8b15bec2e46) Signed-off-by: Miroslav Rezanina --- hw/virtio/virtio-pci.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c index 9c509e0..374b878 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -1341,16 +1341,8 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) if (modern) { - struct virtio_pci_cap common = { - .cap_len = sizeof common, - .bar = modern_mem_bar, - }; - struct virtio_pci_cap isr = { - .cap_len = sizeof isr, - .bar = modern_mem_bar, - }; - struct virtio_pci_cap device = { - .cap_len = sizeof device, + struct virtio_pci_cap cap = { + .cap_len = sizeof cap, .bar = modern_mem_bar, }; struct virtio_pci_notify_cap notify = { @@ -1367,9 +1359,9 @@ static void virtio_pci_device_plugged(DeviceState *d, Error **errp) 2 * QEMU_VIRTIO_PCI_QUEUE_MEM_MULT * VIRTIO_QUEUE_MAX); virtio_pci_modern_regions_init(proxy); - virtio_pci_modern_region_map(proxy, &proxy->common, &common); - virtio_pci_modern_region_map(proxy, &proxy->isr, &isr); - virtio_pci_modern_region_map(proxy, &proxy->device, &device); + virtio_pci_modern_region_map(proxy, &proxy->common, &cap); + virtio_pci_modern_region_map(proxy, &proxy->isr, &cap); + virtio_pci_modern_region_map(proxy, &proxy->device, &cap); virtio_pci_modern_region_map(proxy, &proxy->notify, ¬ify.cap); pci_register_bar(&proxy->pci_dev, modern_mem_bar, PCI_BASE_ADDRESS_SPACE_MEMORY | -- 1.8.3.1