[PATCH 2/8] cpu: Make comparing PowerPC CPUs easier to read

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

 



Revert the condition to make it easier to read. The function is also
renamed as ppcCompare to match other functions in PowerPC CPU driver.
---
 src/cpu/cpu_powerpc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index ac10789..832ec97 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -414,15 +414,14 @@ no_memory:
 }
 
 static virCPUCompareResult
-PowerPCCompare(virCPUDefPtr host,
+ppcCompare(virCPUDefPtr host,
            virCPUDefPtr cpu)
 {
-    if ((cpu->arch != VIR_ARCH_NONE &&
-         (host->arch != cpu->arch)) ||
-        STRNEQ(host->model, cpu->model))
-        return VIR_CPU_COMPARE_INCOMPATIBLE;
+    if ((cpu->arch == VIR_ARCH_NONE || host->arch == cpu->arch) &&
+        STREQ(host->model, cpu->model))
+        return VIR_CPU_COMPARE_IDENTICAL;
 
-    return VIR_CPU_COMPARE_IDENTICAL;
+    return VIR_CPU_COMPARE_INCOMPATIBLE;
 }
 
 static int
@@ -630,7 +629,7 @@ struct cpuArchDriver cpuDriverPowerPC = {
     .name = "ppc64",
     .arch = archs,
     .narch = ARRAY_CARDINALITY(archs),
-    .compare    = PowerPCCompare,
+    .compare    = ppcCompare,
     .decode     = PowerPCDecode,
     .encode     = NULL,
     .free       = PowerPCDataFree,
-- 
1.8.0.2

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


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]