Skip to contentSkip to conversation

i386: Rename bools in PCMachineState to end in _enabled

PATCH In review [email protected] 3 participants 3 messages Nov 7, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i386: Rename bools in PCMachineState to end in _enabled

From: Corey Minyard <[email protected]>

This makes their function more clear and prevents conflicts when adding the actual devices to the machine state, if necessary.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
---
 hw/i386/pc.c         | 18 +++++++++---------
 hw/i386/pc_piix.c    |  3 ++-
 hw/i386/pc_q35.c     |  6 +++---
 include/hw/i386/pc.h |  6 +++---
 4 files changed, 17 insertions(+), 16 deletions(-)

I have this change in my tree because I have SMBus ACPI support for an SMBus IPMI device. Thus I need to add the smbus to the PC machine state and it seems better to have the device named "smbus" and the enable named "smbus_enabled".

However, I think this change makes the code more consistent and clear. Thus I am sending it separately.

hw/i386/pc.c +9 -9
index f095725dba..4cd2fbca4d 100644
@@ -2222,42 +2222,42 @@ static bool pc_machine_get_smbus(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->smbus;
+    return pcms->smbus_enabled;
 }
 
 static void pc_machine_set_smbus(Object *obj, bool value, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->smbus = value;
+    pcms->smbus_enabled = value;
 }
 
 static bool pc_machine_get_sata(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->sata;
+    return pcms->sata_enabled;
 }
 
 static void pc_machine_set_sata(Object *obj, bool value, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->sata = value;
+    pcms->sata_enabled = value;
 }
 
 static bool pc_machine_get_pit(Object *obj, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->pit;
+    return pcms->pit_enabled;
 }
 
 static void pc_machine_set_pit(Object *obj, bool value, Error **errp)
 {
     PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->pit = value;
+    pcms->pit_enabled = value;
 }
 
 static void pc_machine_initfn(Object *obj)
@@ -2271,9 +2271,9 @@ static void pc_machine_initfn(Object *obj)
     pcms->acpi_nvdimm_state.is_enabled = false;
     /* acpi build is enabled by default if machine supports it */
     pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
-    pcms->smbus = true;
-    pcms->sata = true;
-    pcms->pit = true;
+    pcms->smbus_enabled = true;
+    pcms->sata_enabled = true;
+    pcms->pit_enabled = true;
 }
 
 static void pc_machine_reset(void)
hw/i386/pc_piix.c +2 -1
index dc09466b3e..dc7a0d3fa1 100644
@@ -239,7 +239,8 @@ static void pc_init1(MachineState *machine,
 
     /* init basic PC hardware */
     pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true,
-                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit, 0x4);
+                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
+                         0x4);
 
     pc_nic_init(pcmc, isa_bus, pci_bus);
 
hw/i386/pc_q35.c +3 -3
index 532241e3f8..0b65887bbf 100644
@@ -236,13 +236,13 @@ static void pc_q35_init(MachineState *machine)
 
     /* init basic PC hardware */
     pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, !mc->no_floppy,
-                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit,
+                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
                          0xff0104);
 
     /* connect pm stuff to lpc */
     ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms));
 
-    if (pcms->sata) {
+    if (pcms->sata_enabled) {
         /* ahci and SATA device, for q35 1 ahci controller is built-in */
         ahci = pci_create_simple_multifunction(host_bus,
                                                PCI_DEVFN(ICH9_SATA1_DEV,
@@ -262,7 +262,7 @@ static void pc_q35_init(MachineState *machine)
         ehci_create_ich9_with_companions(host_bus, 0x1d);
     }
 
-    if (pcms->smbus) {
+    if (pcms->smbus_enabled) {
         /* TODO: Populate SPD eeprom data.  */
         smbus_eeprom_init(ich9_smb_init(host_bus,
                                         PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
include/hw/i386/pc.h +3 -3
index 136fe497b6..7bb52b4762 100644
@@ -49,9 +49,9 @@ struct PCMachineState {
     AcpiNVDIMMState acpi_nvdimm_state;
 
     bool acpi_build_enabled;
-    bool smbus;
-    bool sata;
-    bool pit;
+    bool smbus_enabled;
+    bool sata_enabled;
+    bool pit_enabled;
 
     /* RAM information (sizes, addresses, configuration): */
     ram_addr_t below_4g_mem_size, above_4g_mem_size;
Signature · 1 line
2.17.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · On 7/11/18 16:24, [email protected] wrote:

From: Corey Minyard <[email protected]>

This makes their function more clear and prevents conflicts when adding the actual devices to the machine state, if necessary.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>
Quoted 142 lines
---
  hw/i386/pc.c         | 18 +++++++++---------
  hw/i386/pc_piix.c    |  3 ++-
  hw/i386/pc_q35.c     |  6 +++---
  include/hw/i386/pc.h |  6 +++---
  4 files changed, 17 insertions(+), 16 deletions(-)

I have this change in my tree because I have SMBus ACPI support for an SMBus IPMI device. Thus I need to add the smbus to the PC machine state and it seems better to have the device named "smbus" and the enable named "smbus_enabled".

However, I think this change makes the code more consistent and clear. Thus I am sending it separately.

hw/i386/pc.c +9 -9
index f095725dba..4cd2fbca4d 100644
@@ -2222,42 +2222,42 @@ static bool pc_machine_get_smbus(Object *obj, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->smbus;
+    return pcms->smbus_enabled;
  }
 
  static void pc_machine_set_smbus(Object *obj, bool value, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->smbus = value;
+    pcms->smbus_enabled = value;
  }
 
  static bool pc_machine_get_sata(Object *obj, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->sata;
+    return pcms->sata_enabled;
  }
 
  static void pc_machine_set_sata(Object *obj, bool value, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->sata = value;
+    pcms->sata_enabled = value;
  }
 
  static bool pc_machine_get_pit(Object *obj, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    return pcms->pit;
+    return pcms->pit_enabled;
  }
 
  static void pc_machine_set_pit(Object *obj, bool value, Error **errp)
  {
      PCMachineState *pcms = PC_MACHINE(obj);
 
-    pcms->pit = value;
+    pcms->pit_enabled = value;
  }
 
  static void pc_machine_initfn(Object *obj)
@@ -2271,9 +2271,9 @@ static void pc_machine_initfn(Object *obj)
      pcms->acpi_nvdimm_state.is_enabled = false;
      /* acpi build is enabled by default if machine supports it */
      pcms->acpi_build_enabled = PC_MACHINE_GET_CLASS(pcms)->has_acpi_build;
-    pcms->smbus = true;
-    pcms->sata = true;
-    pcms->pit = true;
+    pcms->smbus_enabled = true;
+    pcms->sata_enabled = true;
+    pcms->pit_enabled = true;
  }
 
  static void pc_machine_reset(void)
hw/i386/pc_piix.c +2 -1
index dc09466b3e..dc7a0d3fa1 100644
@@ -239,7 +239,8 @@ static void pc_init1(MachineState *machine,
 
      /* init basic PC hardware */
      pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true,
-                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit, 0x4);
+                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
+                         0x4);
 
      pc_nic_init(pcmc, isa_bus, pci_bus);
 
hw/i386/pc_q35.c +3 -3
index 532241e3f8..0b65887bbf 100644
@@ -236,13 +236,13 @@ static void pc_q35_init(MachineState *machine)
 
      /* init basic PC hardware */
      pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, !mc->no_floppy,
-                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit,
+                         (pcms->vmport != ON_OFF_AUTO_ON), pcms->pit_enabled,
                           0xff0104);
 
      /* connect pm stuff to lpc */
      ich9_lpc_pm_init(lpc, pc_machine_is_smm_enabled(pcms));
 
-    if (pcms->sata) {
+    if (pcms->sata_enabled) {
          /* ahci and SATA device, for q35 1 ahci controller is built-in */
          ahci = pci_create_simple_multifunction(host_bus,
                                                 PCI_DEVFN(ICH9_SATA1_DEV,
@@ -262,7 +262,7 @@ static void pc_q35_init(MachineState *machine)
          ehci_create_ich9_with_companions(host_bus, 0x1d);
      }
 
-    if (pcms->smbus) {
+    if (pcms->smbus_enabled) {
          /* TODO: Populate SPD eeprom data.  */
          smbus_eeprom_init(ich9_smb_init(host_bus,
                                          PCI_DEVFN(ICH9_SMB_DEV, ICH9_SMB_FUNC),
include/hw/i386/pc.h +3 -3
index 136fe497b6..7bb52b4762 100644
@@ -49,9 +49,9 @@ struct PCMachineState {
      AcpiNVDIMMState acpi_nvdimm_state;
 
      bool acpi_build_enabled;
-    bool smbus;
-    bool sata;
-    bool pit;
+    bool smbus_enabled;
+    bool sata_enabled;
+    bool pit_enabled;
 
      /* RAM information (sizes, addresses, configuration): */
      ram_addr_t below_4g_mem_size, above_4g_mem_size;
#2 lore raw
In reply to [email protected]
Quoted 9 lines · On Wed, Nov 07, 2018 at 09:24:34AM -0600, [email protected] wrote:

From: Corey Minyard <[email protected]>

This makes their function more clear and prevents conflicts when adding the actual devices to the machine state, if necessary.

Cc Paolo Bonzini <[email protected]>
Cc Richard Henderson <[email protected]>
Cc Eduardo Habkost <[email protected]>

Thanks, queueing for 3.2.

Signature · 1 line
Eduardo