All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antony Pavlov <antonynpavlov@gmail.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	Michael Walle <michael@walle.cc>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>,
	Antony Pavlov <antonynpavlov@gmail.com>
Subject: [Qemu-devel] [PATCH 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init
Date: Sat, 31 Aug 2013 09:33:57 +0400	[thread overview]
Message-ID: <1377927237-6092-3-git-send-email-antonynpavlov@gmail.com> (raw)
In-Reply-To: <1377927237-6092-1-git-send-email-antonynpavlov@gmail.com>

<quote author="Peter Crosthwaite"
 url="http://lists.nongnu.org/archive/html/qemu-devel/2013-08/msg04748.html">
  Use of SysBusDevice::init is deprecated. Please use
  Device::realize instead of SysBusDevice::init.
  Check dma/pl330.c for an example of the pattern.
</quote>

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
CC: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
CC: Michael Walle <michael@walle.cc>
---
 hw/char/milkymist-uart.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c
index 6e4bc20..66fba82 100644
--- a/hw/char/milkymist-uart.c
+++ b/hw/char/milkymist-uart.c
@@ -195,22 +195,20 @@ static void milkymist_uart_reset(DeviceState *d)
     s->regs[R_STAT] = STAT_THRE;
 }
 
-static int milkymist_uart_init(SysBusDevice *dev)
+static void milkymist_uart_realize(DeviceState *dev, Error **errp)
 {
     MilkymistUartState *s = MILKYMIST_UART(dev);
 
-    sysbus_init_irq(dev, &s->irq);
+    sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
 
     memory_region_init_io(&s->regs_region, OBJECT(s), &uart_mmio_ops, s,
                           "milkymist-uart", R_MAX * 4);
-    sysbus_init_mmio(dev, &s->regs_region);
+    sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->regs_region);
 
     s->chr = qemu_char_get_next_serial();
     if (s->chr) {
         qemu_chr_add_handlers(s->chr, uart_can_rx, uart_rx, uart_event, s);
     }
-
-    return 0;
 }
 
 static const VMStateDescription vmstate_milkymist_uart = {
@@ -227,9 +225,8 @@ static const VMStateDescription vmstate_milkymist_uart = {
 static void milkymist_uart_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
-    SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
 
-    k->init = milkymist_uart_init;
+    dc->realize = milkymist_uart_realize;
     dc->reset = milkymist_uart_reset;
     dc->vmsd = &vmstate_milkymist_uart;
 }
-- 
1.8.4.rc3

  parent reply	other threads:[~2013-08-31  5:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-31  5:33 [Qemu-devel] [PATCH 0/2] milkymist-uart fixes Antony Pavlov
2013-08-31  5:33 ` [Qemu-devel] [PATCH 1/2] milkymist-uart: use qemu_chr_fe_write_all() instead of qemu_chr_fe_write() Antony Pavlov
2013-08-31  5:33 ` Antony Pavlov [this message]
2013-08-31 13:16   ` [Qemu-devel] [PATCH 2/2] milkymist-uart: use Device::realize instead of SysBusDevice::init Andreas Färber

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=1377927237-6092-3-git-send-email-antonynpavlov@gmail.com \
    --to=antonynpavlov@gmail.com \
    --cc=aliguori@us.ibm.com \
    --cc=michael@walle.cc \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=qemu-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.