qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 11/11] acpi_table_add(): extract acpi_tables count u


From: Eduardo Habkost
Subject: [Qemu-devel] [PATCH 11/11] acpi_table_add(): extract acpi_tables count update code to separate function
Date: Wed, 27 Jun 2012 17:23:07 -0300

This is the last change needed to eliminate all the
acpi_tables/acpi_tables_len math from acpi_table_add(), making that
function only take care of the under-construction table (the
newtable/newlen variables).

No behavior change, just code movement.

Signed-off-by: Eduardo Habkost <address@hidden>
---
 hw/acpi.c |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/hw/acpi.c b/hw/acpi.c
index 240e2cf..9611145 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -93,6 +93,18 @@ static char *acpi_newtable_resize(size_t newlen)
     return acpi_tables + acpi_tables_len;
 }
 
+/* Increase the acpi_tables table count, and adjust acpi_tables_len
+ */
+static void acpi_newtable_finished(size_t len)
+{
+    /* increase number of tables */
+    (*(uint16_t *)acpi_tables) =
+        cpu_to_le32(le32_to_cpu(*(uint16_t *)acpi_tables) + 1);
+
+    acpi_tables_len += len;
+}
+
+
 static int acpi_make_table_header(const char *t, bool has_header, char *f,
                                   size_t qemu_len)
 {
@@ -264,11 +276,7 @@ int acpi_table_add(const char *t)
         return -1;
     }
 
-    /* increase number of tables */
-    (*(uint16_t *)acpi_tables) =
-        cpu_to_le32(le32_to_cpu(*(uint16_t *)acpi_tables) + 1);
-
-    acpi_tables_len += newlen;
+    acpi_newtable_finished(newlen);
     return 0;
 
 }
-- 
1.7.10.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]