[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [PATCH 2/2] hw/arm/aspeed: Add RTC to SoC
From: |
Cédric Le Goater |
Subject: |
Re: [Qemu-arm] [PATCH 2/2] hw/arm/aspeed: Add RTC to SoC |
Date: |
Thu, 11 Apr 2019 17:31:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 4/11/19 5:28 PM, Peter Maydell wrote:
> On Thu, 28 Mar 2019 at 06:22, Joel Stanley <address@hidden> wrote:
>>
>> Signed-off-by: Joel Stanley <address@hidden>
>> Signed-off-by: Cédric Le Goater <address@hidden>
>> ---
>> hw/arm/aspeed_soc.c | 15 +++++++++++++++
>> include/hw/arm/aspeed_soc.h | 2 ++
>> 2 files changed, 17 insertions(+)
>>
>> diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
>> index a27233d4876b..628ec633c91a 100644
>> --- a/hw/arm/aspeed_soc.c
>> +++ b/hw/arm/aspeed_soc.c
>> @@ -32,6 +32,7 @@
>> #define ASPEED_SOC_SDMC_BASE 0x1E6E0000
>> #define ASPEED_SOC_SCU_BASE 0x1E6E2000
>> #define ASPEED_SOC_SRAM_BASE 0x1E720000
>> +#define ASPEED_SOC_RTC_BASE 0x1E781000
>> #define ASPEED_SOC_TIMER_BASE 0x1E782000
>> #define ASPEED_SOC_WDT_BASE 0x1E785000
>> #define ASPEED_SOC_I2C_BASE 0x1E78A000
>> @@ -135,6 +136,10 @@ static void aspeed_soc_init(Object *obj)
>> object_property_add_child(obj, "i2c", OBJECT(&s->i2c), NULL);
>> qdev_set_parent_bus(DEVICE(&s->i2c), sysbus_get_default());
>>
>> + object_initialize(&s->rtc, sizeof(s->rtc), TYPE_ASPEED_RTC);
>> + object_property_add_child(obj, "rtc", OBJECT(&s->rtc), NULL);
>> + qdev_set_parent_bus(DEVICE(&s->rtc), sysbus_get_default());
>
> These three lines should be written
> sysbus_init_child_obj(obj, "rtc", &s->rtc, sizeof(s->rtc),
> TYPE_ASPEED_RTC);
>
> which is both shorter and also avoids leaking a reference to
> the child object.
>
> (We should also at some point fix the existing uses of this
> pattern in this file.)
yes. and there are a few. I will do that.
Thanks,
C.