qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH 2/5] hw/pci-host/raven: Set QDev properties using QDev API


From: Daniel Henrique Barboza
Subject: Re: [PATCH 2/5] hw/pci-host/raven: Set QDev properties using QDev API
Date: Sun, 5 Feb 2023 08:03:37 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0



On 2/3/23 18:16, Philippe Mathieu-Daudé wrote:
No need to use the low-level QOM API when an object
inherits from QDev. Directly use the QDev API to set
its properties.

All calls use either errp=&error_fatal or NULL, so
converting to the QDev API is almost a no-op (QDev API
always uses &error_abort).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---

Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>

  hw/pci-host/raven.c | 6 ++----
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index cdfb62ac2e..2c842d2146 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -246,8 +246,7 @@ static void raven_pcihost_realizefn(DeviceState *d, Error 
**errp)
          /* According to PReP specification section 6.1.6 "System Interrupt
           * Assignments", all PCI interrupts are routed via IRQ 15 */
          s->or_irq = OR_IRQ(object_new(TYPE_OR_IRQ));
-        object_property_set_int(OBJECT(s->or_irq), "num-lines", PCI_NUM_PINS,
-                                &error_fatal);
+        qdev_prop_set_uint16(DEVICE(s->or_irq), "num-lines", PCI_NUM_PINS);
          qdev_realize(DEVICE(s->or_irq), NULL, &error_fatal);
          sysbus_init_irq(dev, &s->or_irq->out_irq);
@@ -319,8 +318,7 @@ static void raven_pcihost_initfn(Object *obj) object_initialize(&s->pci_dev, sizeof(s->pci_dev), TYPE_RAVEN_PCI_DEVICE);
      pci_dev = DEVICE(&s->pci_dev);
-    object_property_set_int(OBJECT(&s->pci_dev), "addr", PCI_DEVFN(0, 0),
-                            NULL);
+    qdev_prop_set_int32(pci_dev, "addr", PCI_DEVFN(0, 0));
      qdev_prop_set_bit(pci_dev, "multifunction", false);
  }



reply via email to

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