[libvirt] [PATCH 1/5] qemu: address: Handle all the video devices within a single loop

Erik Skultety posted 5 patches 7 years, 7 months ago
There is a newer version of this series
[libvirt] [PATCH 1/5] qemu: address: Handle all the video devices within a single loop
Posted by Erik Skultety 7 years, 7 months ago
We've been handling the primary video device separately from all the
other ones when in fact the code to do that was the same. Therefore,
let's handle all the devices within the existing 'for' loop.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
---
 src/qemu/qemu_domain_address.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index e9f460d77a..ab2ac022f1 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -2103,15 +2103,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def,
             goto error;
     }
 
-    /* Assign a PCI slot to the primary video card if there is not an
-     * assigned address. */
-    if (def->nvideos > 0 &&
-        virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) {
-        if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->info) < 0)
-            goto error;
-    }
+    /* Video devices */
+    for (i = 0; i < def->nvideos; i++) {
 
-    for (i = 1; i < def->nvideos; i++) {
         if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info))
             continue;
 
-- 
2.14.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 1/5] qemu: address: Handle all the video devices within a single loop
Posted by John Ferlan 7 years, 7 months ago

On 06/28/2018 08:14 AM, Erik Skultety wrote:
> We've been handling the primary video device separately from all the
> other ones when in fact the code to do that was the same. Therefore,
> let's handle all the devices within the existing 'for' loop.
> 
> Signed-off-by: Erik Skultety <eskultet@redhat.com>
> ---
>  src/qemu/qemu_domain_address.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 

May be worthwhile to note that since commit id 133fb140 moved validation
of the video device type, thus now it's possible to combine the PCI
address checking into one for loop.

Reviewed-by: John Ferlan <jferlan@redhat.com>

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list