diff mbox

[1/2] pc_init1: Don't misuse int for holding up a bool

Message ID e45d835a6916642c34a56815f253fa5198aace4b.1432112914.git.mprivozn@redhat.com
State New
Headers show

Commit Message

Michal Prívozník May 20, 2015, 9:15 a.m. UTC
When going through code I realized, that the pc_init1() has this two
arguments @pci_enabled and @kvmclock_enabled which despite used as
booleans are of int type.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 hw/i386/pc_piix.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini May 20, 2015, 9:55 a.m. UTC | #1
On 20/05/2015 11:15, Michal Privoznik wrote:
> When going through code I realized, that the pc_init1() has this two
> arguments @pci_enabled and @kvmclock_enabled which despite used as
> booleans are of int type.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>

Eduardo, do your patches to the PC machine types subsume this change?

Paolo

> ---
>  hw/i386/pc_piix.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 212e263..97650b0 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -74,8 +74,8 @@ static bool has_reserved_memory = true;
>  
>  /* PC hardware initialisation */
>  static void pc_init1(MachineState *machine,
> -                     int pci_enabled,
> -                     int kvmclock_enabled)
> +                     bool pci_enabled,
> +                     bool kvmclock_enabled)
>  {
>      PCMachineState *pc_machine = PC_MACHINE(machine);
>      MemoryRegion *system_memory = get_system_memory();
> @@ -307,7 +307,7 @@ static void pc_init1(MachineState *machine,
>  
>  static void pc_init_pci(MachineState *machine)
>  {
> -    pc_init1(machine, 1, 1);
> +    pc_init1(machine, true, true);
>  }
>  
>  static void pc_compat_2_3(MachineState *machine)
> @@ -483,7 +483,7 @@ static void pc_init_pci_1_2(MachineState *machine)
>  static void pc_init_pci_no_kvmclock(MachineState *machine)
>  {
>      pc_compat_1_2(machine);
> -    pc_init1(machine, 1, 0);
> +    pc_init1(machine, true, false);
>  }
>  
>  static void pc_init_isa(MachineState *machine)
> @@ -500,7 +500,7 @@ static void pc_init_isa(MachineState *machine)
>      }
>      x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
>      enable_compat_apic_id_mode();
> -    pc_init1(machine, 0, 1);
> +    pc_init1(machine, false, true);
>  }
>  
>  #ifdef CONFIG_XEN
>
Eduardo Habkost May 20, 2015, 12:30 p.m. UTC | #2
On Wed, May 20, 2015 at 11:55:53AM +0200, Paolo Bonzini wrote:
> On 20/05/2015 11:15, Michal Privoznik wrote:
> > When going through code I realized, that the pc_init1() has this two
> > arguments @pci_enabled and @kvmclock_enabled which despite used as
> > booleans are of int type.
> > 
> > Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> 
> Eduardo, do your patches to the PC machine types subsume this change?

Yes, it replaces the int function arguments with bool globals.

(Globals that will be eventually moved to PCMachineClass with the other
8 PC compat globals we have).
diff mbox

Patch

diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 212e263..97650b0 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -74,8 +74,8 @@  static bool has_reserved_memory = true;
 
 /* PC hardware initialisation */
 static void pc_init1(MachineState *machine,
-                     int pci_enabled,
-                     int kvmclock_enabled)
+                     bool pci_enabled,
+                     bool kvmclock_enabled)
 {
     PCMachineState *pc_machine = PC_MACHINE(machine);
     MemoryRegion *system_memory = get_system_memory();
@@ -307,7 +307,7 @@  static void pc_init1(MachineState *machine,
 
 static void pc_init_pci(MachineState *machine)
 {
-    pc_init1(machine, 1, 1);
+    pc_init1(machine, true, true);
 }
 
 static void pc_compat_2_3(MachineState *machine)
@@ -483,7 +483,7 @@  static void pc_init_pci_1_2(MachineState *machine)
 static void pc_init_pci_no_kvmclock(MachineState *machine)
 {
     pc_compat_1_2(machine);
-    pc_init1(machine, 1, 0);
+    pc_init1(machine, true, false);
 }
 
 static void pc_init_isa(MachineState *machine)
@@ -500,7 +500,7 @@  static void pc_init_isa(MachineState *machine)
     }
     x86_cpu_compat_kvm_no_autoenable(FEAT_KVM, 1 << KVM_FEATURE_PV_EOI);
     enable_compat_apic_id_mode();
-    pc_init1(machine, 0, 1);
+    pc_init1(machine, false, true);
 }
 
 #ifdef CONFIG_XEN