render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
7a3408
From 7109e51ae80c27f817fd6f88fe4006099c6fa83c Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <7109e51ae80c27f817fd6f88fe4006099c6fa83c@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Tue, 11 Aug 2015 17:15:56 +0200
7a3408
Subject: [PATCH] cpu: Reorder functions in the ppc64 driver
7a3408
7a3408
Having the functions grouped together this way will avoid further
7a3408
shuffling around down the line.
7a3408
7a3408
No functional changes.
7a3408
7a3408
(cherry picked from commit b85b51f2a5254287ffcb28ebd6f744d857481afc)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1250977
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/cpu/cpu_ppc64.c | 129 +++++++++++++++++++++++++---------------------------
7a3408
 1 file changed, 63 insertions(+), 66 deletions(-)
7a3408
7a3408
diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
7a3408
index 18dbf86..5921263 100644
7a3408
--- a/src/cpu/cpu_ppc64.c
7a3408
+++ b/src/cpu/cpu_ppc64.c
7a3408
@@ -57,6 +57,32 @@ struct ppc64_map {
7a3408
     struct ppc64_model *models;
7a3408
 };
7a3408
 
7a3408
+static void
7a3408
+ppc64VendorFree(struct ppc64_vendor *vendor)
7a3408
+{
7a3408
+    if (!vendor)
7a3408
+        return;
7a3408
+
7a3408
+    VIR_FREE(vendor->name);
7a3408
+    VIR_FREE(vendor);
7a3408
+}
7a3408
+
7a3408
+static struct ppc64_vendor *
7a3408
+ppc64VendorFind(const struct ppc64_map *map,
7a3408
+                const char *name)
7a3408
+{
7a3408
+    struct ppc64_vendor *vendor;
7a3408
+
7a3408
+    vendor = map->vendors;
7a3408
+    while (vendor) {
7a3408
+        if (STREQ(vendor->name, name))
7a3408
+            return vendor;
7a3408
+
7a3408
+        vendor = vendor->next;
7a3408
+    }
7a3408
+
7a3408
+    return NULL;
7a3408
+}
7a3408
 
7a3408
 static void
7a3408
 ppc64ModelFree(struct ppc64_model *model)
7a3408
@@ -69,6 +95,23 @@ ppc64ModelFree(struct ppc64_model *model)
7a3408
 }
7a3408
 
7a3408
 static struct ppc64_model *
7a3408
+ppc64ModelCopy(const struct ppc64_model *model)
7a3408
+{
7a3408
+    struct ppc64_model *copy;
7a3408
+
7a3408
+    if (VIR_ALLOC(copy) < 0 ||
7a3408
+        VIR_STRDUP(copy->name, model->name) < 0) {
7a3408
+        ppc64ModelFree(copy);
7a3408
+        return NULL;
7a3408
+    }
7a3408
+
7a3408
+    copy->data.pvr = model->data.pvr;
7a3408
+    copy->vendor = model->vendor;
7a3408
+
7a3408
+    return copy;
7a3408
+}
7a3408
+
7a3408
+static struct ppc64_model *
7a3408
 ppc64ModelFind(const struct ppc64_map *map,
7a3408
                const char *name)
7a3408
 {
7a3408
@@ -111,50 +154,6 @@ ppc64ModelFindPVR(const struct ppc64_map *map,
7a3408
 }
7a3408
 
7a3408
 static struct ppc64_model *
7a3408
-ppc64ModelCopy(const struct ppc64_model *model)
7a3408
-{
7a3408
-    struct ppc64_model *copy;
7a3408
-
7a3408
-    if (VIR_ALLOC(copy) < 0 ||
7a3408
-        VIR_STRDUP(copy->name, model->name) < 0) {
7a3408
-        ppc64ModelFree(copy);
7a3408
-        return NULL;
7a3408
-    }
7a3408
-
7a3408
-    copy->data.pvr = model->data.pvr;
7a3408
-    copy->vendor = model->vendor;
7a3408
-
7a3408
-    return copy;
7a3408
-}
7a3408
-
7a3408
-static struct ppc64_vendor *
7a3408
-ppc64VendorFind(const struct ppc64_map *map,
7a3408
-                const char *name)
7a3408
-{
7a3408
-    struct ppc64_vendor *vendor;
7a3408
-
7a3408
-    vendor = map->vendors;
7a3408
-    while (vendor) {
7a3408
-        if (STREQ(vendor->name, name))
7a3408
-            return vendor;
7a3408
-
7a3408
-        vendor = vendor->next;
7a3408
-    }
7a3408
-
7a3408
-    return NULL;
7a3408
-}
7a3408
-
7a3408
-static void
7a3408
-ppc64VendorFree(struct ppc64_vendor *vendor)
7a3408
-{
7a3408
-    if (!vendor)
7a3408
-        return;
7a3408
-
7a3408
-    VIR_FREE(vendor->name);
7a3408
-    VIR_FREE(vendor);
7a3408
-}
7a3408
-
7a3408
-static struct ppc64_model *
7a3408
 ppc64ModelFromCPU(const virCPUDef *cpu,
7a3408
                   const struct ppc64_map *map)
7a3408
 {
7a3408
@@ -169,6 +168,26 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
7a3408
     return ppc64ModelCopy(model);
7a3408
 }
7a3408
 
7a3408
+static void
7a3408
+ppc64MapFree(struct ppc64_map *map)
7a3408
+{
7a3408
+    if (!map)
7a3408
+        return;
7a3408
+
7a3408
+    while (map->models) {
7a3408
+        struct ppc64_model *model = map->models;
7a3408
+        map->models = model->next;
7a3408
+        ppc64ModelFree(model);
7a3408
+    }
7a3408
+
7a3408
+    while (map->vendors) {
7a3408
+        struct ppc64_vendor *vendor = map->vendors;
7a3408
+        map->vendors = vendor->next;
7a3408
+        ppc64VendorFree(vendor);
7a3408
+    }
7a3408
+
7a3408
+    VIR_FREE(map);
7a3408
+}
7a3408
 
7a3408
 static int
7a3408
 ppc64VendorLoad(xmlXPathContextPtr ctxt,
7a3408
@@ -293,27 +312,6 @@ ppc64MapLoadCallback(cpuMapElement element,
7a3408
     return 0;
7a3408
 }
7a3408
 
7a3408
-static void
7a3408
-ppc64MapFree(struct ppc64_map *map)
7a3408
-{
7a3408
-    if (!map)
7a3408
-        return;
7a3408
-
7a3408
-    while (map->models) {
7a3408
-        struct ppc64_model *model = map->models;
7a3408
-        map->models = model->next;
7a3408
-        ppc64ModelFree(model);
7a3408
-    }
7a3408
-
7a3408
-    while (map->vendors) {
7a3408
-        struct ppc64_vendor *vendor = map->vendors;
7a3408
-        map->vendors = vendor->next;
7a3408
-        ppc64VendorFree(vendor);
7a3408
-    }
7a3408
-
7a3408
-    VIR_FREE(map);
7a3408
-}
7a3408
-
7a3408
 static struct ppc64_map *
7a3408
 ppc64LoadMap(void)
7a3408
 {
7a3408
@@ -500,7 +498,6 @@ ppc64DriverDecode(virCPUDefPtr cpu,
7a3408
     return ret;
7a3408
 }
7a3408
 
7a3408
-
7a3408
 static void
7a3408
 ppc64DriverFree(virCPUDataPtr data)
7a3408
 {
7a3408
-- 
7a3408
2.5.0
7a3408