qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] pc-dimm: use same mechanism for [get|set]_ad


From: Wei Yang
Subject: Re: [Qemu-devel] [PATCH v2] pc-dimm: use same mechanism for [get|set]_addr
Date: Tue, 12 Feb 2019 07:58:00 +0800
User-agent: Mutt/1.10.1 (2018-07-13)

On Mon, Feb 11, 2019 at 03:43:07PM +0100, Igor Mammedov wrote:
>On Mon, 11 Feb 2019 14:46:29 +0800
>Wei Yang <address@hidden> wrote:
>
>> [get|set]_addr are two counterpart to access PCDIMMDevice.addr.
>> 
>> Since we have already set up a property PC_DIMM_ADDR_PROP for this
>> field and use this mechanism in set_addr, it would be more proper to use
>> the same mechanism in get_addr.
>> 
>> This patch uses object_property_get_uint() to replace the direct memory
>> access to make [get|set]_addr with the same mechanism.
>> 
>> Signed-off-by: Wei Yang <address@hidden>
>
>Reviewed-by: Igor Mammedov <address@hidden>
>

Thanks :-)

>> 
>> ---
>> v2: replace NULL with error_abort to handle error properly
>> ---
>>  hw/mem/pc-dimm.c | 4 +---
>>  1 file changed, 1 insertion(+), 3 deletions(-)
>> 
>> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
>> index 0c9b9e8292..152400b1fc 100644
>> --- a/hw/mem/pc-dimm.c
>> +++ b/hw/mem/pc-dimm.c
>> @@ -204,9 +204,7 @@ static MemoryRegion 
>> *pc_dimm_get_memory_region(PCDIMMDevice *dimm, Error **errp)
>>  
>>  static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
>>  {
>> -    const PCDIMMDevice *dimm = PC_DIMM(md);
>> -
>> -    return dimm->addr;
>> +    return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, 
>> &error_abort);
>>  }
>>  
>>  static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,

-- 
Wei Yang
Help you, Help me



reply via email to

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