qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: qemu-devel <qemu-devel@nongnu.org>
Cc: qemu-trivial@nongnu.org, Peter Maydell <peter.maydell@linaro.org>,
	Mark Langsdorf <mark.langsdorf@calxeda.com>,
	Stefan Weil <sw@weilnetz.de>
Subject: [Qemu-devel] [PATCH] hw/arm/highbank: Simplify code (memory region in device state)
Date: Fri,  6 Dec 2013 19:43:30 +0100	[thread overview]
Message-ID: <1386355410-10805-1-git-send-email-sw@weilnetz.de> (raw)

The memory region can be included by value instead of by reference in the
device state (like it is done in other SoCs).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 hw/arm/highbank.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index fe98ef1..54384b3 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -125,7 +125,7 @@ typedef struct {
     SysBusDevice parent_obj;
     /*< public >*/
 
-    MemoryRegion *iomem;
+    MemoryRegion iomem;
     uint32_t regs[NUM_REGS];
 } HighbankRegsState;
 
@@ -154,10 +154,9 @@ static int highbank_regs_init(SysBusDevice *dev)
 {
     HighbankRegsState *s = HIGHBANK_REGISTERS(dev);
 
-    s->iomem = g_new(MemoryRegion, 1);
-    memory_region_init_io(s->iomem, OBJECT(s), &hb_mem_ops, s->regs,
+    memory_region_init_io(&s->iomem, OBJECT(s), &hb_mem_ops, s->regs,
                           "highbank_regs", 0x1000);
-    sysbus_init_mmio(dev, s->iomem);
+    sysbus_init_mmio(dev, &s->iomem);
 
     return 0;
 }
-- 
1.7.10.4

             reply	other threads:[~2013-12-06 18:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-06 18:43 Stefan Weil [this message]
2013-12-06 19:12 ` [Qemu-devel] [Qemu-trivial] [PATCH] hw/arm/highbank: Simplify code (memory region in device state) Michael Tokarev
2013-12-06 19:24   ` Peter Maydell
2013-12-07  6:46     ` Peter Crosthwaite
2013-12-07 18:21 ` Michael Tokarev

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=1386355410-10805-1-git-send-email-sw@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=mark.langsdorf@calxeda.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /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).