Patchwork [09/27] pc: pc_init1(): get QEMUMachineInitArgs argument

login
register
mail settings
Submitter Eduardo Habkost
Date Oct. 24, 2012, 5:49 p.m.
Message ID <1351101001-14589-10-git-send-email-ehabkost@redhat.com>
Download mbox | patch
Permalink /patch/193898/
State New
Headers show

Comments

Eduardo Habkost - Oct. 24, 2012, 5:49 p.m.
Instead of passing each QEMUMachineInitArgs field individually, just
pass the whole QEMUMachineInitArgs object to pc_init1().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 hw/pc_piix.c | 47 ++++++++++++-----------------------------------
 1 file changed, 12 insertions(+), 35 deletions(-)

Patch

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 5093ce5..3eaed60 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -118,12 +118,7 @@  static void ioapic_init(GSIState *gsi_state)
 }
 
 /* PC hardware initialisation */
-static void pc_init1(ram_addr_t ram_size,
-                     const char *boot_device,
-                     const char *kernel_filename,
-                     const char *kernel_cmdline,
-                     const char *initrd_filename,
-                     const char *cpu_model,
+static void pc_init1(QEMUMachineInitArgs *args,
                      int pci_enabled,
                      int kvmclock_enabled)
 {
@@ -148,6 +143,12 @@  static void pc_init1(ram_addr_t ram_size,
     MemoryRegion *system_memory = get_system_memory();
     MemoryRegion *system_io = get_system_io();
     void *fw_cfg = NULL;
+    ram_addr_t ram_size = args->ram_size;
+    const char *cpu_model = args->cpu_model;
+    const char *kernel_filename = args->kernel_filename;
+    const char *kernel_cmdline = args->kernel_cmdline;
+    const char *initrd_filename = args->initrd_filename;
+    const char *boot_device = args->boot_device;
 
     pc_cpus_init(cpu_model);
 
@@ -289,43 +290,19 @@  static void pc_init1(ram_addr_t ram_size,
 
 static void pc_init_pci(QEMUMachineInitArgs *args)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_device;
-    pc_init1(ram_size, boot_device,
-             kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 1, 1);
+    pc_init1(args, 1, 1);
 }
 
 static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_device;
-    pc_init1(ram_size, boot_device,
-             kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 1, 0);
+    pc_init1(args, 1, 0);
 }
 
 static void pc_init_isa(QEMUMachineInitArgs *args)
 {
-    ram_addr_t ram_size = args->ram_size;
-    const char *cpu_model = args->cpu_model;
-    const char *kernel_filename = args->kernel_filename;
-    const char *kernel_cmdline = args->kernel_cmdline;
-    const char *initrd_filename = args->initrd_filename;
-    const char *boot_device = args->boot_device;
-    if (cpu_model == NULL)
-        cpu_model = "486";
-    pc_init1(ram_size, boot_device,
-             kernel_filename, kernel_cmdline,
-             initrd_filename, cpu_model, 0, 1);
+    if (args->cpu_model == NULL)
+        args->cpu_model = "486";
+    pc_init1(args, 0, 1);
 }
 
 #ifdef CONFIG_XEN