diff mbox

[v2,2/5] hw/display: QOM'ify jazz_led.c

Message ID 1462532375-29264-3-git-send-email-zxq_yx_007@163.com (mailing list archive)
State New, archived
Headers show

Commit Message

zhao xiao qiang May 6, 2016, 10:59 a.m. UTC
* 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>
---
 hw/display/jazz_led.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Peter Maydell May 6, 2016, 11:05 a.m. UTC | #1
On 6 May 2016 at 11:59, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> * 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>
> ---
>  hw/display/jazz_led.c | 18 +++++++++++-------
>  1 file changed, 11 insertions(+), 7 deletions(-)

I already reviewed this patch (and some others in this
series). Please *don't* resend patches without including any
Reviewed-by: tags you got for them, otherwise people won't
know if they need to look at them again, and information
about whether code has been reviewed gets lost.
For more info, see:
http://wiki.qemu.org/Contribute/SubmitAPatch#Proper_use_of_Reviewed-by:_tags_can_aid_review

thanks
-- PMM
zhao xiao qiang May 6, 2016, 11:14 a.m. UTC | #2
? 2016?05?06? 19:05, Peter Maydell ??:
> On 6 May 2016 at 11:59, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
>> * 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>
>> ---
>>   hw/display/jazz_led.c | 18 +++++++++++-------
>>   1 file changed, 11 insertions(+), 7 deletions(-)
> I already reviewed this patch (and some others in this
> series). Please *don't* resend patches without including any
> Reviewed-by: tags you got for them, otherwise people won't
> know if they need to look at them again, and information
> about whether code has been reviewed gets lost.
> For more info, see:
> http://wiki.qemu.org/Contribute/SubmitAPatch#Proper_use_of_Reviewed-by:_tags_can_aid_review
>
> thanks
> -- PMM
Yes, I will.
Thank you peter ;-)
diff mbox

Patch

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,
 };