From: Leon Alrae <leon.alrae@imgtec.com>
To: qemu-devel@nongnu.org
Cc: "xiaoqiang.zhao" <zxq_yx_007@163.com>
Subject: [Qemu-devel] [PULL 2/2] hw/display: QOM'ify jazz_led.c
Date: Fri, 13 May 2016 11:44:17 +0100 [thread overview]
Message-ID: <1463136257-46914-3-git-send-email-leon.alrae@imgtec.com> (raw)
In-Reply-To: <1463136257-46914-1-git-send-email-leon.alrae@imgtec.com>
From: "xiaoqiang.zhao" <zxq_yx_007@163.com>
* Drop the old SysBus init function and use instance_init
* Move graphic_console_init into realize stage
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Leon Alrae <leon.alrae@imgtec.com>
---
hw/display/jazz_led.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/hw/display/jazz_led.c b/hw/display/jazz_led.c
index 09dcdb4..b72fdb1 100644
--- a/hw/display/jazz_led.c
+++ b/hw/display/jazz_led.c
@@ -267,16 +267,20 @@ static const GraphicHwOps jazz_led_ops = {
.text_update = jazz_led_text_update,
};
-static int jazz_led_init(SysBusDevice *dev)
+static void jazz_led_init(Object *obj)
{
- LedState *s = JAZZ_LED(dev);
+ LedState *s = JAZZ_LED(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
- memory_region_init_io(&s->iomem, OBJECT(s), &led_ops, s, "led", 1);
+ memory_region_init_io(&s->iomem, obj, &led_ops, s, "led", 1);
sysbus_init_mmio(dev, &s->iomem);
+}
- s->con = graphic_console_init(DEVICE(dev), 0, &jazz_led_ops, s);
+static void jazz_led_realize(DeviceState *dev, Error **errp)
+{
+ LedState *s = JAZZ_LED(dev);
- return 0;
+ s->con = graphic_console_init(dev, 0, &jazz_led_ops, s);
}
static void jazz_led_reset(DeviceState *d)
@@ -291,18 +295,18 @@ static void jazz_led_reset(DeviceState *d)
static void jazz_led_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = jazz_led_init;
dc->desc = "Jazz LED display",
dc->vmsd = &vmstate_jazz_led;
dc->reset = jazz_led_reset;
+ dc->realize = jazz_led_realize;
}
static const TypeInfo jazz_led_info = {
.name = TYPE_JAZZ_LED,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(LedState),
+ .instance_init = jazz_led_init,
.class_init = jazz_led_class_init,
};
--
2.7.4
next prev parent reply other threads:[~2016-05-13 10:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 10:44 [Qemu-devel] [PULL 0/2] target-mips queue Leon Alrae
2016-05-13 10:44 ` [Qemu-devel] [PULL 1/2] target-mips: fix call to memset in soft reset code Leon Alrae
2016-05-13 10:44 ` Leon Alrae [this message]
2016-05-13 12:02 ` [Qemu-devel] [PULL 0/2] target-mips queue Peter Maydell
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=1463136257-46914-3-git-send-email-leon.alrae@imgtec.com \
--to=leon.alrae@imgtec.com \
--cc=qemu-devel@nongnu.org \
--cc=zxq_yx_007@163.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).