pc-dimm: use same mechanism for [get|set]_addr

[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 <richardw.yang@linux.intel.com>

Message-Id: <20190211064629.20186-1-richardw.yang@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Wei Yang 2019-02-11 14:46:29 +08:00 committed by Michael S. Tsirkin
parent 503bb0b975
commit f60f5e8076

View file

@ -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) static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md)
{ {
const PCDIMMDevice *dimm = PC_DIMM(md); return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, &error_abort);
return dimm->addr;
} }
static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr, static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr,