* [PATCH v2 00/21] QOM'ify SysBusDeviceClass->init
@ 2018-11-23 15:30 ` Mao Zhongyi
0 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, david, alistair.francis, kraxel, edgar.iglesias,
gxt, sstabellini, qemu-block, mst, armbru, borntraeger,
marcel.apfelbaum, anthony.perard, marcandre.lureau, rth, thuth,
ehabkost, Mao Zhongyi, richard.henderson, chouteau, qemu-s390x,
qemu-arm, jan.kiszka, xen-devel, david, kwolf, cohuck, f4bug,
mreitz, michael, qemu-ppc, pbonzini
The SysBusDeviceClass::init() interface is considered
as a legacy interface and there are currently some
efforts going on to get rid of it. Thus convert
SysBusDeviceClass::init to DeviceClass::realize.
v2 -> v1:
- SYS_BUS_DEVICE(dev) was used in a function several
times, so use a variable 'sbd' to replace it, like:
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
- remove the xen_sysdev_init() function
- drop the patch21 in v1
- fix the broken in sysbus_realize of patch22
Cc: alistair.francis@wdc.com
Cc: anthony.perard@citrix.com
Cc: armbru@redhat.com
Cc: borntraeger@de.ibm.com
Cc: chouteau@adacore.com
Cc: cohuck@redhat.com
Cc: david@gibson.dropbear.id.au
Cc: david@redhat.com
Cc: edgar.iglesias@gmail.com
Cc: ehabkost@redhat.com
Cc: f4bug@amsat.org
Cc: gxt@mprc.pku.edu.cn
Cc: jan.kiszka@web.de
Cc: kraxel@redhat.com
Cc: kwolf@redhat.com
Cc: marcandre.lureau@redhat.com
Cc: marcel.apfelbaum@gmail.com
Cc: michael@walle.cc
Cc: mreitz@redhat.com
Cc: mst@redhat.com
Cc: pbonzini@redhat.com
Cc: peter.maydell@linaro.org
Cc: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org
Cc: qemu-block@nongnu.org
Cc: qemu-ppc@nongnu.org
Cc: qemu-s390x@nongnu.org
Cc: richard.henderson@linaro.org
Cc: rth@twiddle.net
Cc: sstabellini@kernel.org
Cc: thuth@redhat.com
Cc: xen-devel@lists.xenproject.org
Mao Zhongyi (21):
musicpal: Convert sysbus init function to realize function
block/noenand: Convert sysbus init function to realize function
char/grlib_apbuart: Convert sysbus init function to realize function
core/empty_slot: Convert sysbus init function to realize function
display/g364fb: Convert sysbus init function to realize function
dma/puv3_dma: Convert sysbus init function to realize function
gpio/puv3_gpio: Convert sysbus init function to realize function
milkymist-softusb: Convert sysbus init function to realize function
input/pl050: Convert sysbus init function to realize function
intc/puv3_intc: Convert sysbus init function to realize function
milkymist-hpdmc: Convert sysbus init function to realize function
milkymist-pfpu: Convert sysbus init function to realize function
puv3_pm.c: Convert sysbus init function to realize function
nvram/ds1225y: Convert sysbus init function to realize function
pci-bridge/dec: Convert sysbus init function to realize function
timer/etraxfs_timer: Convert sysbus init function to realize function
timer/grlib_gptimer: Convert sysbus init function to realize function
timer/puv3_ost: Convert sysbus init function to realize function
usb/tusb6010: Convert sysbus init function to realize function
xen_backend: remove xen_sysdev_init() function
core/sysbus: remove the SysBusDeviceClass::init path
hw/arm/musicpal.c | 9 ++++-----
hw/block/onenand.c | 16 +++++++---------
hw/char/grlib_apbuart.c | 12 +++++-------
hw/core/empty_slot.c | 9 ++++-----
hw/core/sysbus.c | 15 +++++----------
hw/display/g364fb.c | 9 +++------
hw/dma/puv3_dma.c | 10 ++++------
hw/gpio/puv3_gpio.c | 29 ++++++++++++++---------------
hw/input/milkymist-softusb.c | 16 +++++++---------
hw/input/pl050.c | 11 +++++------
hw/intc/puv3_intc.c | 11 ++++-------
hw/misc/milkymist-hpdmc.c | 9 +++------
hw/misc/milkymist-pfpu.c | 12 +++++-------
hw/misc/puv3_pm.c | 10 ++++------
hw/nvram/ds1225y.c | 12 +++++-------
hw/pci-bridge/dec.c | 11 +++++------
hw/timer/etraxfs_timer.c | 14 +++++++-------
hw/timer/grlib_gptimer.c | 11 +++++------
hw/timer/puv3_ost.c | 13 ++++++-------
hw/usb/tusb6010.c | 8 +++-----
hw/xen/xen_backend.c | 7 -------
include/hw/sysbus.h | 3 ---
22 files changed, 105 insertions(+), 152 deletions(-)
--
2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 01/21] musicpal: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, jan.kiszka, peter.maydell, qemu-arm, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
mv88w8618_wlan_class_init().
Cc: jan.kiszka@web.de
Cc: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/arm/musicpal.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 9648b3af44..7ffcdbb097 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1147,14 +1147,13 @@ static const MemoryRegionOps mv88w8618_wlan_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int mv88w8618_wlan_init(SysBusDevice *dev)
+static void mv88w8618_wlan_realize(DeviceState *dev, Error **errp)
{
MemoryRegion *iomem = g_new(MemoryRegion, 1);
memory_region_init_io(iomem, OBJECT(dev), &mv88w8618_wlan_ops, NULL,
"musicpal-wlan", MP_WLAN_SIZE);
- sysbus_init_mmio(dev, iomem);
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), iomem);
}
/* GPIO register offsets */
@@ -1720,9 +1719,9 @@ DEFINE_MACHINE("musicpal", musicpal_machine_init)
static void mv88w8618_wlan_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = mv88w8618_wlan_init;
+ dc->realize = mv88w8618_wlan_realize;
}
static const TypeInfo mv88w8618_wlan_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 02/21] block/noenand: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
(?)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 16:31 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, kwolf, mreitz, qemu-block, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
onenand_class_init().
Cc: kwolf@redhat.com
Cc: mreitz@redhat.com
Cc: qemu-block@nongnu.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/block/onenand.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 2b48609776..f11118a687 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -772,9 +772,9 @@ static const MemoryRegionOps onenand_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int onenand_initfn(SysBusDevice *sbd)
+static void onenand_realize(DeviceState *dev, Error **errp)
{
- DeviceState *dev = DEVICE(sbd);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
OneNANDState *s = ONE_NAND(dev);
uint32_t size = 1 << (24 + ((s->id.dev >> 4) & 7));
void *ram;
@@ -794,14 +794,14 @@ static int onenand_initfn(SysBusDevice *sbd)
0xff, size + (size >> 5));
} else {
if (blk_is_read_only(s->blk)) {
- error_report("Can't use a read-only drive");
- return -1;
+ error_setg(errp, "Can't use a read-only drive");
+ return;
}
blk_set_perm(s->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,
BLK_PERM_ALL, &local_err);
if (local_err) {
- error_report_err(local_err);
- return -1;
+ error_propagate(errp, local_err);
+ return;
}
s->blk_cur = s->blk;
}
@@ -826,7 +826,6 @@ static int onenand_initfn(SysBusDevice *sbd)
| ((s->id.dev & 0xff) << 8)
| (s->id.ver & 0xff),
&vmstate_onenand, s);
- return 0;
}
static Property onenand_properties[] = {
@@ -841,9 +840,8 @@ static Property onenand_properties[] = {
static void onenand_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = onenand_initfn;
+ dc->realize = onenand_realize;
dc->reset = onenand_system_reset;
dc->props = onenand_properties;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 02/21] block/noenand: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 02/21] block/noenand: " Mao Zhongyi
@ 2018-11-23 16:31 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 16:31 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: kwolf, Zhang Shengju, qemu-block, mreitz
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> onenand_class_init().
>
> Cc: kwolf@redhat.com
> Cc: mreitz@redhat.com
> Cc: qemu-block@nongnu.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/block/onenand.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/hw/block/onenand.c b/hw/block/onenand.c
> index 2b48609776..f11118a687 100644
> --- a/hw/block/onenand.c
> +++ b/hw/block/onenand.c
> @@ -772,9 +772,9 @@ static const MemoryRegionOps onenand_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int onenand_initfn(SysBusDevice *sbd)
> +static void onenand_realize(DeviceState *dev, Error **errp)
> {
> - DeviceState *dev = DEVICE(sbd);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
> OneNANDState *s = ONE_NAND(dev);
> uint32_t size = 1 << (24 + ((s->id.dev >> 4) & 7));
> void *ram;
> @@ -794,14 +794,14 @@ static int onenand_initfn(SysBusDevice *sbd)
> 0xff, size + (size >> 5));
> } else {
> if (blk_is_read_only(s->blk)) {
> - error_report("Can't use a read-only drive");
> - return -1;
> + error_setg(errp, "Can't use a read-only drive");
> + return;
> }
> blk_set_perm(s->blk, BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE,
> BLK_PERM_ALL, &local_err);
> if (local_err) {
> - error_report_err(local_err);
> - return -1;
> + error_propagate(errp, local_err);
> + return;
> }
> s->blk_cur = s->blk;
> }
> @@ -826,7 +826,6 @@ static int onenand_initfn(SysBusDevice *sbd)
> | ((s->id.dev & 0xff) << 8)
> | (s->id.ver & 0xff),
> &vmstate_onenand, s);
> - return 0;
> }
>
> static Property onenand_properties[] = {
> @@ -841,9 +840,8 @@ static Property onenand_properties[] = {
> static void onenand_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = onenand_initfn;
> + dc->realize = onenand_realize;
> dc->reset = onenand_system_reset;
> dc->props = onenand_properties;
> }
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 03/21] char/grlib_apbuart: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (2 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:38 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, chouteau, marcandre.lureau, pbonzini, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
grlib_apbuart_class_init().
Cc: chouteau@adacore.com
Cc: marcandre.lureau@redhat.com
Cc: pbonzini@redhat.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/char/grlib_apbuart.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
index bac11bec58..e1d258b611 100644
--- a/hw/char/grlib_apbuart.c
+++ b/hw/char/grlib_apbuart.c
@@ -239,9 +239,10 @@ static const MemoryRegionOps grlib_apbuart_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int grlib_apbuart_init(SysBusDevice *dev)
+static void grlib_apbuart_realize(DeviceState *dev, Error **errp)
{
UART *uart = GRLIB_APB_UART(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
qemu_chr_fe_set_handlers(&uart->chr,
grlib_apbuart_can_receive,
@@ -249,14 +250,12 @@ static int grlib_apbuart_init(SysBusDevice *dev)
grlib_apbuart_event,
NULL, uart, NULL, true);
- sysbus_init_irq(dev, &uart->irq);
+ sysbus_init_irq(sbd, &uart->irq);
memory_region_init_io(&uart->iomem, OBJECT(uart), &grlib_apbuart_ops, uart,
"uart", UART_REG_SIZE);
- sysbus_init_mmio(dev, &uart->iomem);
-
- return 0;
+ sysbus_init_mmio(sbd, &uart->iomem);
}
static void grlib_apbuart_reset(DeviceState *d)
@@ -280,9 +279,8 @@ static Property grlib_apbuart_properties[] = {
static void grlib_apbuart_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = grlib_apbuart_init;
+ dc->realize = grlib_apbuart_realize;
dc->reset = grlib_apbuart_reset;
dc->props = grlib_apbuart_properties;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 03/21] char/grlib_apbuart: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 03/21] char/grlib_apbuart: " Mao Zhongyi
@ 2018-11-23 15:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:38 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel
Cc: marcandre.lureau, Zhang Shengju, chouteau, pbonzini
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> grlib_apbuart_class_init().
>
> Cc: chouteau@adacore.com
> Cc: marcandre.lureau@redhat.com
> Cc: pbonzini@redhat.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/char/grlib_apbuart.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c
> index bac11bec58..e1d258b611 100644
> --- a/hw/char/grlib_apbuart.c
> +++ b/hw/char/grlib_apbuart.c
> @@ -239,9 +239,10 @@ static const MemoryRegionOps grlib_apbuart_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int grlib_apbuart_init(SysBusDevice *dev)
> +static void grlib_apbuart_realize(DeviceState *dev, Error **errp)
> {
> UART *uart = GRLIB_APB_UART(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> qemu_chr_fe_set_handlers(&uart->chr,
> grlib_apbuart_can_receive,
> @@ -249,14 +250,12 @@ static int grlib_apbuart_init(SysBusDevice *dev)
> grlib_apbuart_event,
> NULL, uart, NULL, true);
>
> - sysbus_init_irq(dev, &uart->irq);
> + sysbus_init_irq(sbd, &uart->irq);
>
> memory_region_init_io(&uart->iomem, OBJECT(uart), &grlib_apbuart_ops, uart,
> "uart", UART_REG_SIZE);
>
> - sysbus_init_mmio(dev, &uart->iomem);
> -
> - return 0;
> + sysbus_init_mmio(sbd, &uart->iomem);
> }
>
> static void grlib_apbuart_reset(DeviceState *d)
> @@ -280,9 +279,8 @@ static Property grlib_apbuart_properties[] = {
> static void grlib_apbuart_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = grlib_apbuart_init;
> + dc->realize = grlib_apbuart_realize;
> dc->reset = grlib_apbuart_reset;
> dc->props = grlib_apbuart_properties;
> }
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 04/21] core/empty_slot: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (3 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
empty_slot_class_init().
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/core/empty_slot.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/hw/core/empty_slot.c b/hw/core/empty_slot.c
index c1b9c2b104..239f78e2a7 100644
--- a/hw/core/empty_slot.c
+++ b/hw/core/empty_slot.c
@@ -71,21 +71,20 @@ void empty_slot_init(hwaddr addr, uint64_t slot_size)
}
}
-static int empty_slot_init1(SysBusDevice *dev)
+static void empty_slot_realize(DeviceState *dev, Error **errp)
{
EmptySlot *s = EMPTY_SLOT(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &empty_slot_ops, s,
"empty-slot", s->size);
- sysbus_init_mmio(dev, &s->iomem);
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
}
static void empty_slot_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- k->init = empty_slot_init1;
+ dc->realize = empty_slot_realize;
}
static const TypeInfo empty_slot_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 05/21] display/g364fb: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (4 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:43 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, pbonzini, kraxel, f4bug, alistair.francis, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
g364fb_sysbus_class_init().
Cc: pbonzini@redhat.com
Cc: kraxel@redhat.com
Cc: f4bug@amsat.org
Cc: alistair.francis@wdc.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
---
hw/display/g364fb.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
index 8ad7e5d824..3407adf98d 100644
--- a/hw/display/g364fb.c
+++ b/hw/display/g364fb.c
@@ -489,18 +489,16 @@ typedef struct {
G364State g364;
} G364SysBusState;
-static int g364fb_sysbus_init(SysBusDevice *sbd)
+static void g364fb_sysbus_realize(DeviceState *dev, Error **errp)
{
- DeviceState *dev = DEVICE(sbd);
G364SysBusState *sbs = G364(dev);
G364State *s = &sbs->g364;
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
g364fb_init(dev, s);
sysbus_init_irq(sbd, &s->irq);
sysbus_init_mmio(sbd, &s->mem_ctrl);
sysbus_init_mmio(sbd, &s->mem_vram);
-
- return 0;
}
static void g364fb_sysbus_reset(DeviceState *d)
@@ -518,9 +516,8 @@ static Property g364fb_sysbus_properties[] = {
static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = g364fb_sysbus_init;
+ dc->realize = g364fb_sysbus_realize;
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
dc->desc = "G364 framebuffer";
dc->reset = g364fb_sysbus_reset;
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 05/21] display/g364fb: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 05/21] display/g364fb: " Mao Zhongyi
@ 2018-11-23 15:43 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:43 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel
Cc: f4bug, alistair.francis, kraxel, pbonzini, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> g364fb_sysbus_class_init().
>
> Cc: pbonzini@redhat.com
> Cc: kraxel@redhat.com
> Cc: f4bug@amsat.org
> Cc: alistair.francis@wdc.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/display/g364fb.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c
> index 8ad7e5d824..3407adf98d 100644
> --- a/hw/display/g364fb.c
> +++ b/hw/display/g364fb.c
> @@ -489,18 +489,16 @@ typedef struct {
> G364State g364;
> } G364SysBusState;
>
> -static int g364fb_sysbus_init(SysBusDevice *sbd)
> +static void g364fb_sysbus_realize(DeviceState *dev, Error **errp)
> {
> - DeviceState *dev = DEVICE(sbd);
> G364SysBusState *sbs = G364(dev);
> G364State *s = &sbs->g364;
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> g364fb_init(dev, s);
> sysbus_init_irq(sbd, &s->irq);
> sysbus_init_mmio(sbd, &s->mem_ctrl);
> sysbus_init_mmio(sbd, &s->mem_vram);
> -
> - return 0;
> }
>
> static void g364fb_sysbus_reset(DeviceState *d)
> @@ -518,9 +516,8 @@ static Property g364fb_sysbus_properties[] = {
> static void g364fb_sysbus_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = g364fb_sysbus_init;
> + dc->realize = g364fb_sysbus_realize;
> set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
> dc->desc = "G364 framebuffer";
> dc->reset = g364fb_sysbus_reset;
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 06/21] dma/puv3_dma: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (5 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
puv3_dma_class_init().
Cc: gxt@mprc.pku.edu.cn
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/dma/puv3_dma.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/dma/puv3_dma.c b/hw/dma/puv3_dma.c
index b97a6c1767..c89eade029 100644
--- a/hw/dma/puv3_dma.c
+++ b/hw/dma/puv3_dma.c
@@ -76,7 +76,7 @@ static const MemoryRegionOps puv3_dma_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int puv3_dma_init(SysBusDevice *dev)
+static void puv3_dma_realize(DeviceState *dev, Error **errp)
{
PUV3DMAState *s = PUV3_DMA(dev);
int i;
@@ -87,16 +87,14 @@ static int puv3_dma_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_dma_ops, s, "puv3_dma",
PUV3_REGS_OFFSET);
- sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
}
static void puv3_dma_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = puv3_dma_init;
+ dc->realize = puv3_dma_realize;
}
static const TypeInfo puv3_dma_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 07/21] gpio/puv3_gpio: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (6 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:38 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, peter.maydell, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
puv3_gpio_class_init().
Cc: gxt@mprc.pku.edu.cn
Cc: peter.maydell@linaro.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/gpio/puv3_gpio.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
index 445afccf9f..33241b8564 100644
--- a/hw/gpio/puv3_gpio.c
+++ b/hw/gpio/puv3_gpio.c
@@ -99,36 +99,35 @@ static const MemoryRegionOps puv3_gpio_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int puv3_gpio_init(SysBusDevice *dev)
+static void puv3_gpio_realize(DeviceState *dev, Error **errp)
{
PUV3GPIOState *s = PUV3_GPIO(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
s->reg_GPLR = 0;
s->reg_GPDR = 0;
/* FIXME: these irqs not handled yet */
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW0]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW1]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW2]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW3]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW4]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW5]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW6]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW7]);
- sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOHIGH]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW0]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW1]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW2]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW3]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW4]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW5]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW6]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW7]);
+ sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOHIGH]);
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_gpio_ops, s, "puv3_gpio",
PUV3_REGS_OFFSET);
- sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
+ sysbus_init_mmio(sbd, &s->iomem);
}
static void puv3_gpio_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = puv3_gpio_init;
+ dc->realize = puv3_gpio_realize;
}
static const TypeInfo puv3_gpio_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 07/21] gpio/puv3_gpio: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 07/21] gpio/puv3_gpio: " Mao Zhongyi
@ 2018-11-23 15:38 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:38 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: peter.maydell, gxt, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> puv3_gpio_class_init().
>
> Cc: gxt@mprc.pku.edu.cn
> Cc: peter.maydell@linaro.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/gpio/puv3_gpio.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/hw/gpio/puv3_gpio.c b/hw/gpio/puv3_gpio.c
> index 445afccf9f..33241b8564 100644
> --- a/hw/gpio/puv3_gpio.c
> +++ b/hw/gpio/puv3_gpio.c
> @@ -99,36 +99,35 @@ static const MemoryRegionOps puv3_gpio_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int puv3_gpio_init(SysBusDevice *dev)
> +static void puv3_gpio_realize(DeviceState *dev, Error **errp)
> {
> PUV3GPIOState *s = PUV3_GPIO(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> s->reg_GPLR = 0;
> s->reg_GPDR = 0;
>
> /* FIXME: these irqs not handled yet */
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW0]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW1]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW2]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW3]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW4]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW5]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW6]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOLOW7]);
> - sysbus_init_irq(dev, &s->irq[PUV3_IRQS_GPIOHIGH]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW0]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW1]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW2]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW3]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW4]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW5]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW6]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOLOW7]);
> + sysbus_init_irq(sbd, &s->irq[PUV3_IRQS_GPIOHIGH]);
>
> memory_region_init_io(&s->iomem, OBJECT(s), &puv3_gpio_ops, s, "puv3_gpio",
> PUV3_REGS_OFFSET);
> - sysbus_init_mmio(dev, &s->iomem);
> -
> - return 0;
> + sysbus_init_mmio(sbd, &s->iomem);
> }
>
> static void puv3_gpio_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = puv3_gpio_init;
> + dc->realize = puv3_gpio_realize;
> }
>
> static const TypeInfo puv3_gpio_info = {
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 08/21] milkymist-softusb: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (7 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:39 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, michael, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
milkymist_softusb_class_init().
Cc: michael@walle.cc
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/input/milkymist-softusb.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
index ef8f47cd83..8766a17d9e 100644
--- a/hw/input/milkymist-softusb.c
+++ b/hw/input/milkymist-softusb.c
@@ -245,32 +245,31 @@ static void milkymist_softusb_reset(DeviceState *d)
s->regs[R_CTRL] = CTRL_RESET;
}
-static int milkymist_softusb_init(SysBusDevice *dev)
+static void milkymist_softusb_realize(DeviceState *dev, Error **errp)
{
MilkymistSoftUsbState *s = MILKYMIST_SOFTUSB(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
memory_region_init_io(&s->regs_region, OBJECT(s), &softusb_mmio_ops, s,
"milkymist-softusb", R_MAX * 4);
- sysbus_init_mmio(dev, &s->regs_region);
+ sysbus_init_mmio(sbd, &s->regs_region);
/* register pmem and dmem */
memory_region_init_ram_nomigrate(&s->pmem, OBJECT(s), "milkymist-softusb.pmem",
s->pmem_size, &error_fatal);
vmstate_register_ram_global(&s->pmem);
s->pmem_ptr = memory_region_get_ram_ptr(&s->pmem);
- sysbus_init_mmio(dev, &s->pmem);
+ sysbus_init_mmio(sbd, &s->pmem);
memory_region_init_ram_nomigrate(&s->dmem, OBJECT(s), "milkymist-softusb.dmem",
s->dmem_size, &error_fatal);
vmstate_register_ram_global(&s->dmem);
s->dmem_ptr = memory_region_get_ram_ptr(&s->dmem);
- sysbus_init_mmio(dev, &s->dmem);
+ sysbus_init_mmio(sbd, &s->dmem);
hid_init(&s->hid_kbd, HID_KEYBOARD, softusb_kbd_hid_datain);
hid_init(&s->hid_mouse, HID_MOUSE, softusb_mouse_hid_datain);
-
- return 0;
}
static const VMStateDescription vmstate_milkymist_softusb = {
@@ -296,9 +295,8 @@ static Property milkymist_softusb_properties[] = {
static void milkymist_softusb_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = milkymist_softusb_init;
+ dc->realize = milkymist_softusb_realize;
dc->reset = milkymist_softusb_reset;
dc->vmsd = &vmstate_milkymist_softusb;
dc->props = milkymist_softusb_properties;
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 08/21] milkymist-softusb: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 08/21] milkymist-softusb: " Mao Zhongyi
@ 2018-11-23 15:39 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:39 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: michael, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> milkymist_softusb_class_init().
>
> Cc: michael@walle.cc
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/input/milkymist-softusb.c | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
>
> diff --git a/hw/input/milkymist-softusb.c b/hw/input/milkymist-softusb.c
> index ef8f47cd83..8766a17d9e 100644
> --- a/hw/input/milkymist-softusb.c
> +++ b/hw/input/milkymist-softusb.c
> @@ -245,32 +245,31 @@ static void milkymist_softusb_reset(DeviceState *d)
> s->regs[R_CTRL] = CTRL_RESET;
> }
>
> -static int milkymist_softusb_init(SysBusDevice *dev)
> +static void milkymist_softusb_realize(DeviceState *dev, Error **errp)
> {
> MilkymistSoftUsbState *s = MILKYMIST_SOFTUSB(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> - sysbus_init_irq(dev, &s->irq);
> + sysbus_init_irq(sbd, &s->irq);
>
> memory_region_init_io(&s->regs_region, OBJECT(s), &softusb_mmio_ops, s,
> "milkymist-softusb", R_MAX * 4);
> - sysbus_init_mmio(dev, &s->regs_region);
> + sysbus_init_mmio(sbd, &s->regs_region);
>
> /* register pmem and dmem */
> memory_region_init_ram_nomigrate(&s->pmem, OBJECT(s), "milkymist-softusb.pmem",
> s->pmem_size, &error_fatal);
> vmstate_register_ram_global(&s->pmem);
> s->pmem_ptr = memory_region_get_ram_ptr(&s->pmem);
> - sysbus_init_mmio(dev, &s->pmem);
> + sysbus_init_mmio(sbd, &s->pmem);
> memory_region_init_ram_nomigrate(&s->dmem, OBJECT(s), "milkymist-softusb.dmem",
> s->dmem_size, &error_fatal);
> vmstate_register_ram_global(&s->dmem);
> s->dmem_ptr = memory_region_get_ram_ptr(&s->dmem);
> - sysbus_init_mmio(dev, &s->dmem);
> + sysbus_init_mmio(sbd, &s->dmem);
>
> hid_init(&s->hid_kbd, HID_KEYBOARD, softusb_kbd_hid_datain);
> hid_init(&s->hid_mouse, HID_MOUSE, softusb_mouse_hid_datain);
> -
> - return 0;
> }
>
> static const VMStateDescription vmstate_milkymist_softusb = {
> @@ -296,9 +295,8 @@ static Property milkymist_softusb_properties[] = {
> static void milkymist_softusb_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = milkymist_softusb_init;
> + dc->realize = milkymist_softusb_realize;
> dc->reset = milkymist_softusb_reset;
> dc->vmsd = &vmstate_milkymist_softusb;
> dc->props = milkymist_softusb_properties;
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 09/21] input/pl050: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (8 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:40 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, peter.maydell, qemu-arm, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
pl050_class_init().
Cc: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/input/pl050.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index be9cd57b17..15bffbfcad 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -139,19 +139,19 @@ static const MemoryRegionOps pl050_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int pl050_initfn(SysBusDevice *dev)
+static void pl050_realize(DeviceState *dev, Error **errp)
{
PL050State *s = PL050(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
memory_region_init_io(&s->iomem, OBJECT(s), &pl050_ops, s, "pl050", 0x1000);
- sysbus_init_mmio(dev, &s->iomem);
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_mmio(sbd, &s->iomem);
+ sysbus_init_irq(sbd, &s->irq);
if (s->is_mouse) {
s->dev = ps2_mouse_init(pl050_update, s);
} else {
s->dev = ps2_kbd_init(pl050_update, s);
}
- return 0;
}
static void pl050_keyboard_init(Object *obj)
@@ -183,9 +183,8 @@ static const TypeInfo pl050_mouse_info = {
static void pl050_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(oc);
- sdc->init = pl050_initfn;
+ dc->realize = pl050_realize;
dc->vmsd = &vmstate_pl050;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/21] input/pl050: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 09/21] input/pl050: " Mao Zhongyi
@ 2018-11-23 15:40 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:40 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: peter.maydell, qemu-arm, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> pl050_class_init().
>
> Cc: peter.maydell@linaro.org
> Cc: qemu-arm@nongnu.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/input/pl050.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/hw/input/pl050.c b/hw/input/pl050.c
> index be9cd57b17..15bffbfcad 100644
> --- a/hw/input/pl050.c
> +++ b/hw/input/pl050.c
> @@ -139,19 +139,19 @@ static const MemoryRegionOps pl050_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int pl050_initfn(SysBusDevice *dev)
> +static void pl050_realize(DeviceState *dev, Error **errp)
> {
> PL050State *s = PL050(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> memory_region_init_io(&s->iomem, OBJECT(s), &pl050_ops, s, "pl050", 0x1000);
> - sysbus_init_mmio(dev, &s->iomem);
> - sysbus_init_irq(dev, &s->irq);
> + sysbus_init_mmio(sbd, &s->iomem);
> + sysbus_init_irq(sbd, &s->irq);
> if (s->is_mouse) {
> s->dev = ps2_mouse_init(pl050_update, s);
> } else {
> s->dev = ps2_kbd_init(pl050_update, s);
> }
> - return 0;
> }
>
> static void pl050_keyboard_init(Object *obj)
> @@ -183,9 +183,8 @@ static const TypeInfo pl050_mouse_info = {
> static void pl050_class_init(ObjectClass *oc, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(oc);
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(oc);
>
> - sdc->init = pl050_initfn;
> + dc->realize = pl050_realize;
> dc->vmsd = &vmstate_pl050;
> }
>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 10/21] intc/puv3_intc: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (9 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:44 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
puv3_intc_class_init().
Cc: gxt@mprc.pku.edu.cn
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/intc/puv3_intc.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
index ef8488aacc..69ddc8c19a 100644
--- a/hw/intc/puv3_intc.c
+++ b/hw/intc/puv3_intc.c
@@ -101,10 +101,10 @@ static const MemoryRegionOps puv3_intc_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int puv3_intc_init(SysBusDevice *sbd)
+static void puv3_intc_realize(DeviceState *dev, Error **errp)
{
- DeviceState *dev = DEVICE(sbd);
PUV3INTCState *s = PUV3_INTC(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
qdev_init_gpio_in(dev, puv3_intc_handler, PUV3_IRQS_NR);
sysbus_init_irq(sbd, &s->parent_irq);
@@ -115,15 +115,12 @@ static int puv3_intc_init(SysBusDevice *sbd)
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_intc_ops, s, "puv3_intc",
PUV3_REGS_OFFSET);
sysbus_init_mmio(sbd, &s->iomem);
-
- return 0;
}
static void puv3_intc_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
-
- sdc->init = puv3_intc_init;
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ dc->realize = puv3_intc_realize;
}
static const TypeInfo puv3_intc_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 10/21] intc/puv3_intc: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 10/21] intc/puv3_intc: " Mao Zhongyi
@ 2018-11-23 15:44 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:44 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: gxt, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> puv3_intc_class_init().
>
> Cc: gxt@mprc.pku.edu.cn
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/intc/puv3_intc.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/hw/intc/puv3_intc.c b/hw/intc/puv3_intc.c
> index ef8488aacc..69ddc8c19a 100644
> --- a/hw/intc/puv3_intc.c
> +++ b/hw/intc/puv3_intc.c
> @@ -101,10 +101,10 @@ static const MemoryRegionOps puv3_intc_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int puv3_intc_init(SysBusDevice *sbd)
> +static void puv3_intc_realize(DeviceState *dev, Error **errp)
> {
> - DeviceState *dev = DEVICE(sbd);
> PUV3INTCState *s = PUV3_INTC(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> qdev_init_gpio_in(dev, puv3_intc_handler, PUV3_IRQS_NR);
> sysbus_init_irq(sbd, &s->parent_irq);
> @@ -115,15 +115,12 @@ static int puv3_intc_init(SysBusDevice *sbd)
> memory_region_init_io(&s->iomem, OBJECT(s), &puv3_intc_ops, s, "puv3_intc",
> PUV3_REGS_OFFSET);
> sysbus_init_mmio(sbd, &s->iomem);
> -
> - return 0;
> }
>
> static void puv3_intc_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> -
> - sdc->init = puv3_intc_init;
> + DeviceClass *dc = DEVICE_CLASS(klass);
> + dc->realize = puv3_intc_realize;
> }
>
> static const TypeInfo puv3_intc_info = {
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 11/21] milkymist-hpdmc: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (10 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, michael, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
milkymist_hpdmc_class_init().
Cc: gxt@mprc.pku.edu.cn
Cc: michael@walle.cc
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/misc/milkymist-hpdmc.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/hw/misc/milkymist-hpdmc.c b/hw/misc/milkymist-hpdmc.c
index e6140eec6b..44dc0698ec 100644
--- a/hw/misc/milkymist-hpdmc.c
+++ b/hw/misc/milkymist-hpdmc.c
@@ -129,15 +129,13 @@ static void milkymist_hpdmc_reset(DeviceState *d)
| IODELAY_PLL2_LOCKED;
}
-static int milkymist_hpdmc_init(SysBusDevice *dev)
+static void milkymist_hpdmc_realize(DeviceState *dev, Error **errp)
{
MilkymistHpdmcState *s = MILKYMIST_HPDMC(dev);
memory_region_init_io(&s->regs_region, OBJECT(dev), &hpdmc_mmio_ops, s,
"milkymist-hpdmc", R_MAX * 4);
- sysbus_init_mmio(dev, &s->regs_region);
-
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->regs_region);
}
static const VMStateDescription vmstate_milkymist_hpdmc = {
@@ -153,9 +151,8 @@ static const VMStateDescription vmstate_milkymist_hpdmc = {
static void milkymist_hpdmc_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = milkymist_hpdmc_init;
+ dc->realize = milkymist_hpdmc_realize;
dc->reset = milkymist_hpdmc_reset;
dc->vmsd = &vmstate_milkymist_hpdmc;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 12/21] milkymist-pfpu: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (11 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:40 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, michael, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
milkymist_pfpu_class_init().
Cc: michael@walle.cc
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/misc/milkymist-pfpu.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c
index 86f5e383b0..4a03c7ee63 100644
--- a/hw/misc/milkymist-pfpu.c
+++ b/hw/misc/milkymist-pfpu.c
@@ -497,17 +497,16 @@ static void milkymist_pfpu_reset(DeviceState *d)
}
}
-static int milkymist_pfpu_init(SysBusDevice *dev)
+static void milkymist_pfpu_realize(DeviceState *dev, Error **errp)
{
MilkymistPFPUState *s = MILKYMIST_PFPU(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
memory_region_init_io(&s->regs_region, OBJECT(dev), &pfpu_mmio_ops, s,
"milkymist-pfpu", MICROCODE_END * 4);
- sysbus_init_mmio(dev, &s->regs_region);
-
- return 0;
+ sysbus_init_mmio(sbd, &s->regs_region);
}
static const VMStateDescription vmstate_milkymist_pfpu = {
@@ -527,9 +526,8 @@ static const VMStateDescription vmstate_milkymist_pfpu = {
static void milkymist_pfpu_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = milkymist_pfpu_init;
+ dc->realize = milkymist_pfpu_realize;
dc->reset = milkymist_pfpu_reset;
dc->vmsd = &vmstate_milkymist_pfpu;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 12/21] milkymist-pfpu: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 12/21] milkymist-pfpu: " Mao Zhongyi
@ 2018-11-23 15:40 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:40 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: michael, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> milkymist_pfpu_class_init().
>
> Cc: michael@walle.cc
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/misc/milkymist-pfpu.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/hw/misc/milkymist-pfpu.c b/hw/misc/milkymist-pfpu.c
> index 86f5e383b0..4a03c7ee63 100644
> --- a/hw/misc/milkymist-pfpu.c
> +++ b/hw/misc/milkymist-pfpu.c
> @@ -497,17 +497,16 @@ static void milkymist_pfpu_reset(DeviceState *d)
> }
> }
>
> -static int milkymist_pfpu_init(SysBusDevice *dev)
> +static void milkymist_pfpu_realize(DeviceState *dev, Error **errp)
> {
> MilkymistPFPUState *s = MILKYMIST_PFPU(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> - sysbus_init_irq(dev, &s->irq);
> + sysbus_init_irq(sbd, &s->irq);
>
> memory_region_init_io(&s->regs_region, OBJECT(dev), &pfpu_mmio_ops, s,
> "milkymist-pfpu", MICROCODE_END * 4);
> - sysbus_init_mmio(dev, &s->regs_region);
> -
> - return 0;
> + sysbus_init_mmio(sbd, &s->regs_region);
> }
>
> static const VMStateDescription vmstate_milkymist_pfpu = {
> @@ -527,9 +526,8 @@ static const VMStateDescription vmstate_milkymist_pfpu = {
> static void milkymist_pfpu_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = milkymist_pfpu_init;
> + dc->realize = milkymist_pfpu_realize;
> dc->reset = milkymist_pfpu_reset;
> dc->vmsd = &vmstate_milkymist_pfpu;
> }
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 13/21] puv3_pm.c: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (12 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
puv3_pm_class_init().
Cc: gxt@mprc.pku.edu.cn
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/misc/puv3_pm.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/misc/puv3_pm.c b/hw/misc/puv3_pm.c
index 577cebaac7..afe191fbe1 100644
--- a/hw/misc/puv3_pm.c
+++ b/hw/misc/puv3_pm.c
@@ -119,7 +119,7 @@ static const MemoryRegionOps puv3_pm_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int puv3_pm_init(SysBusDevice *dev)
+static void puv3_pm_realize(DeviceState *dev, Error **errp)
{
PUV3PMState *s = PUV3_PM(dev);
@@ -127,16 +127,14 @@ static int puv3_pm_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_pm_ops, s, "puv3_pm",
PUV3_REGS_OFFSET);
- sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
}
static void puv3_pm_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = puv3_pm_init;
+ dc->realize = puv3_pm_realize;
}
static const TypeInfo puv3_pm_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 14/21] nvram/ds1225y: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (13 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, pbonzini, marcandre.lureau, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
nvram_sysbus_class_init().
Cc: pbonzini@redhat.com
Cc: marcandre.lureau@redhat.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
hw/nvram/ds1225y.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/nvram/ds1225y.c b/hw/nvram/ds1225y.c
index ad7345f288..b6ef463db0 100644
--- a/hw/nvram/ds1225y.c
+++ b/hw/nvram/ds1225y.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
#include "trace.h"
+#include "qemu/error-report.h"
typedef struct {
MemoryRegion iomem;
@@ -113,7 +114,7 @@ typedef struct {
NvRamState nvram;
} SysBusNvRamState;
-static int nvram_sysbus_initfn(SysBusDevice *dev)
+static void nvram_sysbus_realize(DeviceState *dev, Error **errp)
{
SysBusNvRamState *sys = DS1225Y(dev);
NvRamState *s = &sys->nvram;
@@ -123,20 +124,18 @@ static int nvram_sysbus_initfn(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &nvram_ops, s,
"nvram", s->chip_size);
- sysbus_init_mmio(dev, &s->iomem);
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
/* Read current file */
file = s->filename ? fopen(s->filename, "rb") : NULL;
if (file) {
/* Read nvram contents */
if (fread(s->contents, s->chip_size, 1, file) != 1) {
- printf("nvram_sysbus_initfn: short read\n");
+ error_report("nvram_sysbus_realize: short read");
}
fclose(file);
}
nvram_post_load(s, 0);
-
- return 0;
}
static Property nvram_sysbus_properties[] = {
@@ -148,9 +147,8 @@ static Property nvram_sysbus_properties[] = {
static void nvram_sysbus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = nvram_sysbus_initfn;
+ dc->realize = nvram_sysbus_realize;
dc->vmsd = &vmstate_nvram;
dc->props = nvram_sysbus_properties;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (14 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 16:37 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, david, mst, marcel.apfelbaum, qemu-ppc, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
pci_dec_21154_device_class_init().
Cc: david@gibson.dropbear.id.au
Cc: mst@redhat.com
Cc: marcel.apfelbaum@gmail.com
Cc: qemu-ppc@nongnu.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
---
hw/pci-bridge/dec.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
index 84492d5e5f..5b21c20e50 100644
--- a/hw/pci-bridge/dec.c
+++ b/hw/pci-bridge/dec.c
@@ -98,7 +98,7 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
return pci_bridge_get_sec_bus(br);
}
-static int pci_dec_21154_device_init(SysBusDevice *dev)
+static void pci_dec_21154_device_realize(DeviceState *dev, Error **errp)
{
PCIHostState *phb;
@@ -108,9 +108,8 @@ static int pci_dec_21154_device_init(SysBusDevice *dev)
dev, "pci-conf-idx", 0x1000);
memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_ops,
dev, "pci-data-idx", 0x1000);
- sysbus_init_mmio(dev, &phb->conf_mem);
- sysbus_init_mmio(dev, &phb->data_mem);
- return 0;
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->conf_mem);
+ sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->data_mem);
}
static void dec_21154_pci_host_realize(PCIDevice *d, Error **errp)
@@ -150,9 +149,9 @@ static const TypeInfo dec_21154_pci_host_info = {
static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = pci_dec_21154_device_init;
+ dc->realize = pci_dec_21154_device_realize;
}
static const TypeInfo pci_dec_21154_device_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: " Mao Zhongyi
@ 2018-11-23 16:37 ` Philippe Mathieu-Daudé
2018-11-25 1:36 ` [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: Convert sysbus initfunction " maozy
0 siblings, 1 reply; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 16:37 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: mst, qemu-ppc, Zhang Shengju, david
Hi Mao,
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> pci_dec_21154_device_class_init().
>
> Cc: david@gibson.dropbear.id.au
> Cc: mst@redhat.com
> Cc: marcel.apfelbaum@gmail.com
> Cc: qemu-ppc@nongnu.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> Acked-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> hw/pci-bridge/dec.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
> index 84492d5e5f..5b21c20e50 100644
> --- a/hw/pci-bridge/dec.c
> +++ b/hw/pci-bridge/dec.c
> @@ -98,7 +98,7 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
> return pci_bridge_get_sec_bus(br);
> }
>
> -static int pci_dec_21154_device_init(SysBusDevice *dev)
> +static void pci_dec_21154_device_realize(DeviceState *dev, Error **errp)
> {
> PCIHostState *phb;
Why don't you use:
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
like in all the other patches from this series...?
>
> @@ -108,9 +108,8 @@ static int pci_dec_21154_device_init(SysBusDevice *dev)
> dev, "pci-conf-idx", 0x1000);
> memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_ops,
> dev, "pci-data-idx", 0x1000);
> - sysbus_init_mmio(dev, &phb->conf_mem);
> - sysbus_init_mmio(dev, &phb->data_mem);
> - return 0;
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->conf_mem);
> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->data_mem);
... this would save extra type checking here, as explain by Peter:
https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg03644.html
> }
>
> static void dec_21154_pci_host_realize(PCIDevice *d, Error **errp)
> @@ -150,9 +149,9 @@ static const TypeInfo dec_21154_pci_host_info = {
>
> static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = pci_dec_21154_device_init;
> + dc->realize = pci_dec_21154_device_realize;
> }
>
> static const TypeInfo pci_dec_21154_device_info = {
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 15/21] pci-bridge/dec: Convert sysbus initfunction to realize function
2018-11-23 16:37 ` Philippe Mathieu-Daudé
@ 2018-11-25 1:36 ` maozy
0 siblings, 0 replies; 40+ messages in thread
From: maozy @ 2018-11-25 1:36 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: mst, qemu-ppc, Zhang Shengju, david
Hi, Philippe
On 11/24/18 12:37 AM, Philippe Mathieu-Daudé wrote:
> Hi Mao,
>
> On 23/11/18 16:30, Mao Zhongyi wrote:
>> Use DeviceClass rather than SysBusDeviceClass in
>> pci_dec_21154_device_class_init().
>>
>> Cc: david@gibson.dropbear.id.au
>> Cc: mst@redhat.com
>> Cc: marcel.apfelbaum@gmail.com
>> Cc: qemu-ppc@nongnu.org
>>
>> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
>> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
>> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
>> Acked-by: David Gibson <david@gibson.dropbear.id.au>
>> ---
>> hw/pci-bridge/dec.c | 11 +++++------
>> 1 file changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/hw/pci-bridge/dec.c b/hw/pci-bridge/dec.c
>> index 84492d5e5f..5b21c20e50 100644
>> --- a/hw/pci-bridge/dec.c
>> +++ b/hw/pci-bridge/dec.c
>> @@ -98,7 +98,7 @@ PCIBus *pci_dec_21154_init(PCIBus *parent_bus, int devfn)
>> return pci_bridge_get_sec_bus(br);
>> }
>>
>> -static int pci_dec_21154_device_init(SysBusDevice *dev)
>> +static void pci_dec_21154_device_realize(DeviceState *dev, Error **errp)
>> {
>> PCIHostState *phb;
>
> Why don't you use:
>
> SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> like in all the other patches from this series...?
Oops, sorry, I missed this one, will fix it in v3.
Thanks,
Mao
>
>>
>> @@ -108,9 +108,8 @@ static int pci_dec_21154_device_init(SysBusDevice *dev)
>> dev, "pci-conf-idx", 0x1000);
>> memory_region_init_io(&phb->data_mem, OBJECT(dev), &pci_host_data_le_ops,
>> dev, "pci-data-idx", 0x1000);
>> - sysbus_init_mmio(dev, &phb->conf_mem);
>> - sysbus_init_mmio(dev, &phb->data_mem);
>> - return 0;
>> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->conf_mem);
>> + sysbus_init_mmio(SYS_BUS_DEVICE(dev), &phb->data_mem);
>
> ... this would save extra type checking here, as explain by Peter:
> https://lists.gnu.org/archive/html/qemu-devel/2018-11/msg03644.html
>
>> }
>>
>> static void dec_21154_pci_host_realize(PCIDevice *d, Error **errp)
>> @@ -150,9 +149,9 @@ static const TypeInfo dec_21154_pci_host_info = {
>>
>> static void pci_dec_21154_device_class_init(ObjectClass *klass, void *data)
>> {
>> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
>> + DeviceClass *dc = DEVICE_CLASS(klass);
>>
>> - sdc->init = pci_dec_21154_device_init;
>> + dc->realize = pci_dec_21154_device_realize;
>> }
>>
>> static const TypeInfo pci_dec_21154_device_info = {
>>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (15 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 16:32 ` Philippe Mathieu-Daudé
2018-11-23 16:33 ` Edgar E. Iglesias
-1 siblings, 2 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, edgar.iglesias, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
etraxfs_timer_class_init().
Cc: edgar.iglesias@gmail.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/timer/etraxfs_timer.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
index d13bc30b2d..2280914b1d 100644
--- a/hw/timer/etraxfs_timer.c
+++ b/hw/timer/etraxfs_timer.c
@@ -315,9 +315,10 @@ static void etraxfs_timer_reset(void *opaque)
qemu_irq_lower(t->irq);
}
-static int etraxfs_timer_init(SysBusDevice *dev)
+static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
{
ETRAXTimerState *t = ETRAX_TIMER(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
t->bh_t0 = qemu_bh_new(timer0_hit, t);
t->bh_t1 = qemu_bh_new(timer1_hit, t);
@@ -326,21 +327,20 @@ static int etraxfs_timer_init(SysBusDevice *dev)
t->ptimer_t1 = ptimer_init(t->bh_t1, PTIMER_POLICY_DEFAULT);
t->ptimer_wd = ptimer_init(t->bh_wd, PTIMER_POLICY_DEFAULT);
- sysbus_init_irq(dev, &t->irq);
- sysbus_init_irq(dev, &t->nmi);
+ sysbus_init_irq(sbd, &t->irq);
+ sysbus_init_irq(sbd, &t->nmi);
memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
"etraxfs-timer", 0x5c);
- sysbus_init_mmio(dev, &t->mmio);
+ sysbus_init_mmio(sbd, &t->mmio);
qemu_register_reset(etraxfs_timer_reset, t);
- return 0;
}
static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = etraxfs_timer_init;
+ dc->realize = etraxfs_timer_realize;
}
static const TypeInfo etraxfs_timer_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function " Mao Zhongyi
@ 2018-11-23 16:32 ` Philippe Mathieu-Daudé
2018-11-23 16:33 ` Edgar E. Iglesias
1 sibling, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 16:32 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: edgar.iglesias, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> etraxfs_timer_class_init().
>
> Cc: edgar.iglesias@gmail.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/timer/etraxfs_timer.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
> index d13bc30b2d..2280914b1d 100644
> --- a/hw/timer/etraxfs_timer.c
> +++ b/hw/timer/etraxfs_timer.c
> @@ -315,9 +315,10 @@ static void etraxfs_timer_reset(void *opaque)
> qemu_irq_lower(t->irq);
> }
>
> -static int etraxfs_timer_init(SysBusDevice *dev)
> +static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
> {
> ETRAXTimerState *t = ETRAX_TIMER(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> t->bh_t0 = qemu_bh_new(timer0_hit, t);
> t->bh_t1 = qemu_bh_new(timer1_hit, t);
> @@ -326,21 +327,20 @@ static int etraxfs_timer_init(SysBusDevice *dev)
> t->ptimer_t1 = ptimer_init(t->bh_t1, PTIMER_POLICY_DEFAULT);
> t->ptimer_wd = ptimer_init(t->bh_wd, PTIMER_POLICY_DEFAULT);
>
> - sysbus_init_irq(dev, &t->irq);
> - sysbus_init_irq(dev, &t->nmi);
> + sysbus_init_irq(sbd, &t->irq);
> + sysbus_init_irq(sbd, &t->nmi);
>
> memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
> "etraxfs-timer", 0x5c);
> - sysbus_init_mmio(dev, &t->mmio);
> + sysbus_init_mmio(sbd, &t->mmio);
> qemu_register_reset(etraxfs_timer_reset, t);
> - return 0;
> }
>
> static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = etraxfs_timer_init;
> + dc->realize = etraxfs_timer_realize;
> }
>
> static const TypeInfo etraxfs_timer_info = {
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 16/21] timer/etraxfs_timer: Convert sysbus init function " Mao Zhongyi
2018-11-23 16:32 ` Philippe Mathieu-Daudé
@ 2018-11-23 16:33 ` Edgar E. Iglesias
1 sibling, 0 replies; 40+ messages in thread
From: Edgar E. Iglesias @ 2018-11-23 16:33 UTC (permalink / raw)
To: Mao Zhongyi; +Cc: qemu-devel, Zhang Shengju
On Fri, Nov 23, 2018 at 11:30:35PM +0800, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> etraxfs_timer_class_init().
>
> Cc: edgar.iglesias@gmail.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
> hw/timer/etraxfs_timer.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
> index d13bc30b2d..2280914b1d 100644
> --- a/hw/timer/etraxfs_timer.c
> +++ b/hw/timer/etraxfs_timer.c
> @@ -315,9 +315,10 @@ static void etraxfs_timer_reset(void *opaque)
> qemu_irq_lower(t->irq);
> }
>
> -static int etraxfs_timer_init(SysBusDevice *dev)
> +static void etraxfs_timer_realize(DeviceState *dev, Error **errp)
> {
> ETRAXTimerState *t = ETRAX_TIMER(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> t->bh_t0 = qemu_bh_new(timer0_hit, t);
> t->bh_t1 = qemu_bh_new(timer1_hit, t);
> @@ -326,21 +327,20 @@ static int etraxfs_timer_init(SysBusDevice *dev)
> t->ptimer_t1 = ptimer_init(t->bh_t1, PTIMER_POLICY_DEFAULT);
> t->ptimer_wd = ptimer_init(t->bh_wd, PTIMER_POLICY_DEFAULT);
>
> - sysbus_init_irq(dev, &t->irq);
> - sysbus_init_irq(dev, &t->nmi);
> + sysbus_init_irq(sbd, &t->irq);
> + sysbus_init_irq(sbd, &t->nmi);
>
> memory_region_init_io(&t->mmio, OBJECT(t), &timer_ops, t,
> "etraxfs-timer", 0x5c);
> - sysbus_init_mmio(dev, &t->mmio);
> + sysbus_init_mmio(sbd, &t->mmio);
> qemu_register_reset(etraxfs_timer_reset, t);
> - return 0;
> }
>
> static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = etraxfs_timer_init;
> + dc->realize = etraxfs_timer_realize;
> }
>
> static const TypeInfo etraxfs_timer_info = {
> --
> 2.17.1
>
>
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 17/21] timer/grlib_gptimer: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (16 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 15:41 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, chouteau, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
grlib_gptimer_class_init().
Cc: chouteau@adacore.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/timer/grlib_gptimer.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c
index 4ed96e970a..183eddc073 100644
--- a/hw/timer/grlib_gptimer.c
+++ b/hw/timer/grlib_gptimer.c
@@ -347,10 +347,11 @@ static void grlib_gptimer_reset(DeviceState *d)
}
}
-static int grlib_gptimer_init(SysBusDevice *dev)
+static void grlib_gptimer_realize(DeviceState *dev, Error **errp)
{
GPTimerUnit *unit = GRLIB_GPTIMER(dev);
unsigned int i;
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
assert(unit->nr_timers > 0);
assert(unit->nr_timers <= GPTIMER_MAX_TIMERS);
@@ -366,7 +367,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
timer->id = i;
/* One IRQ line for each timer */
- sysbus_init_irq(dev, &timer->irq);
+ sysbus_init_irq(sbd, &timer->irq);
ptimer_set_freq(timer->ptimer, unit->freq_hz);
}
@@ -375,8 +376,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
unit, "gptimer",
UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers);
- sysbus_init_mmio(dev, &unit->iomem);
- return 0;
+ sysbus_init_mmio(sbd, &unit->iomem);
}
static Property grlib_gptimer_properties[] = {
@@ -389,9 +389,8 @@ static Property grlib_gptimer_properties[] = {
static void grlib_gptimer_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = grlib_gptimer_init;
+ dc->realize = grlib_gptimer_realize;
dc->reset = grlib_gptimer_reset;
dc->props = grlib_gptimer_properties;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 17/21] timer/grlib_gptimer: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 17/21] timer/grlib_gptimer: " Mao Zhongyi
@ 2018-11-23 15:41 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 15:41 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: chouteau, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> grlib_gptimer_class_init().
>
> Cc: chouteau@adacore.com
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/timer/grlib_gptimer.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c
> index 4ed96e970a..183eddc073 100644
> --- a/hw/timer/grlib_gptimer.c
> +++ b/hw/timer/grlib_gptimer.c
> @@ -347,10 +347,11 @@ static void grlib_gptimer_reset(DeviceState *d)
> }
> }
>
> -static int grlib_gptimer_init(SysBusDevice *dev)
> +static void grlib_gptimer_realize(DeviceState *dev, Error **errp)
> {
> GPTimerUnit *unit = GRLIB_GPTIMER(dev);
> unsigned int i;
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> assert(unit->nr_timers > 0);
> assert(unit->nr_timers <= GPTIMER_MAX_TIMERS);
> @@ -366,7 +367,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
> timer->id = i;
>
> /* One IRQ line for each timer */
> - sysbus_init_irq(dev, &timer->irq);
> + sysbus_init_irq(sbd, &timer->irq);
>
> ptimer_set_freq(timer->ptimer, unit->freq_hz);
> }
> @@ -375,8 +376,7 @@ static int grlib_gptimer_init(SysBusDevice *dev)
> unit, "gptimer",
> UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers);
>
> - sysbus_init_mmio(dev, &unit->iomem);
> - return 0;
> + sysbus_init_mmio(sbd, &unit->iomem);
> }
>
> static Property grlib_gptimer_properties[] = {
> @@ -389,9 +389,8 @@ static Property grlib_gptimer_properties[] = {
> static void grlib_gptimer_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
> - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
>
> - k->init = grlib_gptimer_init;
> + dc->realize = grlib_gptimer_realize;
> dc->reset = grlib_gptimer_reset;
> dc->props = grlib_gptimer_properties;
> }
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 18/21] timer/puv3_ost: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (17 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
2018-11-23 16:33 ` Philippe Mathieu-Daudé
-1 siblings, 1 reply; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, gxt, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
puv3_ost_class_init().
Cc: gxt@mprc.pku.edu.cn
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/timer/puv3_ost.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
index 0b3d717e60..3be58c7fdd 100644
--- a/hw/timer/puv3_ost.c
+++ b/hw/timer/puv3_ost.c
@@ -113,16 +113,17 @@ static void puv3_ost_tick(void *opaque)
}
}
-static int puv3_ost_init(SysBusDevice *dev)
+static void puv3_ost_realize(DeviceState *dev, Error **errp)
{
PUV3OSTState *s = PUV3_OST(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
s->reg_OIER = 0;
s->reg_OSSR = 0;
s->reg_OSMR0 = 0;
s->reg_OSCR = 0;
- sysbus_init_irq(dev, &s->irq);
+ sysbus_init_irq(sbd, &s->irq);
s->bh = qemu_bh_new(puv3_ost_tick, s);
s->ptimer = ptimer_init(s->bh, PTIMER_POLICY_DEFAULT);
@@ -130,16 +131,14 @@ static int puv3_ost_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &puv3_ost_ops, s, "puv3_ost",
PUV3_REGS_OFFSET);
- sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
+ sysbus_init_mmio(sbd, &s->iomem);
}
static void puv3_ost_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = puv3_ost_init;
+ dc->realize = puv3_ost_realize;
}
static const TypeInfo puv3_ost_info = {
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 18/21] timer/puv3_ost: Convert sysbus init function to realize function
2018-11-23 15:30 ` [Qemu-devel] [PATCH v2 18/21] timer/puv3_ost: " Mao Zhongyi
@ 2018-11-23 16:33 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 40+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-11-23 16:33 UTC (permalink / raw)
To: Mao Zhongyi, qemu-devel; +Cc: gxt, Zhang Shengju
On 23/11/18 16:30, Mao Zhongyi wrote:
> Use DeviceClass rather than SysBusDeviceClass in
> puv3_ost_class_init().
>
> Cc: gxt@mprc.pku.edu.cn
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/timer/puv3_ost.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/hw/timer/puv3_ost.c b/hw/timer/puv3_ost.c
> index 0b3d717e60..3be58c7fdd 100644
> --- a/hw/timer/puv3_ost.c
> +++ b/hw/timer/puv3_ost.c
> @@ -113,16 +113,17 @@ static void puv3_ost_tick(void *opaque)
> }
> }
>
> -static int puv3_ost_init(SysBusDevice *dev)
> +static void puv3_ost_realize(DeviceState *dev, Error **errp)
> {
> PUV3OSTState *s = PUV3_OST(dev);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
>
> s->reg_OIER = 0;
> s->reg_OSSR = 0;
> s->reg_OSMR0 = 0;
> s->reg_OSCR = 0;
>
> - sysbus_init_irq(dev, &s->irq);
> + sysbus_init_irq(sbd, &s->irq);
>
> s->bh = qemu_bh_new(puv3_ost_tick, s);
> s->ptimer = ptimer_init(s->bh, PTIMER_POLICY_DEFAULT);
> @@ -130,16 +131,14 @@ static int puv3_ost_init(SysBusDevice *dev)
>
> memory_region_init_io(&s->iomem, OBJECT(s), &puv3_ost_ops, s, "puv3_ost",
> PUV3_REGS_OFFSET);
> - sysbus_init_mmio(dev, &s->iomem);
> -
> - return 0;
> + sysbus_init_mmio(sbd, &s->iomem);
> }
>
> static void puv3_ost_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
>
> - sdc->init = puv3_ost_init;
> + dc->realize = puv3_ost_realize;
> }
>
> static const TypeInfo puv3_ost_info = {
>
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 19/21] usb/tusb6010: Convert sysbus init function to realize function
2018-11-23 15:30 ` Mao Zhongyi
` (18 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel; +Cc: Mao Zhongyi, kraxel, Zhang Shengju
Use DeviceClass rather than SysBusDeviceClass in
tusb6010_class_init().
Cc: kraxel@redhat.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/usb/tusb6010.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/usb/tusb6010.c b/hw/usb/tusb6010.c
index a2128024c1..501706e2b2 100644
--- a/hw/usb/tusb6010.c
+++ b/hw/usb/tusb6010.c
@@ -808,10 +808,10 @@ static void tusb6010_reset(DeviceState *dev)
musb_reset(s->musb);
}
-static int tusb6010_init(SysBusDevice *sbd)
+static void tusb6010_realize(DeviceState *dev, Error **errp)
{
- DeviceState *dev = DEVICE(sbd);
TUSBState *s = TUSB(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
s->otg_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_otg_tick, s);
s->pwr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, tusb_power_tick, s);
@@ -822,15 +822,13 @@ static int tusb6010_init(SysBusDevice *sbd)
sysbus_init_irq(sbd, &s->irq);
qdev_init_gpio_in(dev, tusb6010_irq, musb_irq_max + 1);
s->musb = musb_init(dev, 1);
- return 0;
}
static void tusb6010_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = tusb6010_init;
+ dc->realize = tusb6010_realize;
dc->reset = tusb6010_reset;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 20/21] xen_backend: remove xen_sysdev_init() function
2018-11-23 15:30 ` Mao Zhongyi
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, sstabellini, anthony.perard, xen-devel,
peter.maydell, Zhang Shengju
The init function doesn't do anything at all, so we
just omit it.
Cc: sstabellini@kernel.org
Cc: anthony.perard@citrix.com
Cc: xen-devel@lists.xenproject.org
Cc: peter.maydell@linaro.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/xen/xen_backend.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 9a8e8771ec..0bc6b1de60 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -809,11 +809,6 @@ static const TypeInfo xensysbus_info = {
}
};
-static int xen_sysdev_init(SysBusDevice *dev)
-{
- return 0;
-}
-
static Property xen_sysdev_properties[] = {
{/* end of property list */},
};
@@ -821,9 +816,7 @@ static Property xen_sysdev_properties[] = {
static void xen_sysdev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = xen_sysdev_init;
dc->props = xen_sysdev_properties;
dc->bus_type = TYPE_XENSYSBUS;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread
* [PATCH v2 20/21] xen_backend: remove xen_sysdev_init() function
@ 2018-11-23 15:30 ` Mao Zhongyi
0 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: peter.maydell, sstabellini, Mao Zhongyi, anthony.perard,
xen-devel, Zhang Shengju
The init function doesn't do anything at all, so we
just omit it.
Cc: sstabellini@kernel.org
Cc: anthony.perard@citrix.com
Cc: xen-devel@lists.xenproject.org
Cc: peter.maydell@linaro.org
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/xen/xen_backend.c | 7 -------
1 file changed, 7 deletions(-)
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index 9a8e8771ec..0bc6b1de60 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -809,11 +809,6 @@ static const TypeInfo xensysbus_info = {
}
};
-static int xen_sysdev_init(SysBusDevice *dev)
-{
- return 0;
-}
-
static Property xen_sysdev_properties[] = {
{/* end of property list */},
};
@@ -821,9 +816,7 @@ static Property xen_sysdev_properties[] = {
static void xen_sysdev_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = xen_sysdev_init;
dc->props = xen_sysdev_properties;
dc->bus_type = TYPE_XENSYSBUS;
}
--
2.17.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 40+ messages in thread
* Re: [Qemu-devel] [PATCH v2 20/21] xen_backend: remove xen_sysdev_init() function
2018-11-23 15:30 ` Mao Zhongyi
@ 2018-11-26 14:27 ` Anthony PERARD
-1 siblings, 0 replies; 40+ messages in thread
From: Anthony PERARD @ 2018-11-26 14:27 UTC (permalink / raw)
To: Mao Zhongyi
Cc: qemu-devel, sstabellini, xen-devel, peter.maydell, Zhang Shengju
On Fri, Nov 23, 2018 at 11:30:39PM +0800, Mao Zhongyi wrote:
> The init function doesn't do anything at all, so we
> just omit it.
>
> Cc: sstabellini@kernel.org
> Cc: anthony.perard@citrix.com
> Cc: xen-devel@lists.xenproject.org
> Cc: peter.maydell@linaro.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Thanks,
--
Anthony PERARD
^ permalink raw reply [flat|nested] 40+ messages in thread
* Re: [PATCH v2 20/21] xen_backend: remove xen_sysdev_init() function
@ 2018-11-26 14:27 ` Anthony PERARD
0 siblings, 0 replies; 40+ messages in thread
From: Anthony PERARD @ 2018-11-26 14:27 UTC (permalink / raw)
To: Mao Zhongyi
Cc: Zhang Shengju, xen-devel, sstabellini, qemu-devel, peter.maydell
On Fri, Nov 23, 2018 at 11:30:39PM +0800, Mao Zhongyi wrote:
> The init function doesn't do anything at all, so we
> just omit it.
>
> Cc: sstabellini@kernel.org
> Cc: anthony.perard@citrix.com
> Cc: xen-devel@lists.xenproject.org
> Cc: peter.maydell@linaro.org
>
> Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
> Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Thanks,
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 40+ messages in thread
* [Qemu-devel] [PATCH v2 21/21] core/sysbus: remove the SysBusDeviceClass::init path
2018-11-23 15:30 ` Mao Zhongyi
` (20 preceding siblings ...)
(?)
@ 2018-11-23 15:30 ` Mao Zhongyi
-1 siblings, 0 replies; 40+ messages in thread
From: Mao Zhongyi @ 2018-11-23 15:30 UTC (permalink / raw)
To: qemu-devel
Cc: Mao Zhongyi, ehabkost, thuth, pbonzini, armbru, peter.maydell,
richard.henderson, alistair.francis, Zhang Shengju
Currently, all sysbus devices have been converted to realize(),
so remove this path.
Cc: ehabkost@redhat.com
Cc: thuth@redhat.com
Cc: pbonzini@redhat.com
Cc: armbru@redhat.com
Cc: peter.maydell@linaro.org
Cc: richard.henderson@linaro.org
Cc: alistair.francis@wdc.com
Signed-off-by: Mao Zhongyi <maozhongyi@cmss.chinamobile.com>
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
---
hw/core/sysbus.c | 15 +++++----------
include/hw/sysbus.h | 3 ---
2 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/hw/core/sysbus.c b/hw/core/sysbus.c
index 7ac36ad3e7..9f9edbcab9 100644
--- a/hw/core/sysbus.c
+++ b/hw/core/sysbus.c
@@ -201,18 +201,13 @@ void sysbus_init_ioports(SysBusDevice *dev, uint32_t ioport, uint32_t size)
}
}
-/* TODO remove once all sysbus devices have been converted to realize */
+/* The purpose of preserving this empty realize function
+ * is to prevent the parent_realize field of some subclasses
+ * from being set to NULL to break the normal init/realize
+ * of some devices.
+ */
static void sysbus_realize(DeviceState *dev, Error **errp)
{
- SysBusDevice *sd = SYS_BUS_DEVICE(dev);
- SysBusDeviceClass *sbc = SYS_BUS_DEVICE_GET_CLASS(sd);
-
- if (!sbc->init) {
- return;
- }
- if (sbc->init(sd) < 0) {
- error_setg(errp, "Device initialization failed");
- }
}
DeviceState *sysbus_create_varargs(const char *name,
diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h
index 0b59a3b8d6..1aedcf05c9 100644
--- a/include/hw/sysbus.h
+++ b/include/hw/sysbus.h
@@ -38,9 +38,6 @@ typedef struct SysBusDevice SysBusDevice;
typedef struct SysBusDeviceClass {
/*< private >*/
DeviceClass parent_class;
- /*< public >*/
-
- int (*init)(SysBusDevice *dev);
/*
* Let the sysbus device format its own non-PIO, non-MMIO unit address.
--
2.17.1
^ permalink raw reply related [flat|nested] 40+ messages in thread