diff mbox

[v2,21/45] qdev: use appropriate getter/setters type

Message ID 20170531135709.345-22-marcandre.lureau@redhat.com
State New
Headers show

Commit Message

Marc-André Lureau May 31, 2017, 1:56 p.m. UTC
Based on underlying property type, use the appropriate getters/setters.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/i386/acpi-build.c      | 20 ++++++++++----------
 hw/pci-host/gpex.c        |  2 +-
 hw/pci-host/q35.c         |  2 +-
 hw/pci-host/xilinx-pcie.c |  2 +-
 4 files changed, 13 insertions(+), 13 deletions(-)

Comments

Markus Armbruster June 2, 2017, 2:51 p.m. UTC | #1
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Based on underlying property type, use the appropriate getters/setters.

Well, the getter and setter is the closest thing to a property type QOM
has.  Do you mean the type of the data accessed by the getter and
setter?

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>

Patch looks okay.
diff mbox

Patch

diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index ba2be1e9da..ba163e6df2 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -128,7 +128,7 @@  static void acpi_get_pm_info(AcpiPmInfo *pm)
     Object *lpc = ich9_lpc_find();
     Object *obj = NULL;
     QObject *o;
-    int64_t val;
+    uint64_t val;
 
     pm->cpu_hp_io_base = 0;
     pm->pcihp_io_base = 0;
@@ -150,7 +150,7 @@  static void acpi_get_pm_info(AcpiPmInfo *pm)
     /* Fill in optional s3/s4 related properties */
     o = object_property_get_qobject(obj, ACPI_PM_PROP_S3_DISABLED, NULL);
     if (o) {
-        if (!qnum_get_int(qobject_to_qnum(o), &val)) {
+        if (!qnum_get_uint(qobject_to_qnum(o), &val)) {
             g_assert_not_reached();
         }
         pm->s3_disabled = val;
@@ -160,7 +160,7 @@  static void acpi_get_pm_info(AcpiPmInfo *pm)
     qobject_decref(o);
     o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_DISABLED, NULL);
     if (o) {
-        if (!qnum_get_int(qobject_to_qnum(o), &val)) {
+        if (!qnum_get_uint(qobject_to_qnum(o), &val)) {
             g_assert_not_reached();
         }
         pm->s4_disabled = val;
@@ -170,7 +170,7 @@  static void acpi_get_pm_info(AcpiPmInfo *pm)
     qobject_decref(o);
     o = object_property_get_qobject(obj, ACPI_PM_PROP_S4_VAL, NULL);
     if (o) {
-        if (!qnum_get_int(qobject_to_qnum(o), &val)) {
+        if (!qnum_get_uint(qobject_to_qnum(o), &val)) {
             g_assert_not_reached();
         }
         pm->s4_val = val;
@@ -538,9 +538,9 @@  static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
 
     bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL);
     if (bsel) {
-        int64_t bsel_val;
+        uint64_t bsel_val;
 
-        if (!qnum_get_int(qobject_to_qnum(bsel), &bsel_val)) {
+        if (!qnum_get_uint(qobject_to_qnum(bsel), &bsel_val)) {
             g_assert_not_reached();
         }
 
@@ -652,9 +652,9 @@  static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus,
 
     /* If bus supports hotplug select it and notify about local events */
     if (bsel) {
-        int64_t bsel_val;
+        uint64_t bsel_val;
 
-        if (!qnum_get_int(qobject_to_qnum(bsel), &bsel_val)) {
+        if (!qnum_get_uint(qobject_to_qnum(bsel), &bsel_val)) {
             g_assert_not_reached();
         }
 
@@ -2625,7 +2625,7 @@  static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
 {
     Object *pci_host;
     QObject *o;
-    int64_t val;
+    uint64_t val;
 
     pci_host = acpi_get_i386_pci_host();
     g_assert(pci_host);
@@ -2641,7 +2641,7 @@  static bool acpi_get_mcfg(AcpiMcfgInfo *mcfg)
 
     o = object_property_get_qobject(pci_host, PCIE_HOST_MCFG_SIZE, NULL);
     assert(o);
-    if (!qnum_get_int(qobject_to_qnum(o), &val)) {
+    if (!qnum_get_uint(qobject_to_qnum(o), &val)) {
         g_assert_not_reached();
     }
     mcfg->mcfg_size = val;
diff --git a/hw/pci-host/gpex.c b/hw/pci-host/gpex.c
index e2629ce70d..83084b9aab 100644
--- a/hw/pci-host/gpex.c
+++ b/hw/pci-host/gpex.c
@@ -94,7 +94,7 @@  static void gpex_host_initfn(Object *obj)
 
     object_initialize(root, sizeof(*root), TYPE_GPEX_ROOT_DEVICE);
     object_property_add_child(obj, "gpex_root", OBJECT(root), NULL);
-    qdev_prop_set_uint32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
+    qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }
 
diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c
index c2f2af5d9a..564f6cbb14 100644
--- a/hw/pci-host/q35.c
+++ b/hw/pci-host/q35.c
@@ -172,7 +172,7 @@  static void q35_host_initfn(Object *obj)
 
     object_initialize(&s->mch, sizeof(s->mch), TYPE_MCH_PCI_DEVICE);
     object_property_add_child(OBJECT(s), "mch", OBJECT(&s->mch), NULL);
-    qdev_prop_set_uint32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
+    qdev_prop_set_int32(DEVICE(&s->mch), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(&s->mch), "multifunction", false);
 
     object_property_add(obj, PCI_HOST_PROP_PCI_HOLE_START, "uint32",
diff --git a/hw/pci-host/xilinx-pcie.c b/hw/pci-host/xilinx-pcie.c
index a968cea2af..2c78dcfc26 100644
--- a/hw/pci-host/xilinx-pcie.c
+++ b/hw/pci-host/xilinx-pcie.c
@@ -150,7 +150,7 @@  static void xilinx_pcie_host_init(Object *obj)
 
     object_initialize(root, sizeof(*root), TYPE_XILINX_PCIE_ROOT);
     object_property_add_child(obj, "root", OBJECT(root), NULL);
-    qdev_prop_set_uint32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
+    qdev_prop_set_int32(DEVICE(root), "addr", PCI_DEVFN(0, 0));
     qdev_prop_set_bit(DEVICE(root), "multifunction", false);
 }