From nobody Wed May 8 13:04:19 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linux.intel.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548983443122678.7193916863077; Thu, 31 Jan 2019 17:10:43 -0800 (PST) Received: from localhost ([127.0.0.1]:35256 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpNLj-0001xl-6s for importer@patchew.org; Thu, 31 Jan 2019 20:10:31 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53810) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpNKt-0001ZU-32 for qemu-devel@nongnu.org; Thu, 31 Jan 2019 20:09:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpNKr-0002kz-3R for qemu-devel@nongnu.org; Thu, 31 Jan 2019 20:09:39 -0500 Received: from mga05.intel.com ([192.55.52.43]:28583) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gpNKk-0002iN-S5 for qemu-devel@nongnu.org; Thu, 31 Jan 2019 20:09:33 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2019 17:09:19 -0800 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.37]) by fmsmga002.fm.intel.com with ESMTP; 31 Jan 2019 17:09:19 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,546,1539673200"; d="scan'208";a="139699087" From: Wei Yang To: qemu-devel@nongnu.org Date: Fri, 1 Feb 2019 09:08:37 +0800 Message-Id: <20190201010837.19278-1-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.43 Subject: [Qemu-devel] [PATCH] pc-dimm: use same mechanism for [get|set]_addr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: imammedo@redhat.com, Wei Yang , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" [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 set_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 --- 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..c0658b9b88 100644 --- a/hw/mem/pc-dimm.c +++ b/hw/mem/pc-dimm.c @@ -204,9 +204,7 @@ static MemoryRegion *pc_dimm_get_memory_region(PCDIMMDe= vice *dimm, Error **errp) =20 static uint64_t pc_dimm_md_get_addr(const MemoryDeviceState *md) { - const PCDIMMDevice *dimm =3D PC_DIMM(md); - - return dimm->addr; + return object_property_get_uint(OBJECT(md), PC_DIMM_ADDR_PROP, NULL); } =20 static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr, --=20 2.19.1