From 8290de92b83e843390571b36dc9e09a9fb75abf0 Mon Sep 17 00:00:00 2001 From: xiaoqiang zhao Date: Wed, 25 May 2016 14:39:01 +0800 Subject: hw/char: QOM'ify etraxfs_ser.c * Drop the old SysBus init function and use instance_init * Call qemu_chr_add_handlers in the realize callback * Use qdev chardev prop instead of qemu_char_get_next_serial * Add etraxfs_ser_create function to create etraxfs serial device Signed-off-by: xiaoqiang zhao Message-Id: <1464158344-12266-3-git-send-email-zxq_yx_007@163.com> Signed-off-by: Paolo Bonzini --- include/hw/cris/etraxfs.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/hw') diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h index 73a6134c1e..eb664181e7 100644 --- a/include/hw/cris/etraxfs.h +++ b/include/hw/cris/etraxfs.h @@ -46,4 +46,20 @@ etraxfs_eth_init(NICInfo *nd, hwaddr base, int phyaddr, return dev; } +static inline DeviceState *etraxfs_ser_create(hwaddr addr, + qemu_irq irq, + CharDriverState *chr) +{ + DeviceState *dev; + SysBusDevice *s; + + dev = qdev_create(NULL, "etraxfs,serial"); + s = SYS_BUS_DEVICE(dev); + qdev_prop_set_chr(dev, "chardev", chr); + qdev_init_nofail(dev); + sysbus_mmio_map(s, 0, addr); + sysbus_connect_irq(s, 0, irq); + return dev; +} + #endif -- cgit v1.2.3