From nobody Tue May 7 15:27:10 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 154986769733544.22192554066066; Sun, 10 Feb 2019 22:48:17 -0800 (PST) Received: from localhost ([127.0.0.1]:45492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt5Ns-0000Mj-LL for importer@patchew.org; Mon, 11 Feb 2019 01:48:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt5Mu-0008SH-8i for qemu-devel@nongnu.org; Mon, 11 Feb 2019 01:47:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gt5Mt-0002NS-Ev for qemu-devel@nongnu.org; Mon, 11 Feb 2019 01:47:04 -0500 Received: from mga12.intel.com ([192.55.52.136]:11247) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gt5Mt-0001vx-6f for qemu-devel@nongnu.org; Mon, 11 Feb 2019 01:47:03 -0500 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Feb 2019 22:46:55 -0800 Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga001.jf.intel.com with ESMTP; 10 Feb 2019 22:46:54 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,358,1544515200"; d="scan'208";a="137594397" From: Wei Yang To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 14:46:29 +0800 Message-Id: <20190211064629.20186-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.136 Subject: [Qemu-devel] [PATCH v2] 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 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 Reviewed-by: Igor Mammedov --- 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(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, &error_= abort); } =20 static void pc_dimm_md_set_addr(MemoryDeviceState *md, uint64_t addr, --=20 2.19.1