[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/19] hw/avr: Set QDev properties using QDev API
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 10/19] hw/avr: Set QDev properties using QDev API |
Date: |
Fri, 3 Feb 2023 19:09:05 +0100 |
No need to use the low-level QOM API when an object
inherits from QDev. Directly use the QDev API to set
its properties.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/avr/arduino.c | 4 ++--
hw/avr/atmega.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/avr/arduino.c b/hw/avr/arduino.c
index 48ef478346..428e6e1b2d 100644
--- a/hw/avr/arduino.c
+++ b/hw/avr/arduino.c
@@ -15,6 +15,7 @@
#include "atmega.h"
#include "boot.h"
#include "qom/object.h"
+#include "hw/qdev-properties.h"
struct ArduinoMachineState {
/*< private >*/
@@ -44,8 +45,7 @@ static void arduino_machine_init(MachineState *machine)
ArduinoMachineState *ams = ARDUINO_MACHINE(machine);
object_initialize_child(OBJECT(machine), "mcu", &ams->mcu, amc->mcu_type);
- object_property_set_uint(OBJECT(&ams->mcu), "xtal-frequency-hz",
- amc->xtal_hz, &error_abort);
+ qdev_prop_set_uint64(DEVICE(&ams->mcu), "xtal-frequency-hz", amc->xtal_hz);
sysbus_realize(SYS_BUS_DEVICE(&ams->mcu), &error_abort);
if (machine->firmware) {
diff --git a/hw/avr/atmega.c b/hw/avr/atmega.c
index a34803e642..e6ebc7473a 100644
--- a/hw/avr/atmega.c
+++ b/hw/avr/atmega.c
@@ -327,8 +327,8 @@ static void atmega_realize(DeviceState *dev, Error **errp)
devname = g_strdup_printf("timer%zu", i);
object_initialize_child(OBJECT(dev), devname, &s->timer[i],
TYPE_AVR_TIMER16);
- object_property_set_uint(OBJECT(&s->timer[i]), "cpu-frequency-hz",
- s->xtal_freq_hz, &error_abort);
+ qdev_prop_set_uint64(DEVICE(&s->timer[i]), "cpu-frequency-hz",
+ s->xtal_freq_hz);
sbd = SYS_BUS_DEVICE(&s->timer[i]);
sysbus_realize(sbd, &error_abort);
sysbus_mmio_map(sbd, 0, OFFSET_DATA + mc->dev[idx].addr);
--
2.38.1
- [PATCH 01/19] NOTFORMERGE scripts/coccinelle: Add qom-qdev-prop.cocci, (continued)
- [PATCH 01/19] NOTFORMERGE scripts/coccinelle: Add qom-qdev-prop.cocci, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 02/19] hw/qdev: Introduce qdev_prop_set_link(), Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 03/19] hw/acpi: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 04/19] hw/audio: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [RFC PATCH 05/19] hw/core/numa: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 06/19] hw/core/gpio: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [RFC PATCH 07/19] hw/scsi: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 08/19] hw/usb: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 09/19] hw/virtio: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 10/19] hw/avr: Set QDev properties using QDev API,
Philippe Mathieu-Daudé <=
- [PATCH 11/19] hw/hppa: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [RFC PATCH 12/19] hw/i386: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 13/19] hw/m68k: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 14/19] hw/microblaze: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [RFC PATCH 15/19] hw/mips: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 16/19] hw/nios2: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [RFC PATCH 17/19] hw/riscv: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03
- [PATCH 18/19] hw/rx: Set QDev properties using QDev API, Philippe Mathieu-Daudé, 2023/02/03