render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 7109e51ae80c27f817fd6f88fe4006099c6fa83c Mon Sep 17 00:00:00 2001
Message-Id: <7109e51ae80c27f817fd6f88fe4006099c6fa83c@dist-git>
From: Andrea Bolognani <abologna@redhat.com>
Date: Tue, 11 Aug 2015 17:15:56 +0200
Subject: [PATCH] cpu: Reorder functions in the ppc64 driver

Having the functions grouped together this way will avoid further
shuffling around down the line.

No functional changes.

(cherry picked from commit b85b51f2a5254287ffcb28ebd6f744d857481afc)

Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1250977

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/cpu/cpu_ppc64.c | 129 +++++++++++++++++++++++++---------------------------
 1 file changed, 63 insertions(+), 66 deletions(-)

diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c
index 18dbf86..5921263 100644
--- a/src/cpu/cpu_ppc64.c
+++ b/src/cpu/cpu_ppc64.c
@@ -57,6 +57,32 @@ struct ppc64_map {
     struct ppc64_model *models;
 };
 
+static void
+ppc64VendorFree(struct ppc64_vendor *vendor)
+{
+    if (!vendor)
+        return;
+
+    VIR_FREE(vendor->name);
+    VIR_FREE(vendor);
+}
+
+static struct ppc64_vendor *
+ppc64VendorFind(const struct ppc64_map *map,
+                const char *name)
+{
+    struct ppc64_vendor *vendor;
+
+    vendor = map->vendors;
+    while (vendor) {
+        if (STREQ(vendor->name, name))
+            return vendor;
+
+        vendor = vendor->next;
+    }
+
+    return NULL;
+}
 
 static void
 ppc64ModelFree(struct ppc64_model *model)
@@ -69,6 +95,23 @@ ppc64ModelFree(struct ppc64_model *model)
 }
 
 static struct ppc64_model *
+ppc64ModelCopy(const struct ppc64_model *model)
+{
+    struct ppc64_model *copy;
+
+    if (VIR_ALLOC(copy) < 0 ||
+        VIR_STRDUP(copy->name, model->name) < 0) {
+        ppc64ModelFree(copy);
+        return NULL;
+    }
+
+    copy->data.pvr = model->data.pvr;
+    copy->vendor = model->vendor;
+
+    return copy;
+}
+
+static struct ppc64_model *
 ppc64ModelFind(const struct ppc64_map *map,
                const char *name)
 {
@@ -111,50 +154,6 @@ ppc64ModelFindPVR(const struct ppc64_map *map,
 }
 
 static struct ppc64_model *
-ppc64ModelCopy(const struct ppc64_model *model)
-{
-    struct ppc64_model *copy;
-
-    if (VIR_ALLOC(copy) < 0 ||
-        VIR_STRDUP(copy->name, model->name) < 0) {
-        ppc64ModelFree(copy);
-        return NULL;
-    }
-
-    copy->data.pvr = model->data.pvr;
-    copy->vendor = model->vendor;
-
-    return copy;
-}
-
-static struct ppc64_vendor *
-ppc64VendorFind(const struct ppc64_map *map,
-                const char *name)
-{
-    struct ppc64_vendor *vendor;
-
-    vendor = map->vendors;
-    while (vendor) {
-        if (STREQ(vendor->name, name))
-            return vendor;
-
-        vendor = vendor->next;
-    }
-
-    return NULL;
-}
-
-static void
-ppc64VendorFree(struct ppc64_vendor *vendor)
-{
-    if (!vendor)
-        return;
-
-    VIR_FREE(vendor->name);
-    VIR_FREE(vendor);
-}
-
-static struct ppc64_model *
 ppc64ModelFromCPU(const virCPUDef *cpu,
                   const struct ppc64_map *map)
 {
@@ -169,6 +168,26 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
     return ppc64ModelCopy(model);
 }
 
+static void
+ppc64MapFree(struct ppc64_map *map)
+{
+    if (!map)
+        return;
+
+    while (map->models) {
+        struct ppc64_model *model = map->models;
+        map->models = model->next;
+        ppc64ModelFree(model);
+    }
+
+    while (map->vendors) {
+        struct ppc64_vendor *vendor = map->vendors;
+        map->vendors = vendor->next;
+        ppc64VendorFree(vendor);
+    }
+
+    VIR_FREE(map);
+}
 
 static int
 ppc64VendorLoad(xmlXPathContextPtr ctxt,
@@ -293,27 +312,6 @@ ppc64MapLoadCallback(cpuMapElement element,
     return 0;
 }
 
-static void
-ppc64MapFree(struct ppc64_map *map)
-{
-    if (!map)
-        return;
-
-    while (map->models) {
-        struct ppc64_model *model = map->models;
-        map->models = model->next;
-        ppc64ModelFree(model);
-    }
-
-    while (map->vendors) {
-        struct ppc64_vendor *vendor = map->vendors;
-        map->vendors = vendor->next;
-        ppc64VendorFree(vendor);
-    }
-
-    VIR_FREE(map);
-}
-
 static struct ppc64_map *
 ppc64LoadMap(void)
 {
@@ -500,7 +498,6 @@ ppc64DriverDecode(virCPUDefPtr cpu,
     return ret;
 }
 
-
 static void
 ppc64DriverFree(virCPUDataPtr data)
 {
-- 
2.5.0