982648
From b4c94ce2fb7d67af315c79a0f3ede70c36e85c70 Mon Sep 17 00:00:00 2001
982648
Message-Id: <b4c94ce2fb7d67af315c79a0f3ede70c36e85c70@dist-git>
982648
From: Erik Skultety <eskultet@redhat.com>
982648
Date: Thu, 19 Jul 2018 15:03:50 +0200
982648
Subject: [PATCH] qemu: address: Handle all the video devices within a single
982648
 loop
982648
MIME-Version: 1.0
982648
Content-Type: text/plain; charset=UTF-8
982648
Content-Transfer-Encoding: 8bit
982648
982648
Since 133fb140 moved the validation of a video device into a separate
982648
function, the code handling PCI slot assignment for video devices has
982648
been the same for both the primary device and the secondary devices.
982648
Let's merge these and thus handle all the devices within the existing
982648
'for' loop.
982648
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: John Ferlan <jferlan@redhat.com>
982648
(cherry picked from commit 3e90bd67a215adcb997b8c2be5d1d6b83251409f)
982648
982648
https://bugzilla.redhat.com/show_bug.cgi?id=1475770
982648
Signed-off-by: Erik Skultety <eskultet@redhat.com>
982648
Reviewed-by: Ján Tomko <jtomko@redhat.com>
982648
---
982648
 src/qemu/qemu_domain_address.c | 10 ++--------
982648
 1 file changed, 2 insertions(+), 8 deletions(-)
982648
982648
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
982648
index e9f460d77a..ab2ac022f1 100644
982648
--- a/src/qemu/qemu_domain_address.c
982648
+++ b/src/qemu/qemu_domain_address.c
982648
@@ -2103,15 +2103,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
982648
             goto error;
982648
     }
982648
 
982648
-    /* Assign a PCI slot to the primary video card if there is not an
982648
-     * assigned address. */
982648
-    if (def->nvideos > 0 &&
982648
-        virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
982648
-        if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->info) < 0)
982648
-            goto error;
982648
-    }
982648
+    /* Video devices */
982648
+    for (i = 0; i < def->nvideos; i++) {
982648
 
982648
-    for (i = 1; i < def->nvideos; i++) {
982648
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
982648
             continue;
982648
 
982648
-- 
982648
2.18.0
982648