Patchwork [RFC,4/6] m48t59: move ISA ports registration to QOM constructor

login
register
mail settings
Submitter Hervé Poussineau
Date March 14, 2013, 10:12 p.m.
Message ID <1363299128-8494-5-git-send-email-hpoussin@reactos.org>
Download mbox | patch
Permalink /patch/227818/
State New
Headers show

Comments

Hervé Poussineau - March 14, 2013, 10:12 p.m.
-device m48t59 can now be used to create a fully functional nvram,
and m48t59_init_isa() becomes a much simpler helper.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/m48t59.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Patch

diff --git a/hw/m48t59.c b/hw/m48t59.c
index 39a9d80..1093716 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -676,11 +676,6 @@  M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
     d = DO_UPCAST(M48t59ISAState, busdev, dev);
     s = &d->state;
 
-    memory_region_init_io(&d->io, &m48t59_io_ops, s, "m48t59", 4);
-    if (io_base != 0) {
-        isa_register_ioport(dev, &d->io, io_base);
-    }
-
     return s;
 }
 
@@ -703,6 +698,10 @@  static int m48t59_init_isa1(ISADevice *dev)
 
     isa_init_irq(dev, &s->IRQ, 8);
     m48t59_init_common(s);
+    memory_region_init_io(&d->io, &m48t59_io_ops, s, "m48t59", 4);
+    if (s->io_base != 0) {
+        isa_register_ioport(dev, &d->io, s->io_base);
+    }
 
     return 0;
 }