From: Igor Mammedov <imammedo@redhat.com>
To: Wei Yang <richardw.yang@linux.intel.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2] pc-dimm: use same mechanism for [get|set]_addr
Date: Mon, 11 Feb 2019 15:43:07 +0100 [thread overview]
Message-ID: <20190211154307.203f8d35@redhat.com> (raw)
In-Reply-To: <20190211064629.20186-1-richardw.yang@linux.intel.com>
On Mon, 11 Feb 2019 14:46:29 +0800
Wei Yang <richardw.yang@linux.intel.com> 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 <richardw.yang@linux.intel.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
>
> ---
> 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,
next prev parent reply other threads:[~2019-02-11 14:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-11 6:46 [Qemu-devel] [PATCH v2] pc-dimm: use same mechanism for [get|set]_addr Wei Yang
2019-02-11 14:43 ` Igor Mammedov [this message]
2019-02-11 23:58 ` Wei Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190211154307.203f8d35@redhat.com \
--to=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richardw.yang@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).