* [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/*
@ 2016-01-27 2:54 xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer xiaoqiang zhao
` (10 more replies)
0 siblings, 11 replies; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
This patch series QOM'ify timer code under hw/timer directory.
Main idea is to split the initfn's work, some to TypeInfo.instance_init
and some is placed in DeviceClass::realize.
Drop the use of SysBusDeviceClass::init if possible.
changes since v1:
fix a stupid typo (timmer->timer)
xiaoqiang zhao (14):
hw/timer: QOM'ify arm_timer
hw/timer: QOM'ify etraxfs_timer
hw/timer: QOM'ify exynos4210_mct
hw/timer: QOM'ify exynos4210_pwm
hw/timer: QOM'ify exynos4210_rtc
hw/timer: QOM'ify grlib_gptimer
hw/timer: QOM'ify lm32_timer
hw/timer: QOM'ify m48txx_sysbus
hw/timer: QOM'ify milkymist_sysctl
hw/timer: QOM'ify pl031
hw/timer: QOM'ify puv3_ost
hw/timer: QOM'ify pxa2xx_timer
hw/timer: QOM'ify slavio_timer
hw/timer: QOM'ify tusb6010 and remove all tabs
hw/timer/arm_timer.c | 38 +++---
hw/timer/etraxfs_timer.c | 11 +-
hw/timer/exynos4210_mct.c | 10 +-
hw/timer/exynos4210_pwm.c | 10 +-
hw/timer/exynos4210_rtc.c | 10 +-
hw/timer/grlib_gptimer.c | 30 ++--
hw/timer/lm32_timer.c | 17 ++-
hw/timer/m48t59.c | 35 ++---
hw/timer/milkymist-sysctl.c | 19 ++-
hw/timer/pl031.c | 9 +-
hw/timer/puv3_ost.c | 12 +-
hw/timer/pxa2xx_timer.c | 36 +++--
hw/timer/slavio_timer.c | 10 +-
hw/timer/tusb6010.c | 323 ++++++++++++++++++++++----------------------
14 files changed, 292 insertions(+), 278 deletions(-)
--
2.1.4
^ permalink raw reply [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:06 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer xiaoqiang zhao
` (9 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
* assign icp_pit_init to icp_pit_info.instance_init
* split sp804_init into sp804_info.instance_init (sp804_init) and sp804_realize
* use DeviceClass::realize instead of SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/arm_timer.c | 38 +++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
index d53f39a..cce1abc 100644
--- a/hw/timer/arm_timer.c
+++ b/hw/timer/arm_timer.c
@@ -276,21 +276,26 @@ static const VMStateDescription vmstate_sp804 = {
}
};
-static int sp804_init(SysBusDevice *sbd)
+static void sp804_init(Object *obj)
{
- DeviceState *dev = DEVICE(sbd);
- SP804State *s = SP804(dev);
+ SP804State *s = SP804(obj);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
sysbus_init_irq(sbd, &s->irq);
+ memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s,
+ "sp804", 0x1000);
+ sysbus_init_mmio(sbd, &s->iomem);
+}
+
+static void sp804_realize(DeviceState *dev, Error **errp)
+{
+ SP804State *s = SP804(dev);
+
s->timer[0] = arm_timer_init(s->freq0);
s->timer[1] = arm_timer_init(s->freq1);
s->timer[0]->irq = qemu_allocate_irq(sp804_set_irq, s, 0);
s->timer[1]->irq = qemu_allocate_irq(sp804_set_irq, s, 1);
- memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s,
- "sp804", 0x1000);
- sysbus_init_mmio(sbd, &s->iomem);
vmstate_register(dev, -1, &vmstate_sp804, s);
- return 0;
}
/* Integrator/CP timer module. */
@@ -343,9 +348,10 @@ static const MemoryRegionOps icp_pit_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
-static int icp_pit_init(SysBusDevice *dev)
+static void icp_pit_init(Object *obj)
{
- icp_pit_state *s = INTEGRATOR_PIT(dev);
+ icp_pit_state *s = INTEGRATOR_PIT(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
/* Timer 0 runs at the system clock speed (40MHz). */
s->timer[0] = arm_timer_init(40000000);
@@ -362,20 +368,18 @@ static int icp_pit_init(SysBusDevice *dev)
sysbus_init_mmio(dev, &s->iomem);
/* This device has no state to save/restore. The component timers will
save themselves. */
- return 0;
}
static void icp_pit_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
-
- sdc->init = icp_pit_init;
+ /* do nothing */
}
static const TypeInfo icp_pit_info = {
.name = TYPE_INTEGRATOR_PIT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(icp_pit_state),
+ .instance_init = icp_pit_init,
.class_init = icp_pit_class_init,
};
@@ -387,17 +391,17 @@ static Property sp804_properties[] = {
static void sp804_class_init(ObjectClass *klass, void *data)
{
- SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
- DeviceClass *k = DEVICE_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
- sdc->init = sp804_init;
- k->props = sp804_properties;
+ dc->realize = sp804_realize;
+ dc->props = sp804_properties;
}
static const TypeInfo sp804_info = {
.name = TYPE_SP804,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(SP804State),
+ .instance_init = sp804_init,
.class_init = sp804_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:10 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct xiaoqiang zhao
` (8 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
assign etraxfs_timer_init to etraxfs_timer_info.instance_init
and drop the SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/etraxfs_timer.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
index aee4990..a3a6798 100644
--- a/hw/timer/etraxfs_timer.c
+++ b/hw/timer/etraxfs_timer.c
@@ -314,9 +314,10 @@ static void etraxfs_timer_reset(void *opaque)
qemu_irq_lower(t->irq);
}
-static int etraxfs_timer_init(SysBusDevice *dev)
+static void etraxfs_timer_init(Object *obj)
{
- ETRAXTimerState *t = ETRAX_TIMER(dev);
+ ETRAXTimerState *t = ETRAX_TIMER(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
t->bh_t0 = qemu_bh_new(timer0_hit, t);
t->bh_t1 = qemu_bh_new(timer1_hit, t);
@@ -332,20 +333,18 @@ static int etraxfs_timer_init(SysBusDevice *dev)
"etraxfs-timer", 0x5c);
sysbus_init_mmio(dev, &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);
-
- sdc->init = etraxfs_timer_init;
+ /* do nothing */
}
static const TypeInfo etraxfs_timer_info = {
.name = TYPE_ETRAX_FS_TIMER,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(ETRAXTimerState),
+ .instance_init = etraxfs_timer_init,
.class_init = etraxfs_timer_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:11 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm xiaoqiang zhao
` (7 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
assign exynos4210_mct_init to exynos4210_mct_info.instance_init
and drop the SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/exynos4210_mct.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
index 015bbaf..ed388ca 100644
--- a/hw/timer/exynos4210_mct.c
+++ b/hw/timer/exynos4210_mct.c
@@ -1421,10 +1421,11 @@ static const MemoryRegionOps exynos4210_mct_ops = {
};
/* MCT init */
-static int exynos4210_mct_init(SysBusDevice *dev)
+static void exynos4210_mct_init(Object *obj)
{
int i;
- Exynos4210MCTState *s = EXYNOS4210_MCT(dev);
+ Exynos4210MCTState *s = EXYNOS4210_MCT(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
QEMUBH *bh[2];
/* Global timer */
@@ -1452,16 +1453,12 @@ static int exynos4210_mct_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &exynos4210_mct_ops, s,
"exynos4210-mct", MCT_SFR_SIZE);
sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
}
static void exynos4210_mct_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = exynos4210_mct_init;
dc->reset = exynos4210_mct_reset;
dc->vmsd = &vmstate_exynos4210_mct_state;
}
@@ -1470,6 +1467,7 @@ static const TypeInfo exynos4210_mct_info = {
.name = TYPE_EXYNOS4210_MCT,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(Exynos4210MCTState),
+ .instance_init = exynos4210_mct_init,
.class_init = exynos4210_mct_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (2 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:12 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 05/14] hw/timer: QOM'ify exynos4210_rtc xiaoqiang zhao
` (6 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
assign exynos4210_pwm_init to exynos4210_pwm_info.instance_init
and drop the SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/exynos4210_pwm.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
index 1c1a2b8..3ac2bf5 100644
--- a/hw/timer/exynos4210_pwm.c
+++ b/hw/timer/exynos4210_pwm.c
@@ -379,9 +379,10 @@ static const MemoryRegionOps exynos4210_pwm_ops = {
/*
* PWM timer initialization
*/
-static int exynos4210_pwm_init(SysBusDevice *dev)
+static void exynos4210_pwm_init(Object *obj)
{
- Exynos4210PWMState *s = EXYNOS4210_PWM(dev);
+ Exynos4210PWMState *s = EXYNOS4210_PWM(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
int i;
QEMUBH *bh;
@@ -396,16 +397,12 @@ static int exynos4210_pwm_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &exynos4210_pwm_ops, s,
"exynos4210-pwm", EXYNOS4210_PWM_REG_MEM_SIZE);
sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
}
static void exynos4210_pwm_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = exynos4210_pwm_init;
dc->reset = exynos4210_pwm_reset;
dc->vmsd = &vmstate_exynos4210_pwm_state;
}
@@ -414,6 +411,7 @@ static const TypeInfo exynos4210_pwm_info = {
.name = TYPE_EXYNOS4210_PWM,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(Exynos4210PWMState),
+ .instance_init = exynos4210_pwm_init,
.class_init = exynos4210_pwm_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 05/14] hw/timer: QOM'ify exynos4210_rtc
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (3 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer xiaoqiang zhao
` (5 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
assign exynos4210_rtc_init to exynos4210_rtc_info.instance_init
and drop the SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/exynos4210_rtc.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/hw/timer/exynos4210_rtc.c b/hw/timer/exynos4210_rtc.c
index bf2ee9f..cfd6d9d 100644
--- a/hw/timer/exynos4210_rtc.c
+++ b/hw/timer/exynos4210_rtc.c
@@ -546,9 +546,10 @@ static const MemoryRegionOps exynos4210_rtc_ops = {
/*
* RTC timer initialization
*/
-static int exynos4210_rtc_init(SysBusDevice *dev)
+static void exynos4210_rtc_init(Object *obj)
{
- Exynos4210RTCState *s = EXYNOS4210_RTC(dev);
+ Exynos4210RTCState *s = EXYNOS4210_RTC(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
QEMUBH *bh;
bh = qemu_bh_new(exynos4210_rtc_tick, s);
@@ -566,16 +567,12 @@ static int exynos4210_rtc_init(SysBusDevice *dev)
memory_region_init_io(&s->iomem, OBJECT(s), &exynos4210_rtc_ops, s,
"exynos4210-rtc", EXYNOS4210_RTC_REG_MEM_SIZE);
sysbus_init_mmio(dev, &s->iomem);
-
- return 0;
}
static void exynos4210_rtc_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = exynos4210_rtc_init;
dc->reset = exynos4210_rtc_reset;
dc->vmsd = &vmstate_exynos4210_rtc_state;
}
@@ -584,6 +581,7 @@ static const TypeInfo exynos4210_rtc_info = {
.name = TYPE_EXYNOS4210_RTC,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(Exynos4210RTCState),
+ .instance_init = exynos4210_rtc_init,
.class_init = exynos4210_rtc_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (4 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 05/14] hw/timer: QOM'ify exynos4210_rtc xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:17 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer xiaoqiang zhao
` (4 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
* split grlib_gptimer_init into grlib_gptimer_info.instance_init and grlib_gptimer_realize
* use DeviceClass::realize instead of SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/grlib_gptimer.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/hw/timer/grlib_gptimer.c b/hw/timer/grlib_gptimer.c
index d655bb2..0fa63ae 100644
--- a/hw/timer/grlib_gptimer.c
+++ b/hw/timer/grlib_gptimer.c
@@ -347,16 +347,29 @@ static void grlib_gptimer_reset(DeviceState *d)
}
}
-static int grlib_gptimer_init(SysBusDevice *dev)
+static void grlib_gptimer_init(Object *obj)
{
- GPTimerUnit *unit = GRLIB_GPTIMER(dev);
- unsigned int i;
+ GPTimerUnit *unit = GRLIB_GPTIMER(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
assert(unit->nr_timers > 0);
assert(unit->nr_timers <= GPTIMER_MAX_TIMERS);
unit->timers = g_malloc0(sizeof unit->timers[0] * unit->nr_timers);
+ memory_region_init_io(&unit->iomem, OBJECT(unit), &grlib_gptimer_ops,
+ unit, "gptimer",
+ UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers);
+
+ sysbus_init_mmio(dev, &unit->iomem);
+}
+
+static void grlib_gptimer_realize(DeviceState *dev, Error *errp)
+{
+ GPTimerUnit *unit = GRLIB_GPTIMER(dev);
+ SysBusDevice *dev = SYS_BUS_DEVICE(dev);
+ unsigned int i;
+
for (i = 0; i < unit->nr_timers; i++) {
GPTimer *timer = &unit->timers[i];
@@ -370,13 +383,6 @@ static int grlib_gptimer_init(SysBusDevice *dev)
ptimer_set_freq(timer->ptimer, unit->freq_hz);
}
-
- memory_region_init_io(&unit->iomem, OBJECT(unit), &grlib_gptimer_ops,
- unit, "gptimer",
- UNIT_REG_SIZE + GPTIMER_REG_SIZE * unit->nr_timers);
-
- sysbus_init_mmio(dev, &unit->iomem);
- return 0;
}
static Property grlib_gptimer_properties[] = {
@@ -389,9 +395,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;
}
@@ -400,6 +405,7 @@ static const TypeInfo grlib_gptimer_info = {
.name = TYPE_GRLIB_GPTIMER,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(GPTimerUnit),
+ .instance_init = grlib_gptimer_init,
.class_init = grlib_gptimer_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (5 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:15 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 08/14] hw/timer: QOM'ify m48txx_sysbus xiaoqiang zhao
` (3 subsequent siblings)
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
* split lm32_timer_init into lm32_timer_info.instance_init and lm32_timer_realize
* use DeviceClass::realize instead of SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/lm32_timer.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c
index d2ab1e7..4ee080a 100644
--- a/hw/timer/lm32_timer.c
+++ b/hw/timer/lm32_timer.c
@@ -175,21 +175,26 @@ static void timer_reset(DeviceState *d)
ptimer_stop(s->ptimer);
}
-static int lm32_timer_init(SysBusDevice *dev)
+static void lm32_timer_init(Object *obj)
{
- LM32TimerState *s = LM32_TIMER(dev);
+ LM32TimerState *s = LM32_TIMER(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
sysbus_init_irq(dev, &s->irq);
s->bh = qemu_bh_new(timer_hit, s);
s->ptimer = ptimer_init(s->bh);
- ptimer_set_freq(s->ptimer, s->freq_hz);
memory_region_init_io(&s->iomem, OBJECT(s), &timer_ops, s,
"timer", R_MAX * 4);
sysbus_init_mmio(dev, &s->iomem);
+}
- return 0;
+static void lm32_timer_realize(DeviceState *dev, Error **errp)
+{
+ LM32TimerState *s = LM32_TIMER(dev);
+
+ ptimer_set_freq(s->ptimer, s->freq_hz);
}
static const VMStateDescription vmstate_lm32_timer = {
@@ -212,9 +217,8 @@ static Property lm32_timer_properties[] = {
static void lm32_timer_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = lm32_timer_init;
+ dc->realize = lm32_timer_realize;
dc->reset = timer_reset;
dc->vmsd = &vmstate_lm32_timer;
dc->props = lm32_timer_properties;
@@ -224,6 +228,7 @@ static const TypeInfo lm32_timer_info = {
.name = TYPE_LM32_TIMER,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(LM32TimerState),
+ .instance_init = lm32_timer_init,
.class_init = lm32_timer_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 08/14] hw/timer: QOM'ify m48txx_sysbus
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (6 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl xiaoqiang zhao
` (2 subsequent siblings)
10 siblings, 0 replies; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
* split m48t59_init1 into m48txx_sysbus_type_info.instance_init and m48t59_realize
* use DeviceClass::realize instead of SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/m48t59.c | 35 ++++++++++++++++++-----------------
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c
index b3df8f9..12768c0 100644
--- a/hw/timer/m48t59.c
+++ b/hw/timer/m48t59.c
@@ -762,30 +762,31 @@ static void m48t59_isa_realize(DeviceState *dev, Error **errp)
}
}
-static int m48t59_init1(SysBusDevice *dev)
+static void m48t59_init1(Object *obj)
{
- M48txxSysBusDeviceClass *u = M48TXX_SYS_BUS_GET_CLASS(dev);
- M48txxSysBusState *d = M48TXX_SYS_BUS(dev);
- Object *o = OBJECT(dev);
+ M48txxSysBusDeviceClass *u = M48TXX_SYS_BUS_GET_CLASS(obj);
+ M48txxSysBusState *d = M48TXX_SYS_BUS(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
M48t59State *s = &d->state;
- Error *err = NULL;
s->model = u->info.model;
s->size = u->info.size;
sysbus_init_irq(dev, &s->IRQ);
- memory_region_init_io(&s->iomem, o, &nvram_ops, s, "m48t59.nvram",
+ memory_region_init_io(&s->iomem, obj, &nvram_ops, s, "m48t59.nvram",
s->size);
- memory_region_init_io(&d->io, o, &m48t59_io_ops, s, "m48t59", 4);
- sysbus_init_mmio(dev, &s->iomem);
- sysbus_init_mmio(dev, &d->io);
- m48t59_realize_common(s, &err);
- if (err != NULL) {
- error_free(err);
- return -1;
- }
+ memory_region_init_io(&d->io, obj, &m48t59_io_ops, s, "m48t59", 4);
+}
- return 0;
+static void m48t59_realize(DeviceState *dev, Error **errp)
+{
+ M48txxSysBusState *d = M48TXX_SYS_BUS(dev);
+ M48t59State *s = &d->state;
+ SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+
+ sysbus_init_mmio(sbd, &s->iomem);
+ sysbus_init_mmio(sbd, &d->io);
+ m48t59_realize_common(s, errp);
}
static uint32_t m48txx_isa_read(Nvram *obj, uint32_t addr)
@@ -859,10 +860,9 @@ static Property m48t59_sysbus_properties[] = {
static void m48txx_sysbus_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
NvramClass *nc = NVRAM_CLASS(klass);
- k->init = m48t59_init1;
+ dc->realize = m48t59_realize;
dc->reset = m48t59_reset_sysbus;
dc->props = m48t59_sysbus_properties;
nc->read = m48txx_sysbus_read;
@@ -888,6 +888,7 @@ static const TypeInfo m48txx_sysbus_type_info = {
.name = TYPE_M48TXX_SYS_BUS,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(M48txxSysBusState),
+ .instance_init = m48t59_init1,
.abstract = true,
.class_init = m48txx_sysbus_class_init,
.interfaces = (InterfaceInfo[]) {
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (7 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 08/14] hw/timer: QOM'ify m48txx_sysbus xiaoqiang zhao
@ 2016-01-27 2:54 ` xiaoqiang zhao
2016-02-15 18:14 ` Peter Maydell
2016-02-03 3:13 ` [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* <zxq_yx_007@163.com>
2016-02-15 18:22 ` Peter Maydell
10 siblings, 1 reply; 24+ messages in thread
From: xiaoqiang zhao @ 2016-01-27 2:54 UTC (permalink / raw)
To: qemu-devel; +Cc: xiaoqiang zhao, peter.maydell, afaerber
* split milkymist_sysctl_init into milkymist_sysctl_info.instance_init and milkymist_sysctl_realize
* use DeviceClass::realize instead of SysBusDeviceClass::init
Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
---
hw/timer/milkymist-sysctl.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/timer/milkymist-sysctl.c b/hw/timer/milkymist-sysctl.c
index 30535a4..e29c823 100644
--- a/hw/timer/milkymist-sysctl.c
+++ b/hw/timer/milkymist-sysctl.c
@@ -269,9 +269,10 @@ static void milkymist_sysctl_reset(DeviceState *d)
s->regs[R_GPIO_IN] = s->strappings;
}
-static int milkymist_sysctl_init(SysBusDevice *dev)
+static void milkymist_sysctl_init(Object *obj)
{
- MilkymistSysctlState *s = MILKYMIST_SYSCTL(dev);
+ MilkymistSysctlState *s = MILKYMIST_SYSCTL(obj);
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
sysbus_init_irq(dev, &s->gpio_irq);
sysbus_init_irq(dev, &s->timer0_irq);
@@ -281,14 +282,18 @@ static int milkymist_sysctl_init(SysBusDevice *dev)
s->bh1 = qemu_bh_new(timer1_hit, s);
s->ptimer0 = ptimer_init(s->bh0);
s->ptimer1 = ptimer_init(s->bh1);
- ptimer_set_freq(s->ptimer0, s->freq_hz);
- ptimer_set_freq(s->ptimer1, s->freq_hz);
memory_region_init_io(&s->regs_region, OBJECT(s), &sysctl_mmio_ops, s,
"milkymist-sysctl", R_MAX * 4);
sysbus_init_mmio(dev, &s->regs_region);
+}
- return 0;
+static void milkymist_sysctl_realize(DeviceState *dev, Error **errp)
+{
+ MilkymistSysctlState *s = MILKYMIST_SYSCTL(dev);
+
+ ptimer_set_freq(s->ptimer0, s->freq_hz);
+ ptimer_set_freq(s->ptimer1, s->freq_hz);
}
static const VMStateDescription vmstate_milkymist_sysctl = {
@@ -318,9 +323,8 @@ static Property milkymist_sysctl_properties[] = {
static void milkymist_sysctl_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = milkymist_sysctl_init;
+ dc->realize = milkymist_sysctl_realize;
dc->reset = milkymist_sysctl_reset;
dc->vmsd = &vmstate_milkymist_sysctl;
dc->props = milkymist_sysctl_properties;
@@ -330,6 +334,7 @@ static const TypeInfo milkymist_sysctl_info = {
.name = TYPE_MILKYMIST_SYSCTL,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(MilkymistSysctlState),
+ .instance_init = milkymist_sysctl_init,
.class_init = milkymist_sysctl_class_init,
};
--
2.1.4
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/*
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (8 preceding siblings ...)
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl xiaoqiang zhao
@ 2016-02-03 3:13 ` <zxq_yx_007@163.com>
2016-02-15 18:22 ` Peter Maydell
10 siblings, 0 replies; 24+ messages in thread
From: <zxq_yx_007@163.com> @ 2016-02-03 3:13 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: peter.maydell, qemu-devel, afaerber
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
ping ...
At 2016-01-27 10:54:34, "xiaoqiang zhao" <zxq_yx_007@163.com> wrote:
>This patch series QOM'ify timer code under hw/timer directory.
>Main idea is to split the initfn's work, some to TypeInfo.instance_init
>and some is placed in DeviceClass::realize.
>Drop the use of SysBusDeviceClass::init if possible.
>
>changes since v1:
>fix a stupid typo (timmer->timer)
>
>xiaoqiang zhao (14):
> hw/timer: QOM'ify arm_timer
> hw/timer: QOM'ify etraxfs_timer
> hw/timer: QOM'ify exynos4210_mct
> hw/timer: QOM'ify exynos4210_pwm
> hw/timer: QOM'ify exynos4210_rtc
> hw/timer: QOM'ify grlib_gptimer
> hw/timer: QOM'ify lm32_timer
> hw/timer: QOM'ify m48txx_sysbus
> hw/timer: QOM'ify milkymist_sysctl
> hw/timer: QOM'ify pl031
> hw/timer: QOM'ify puv3_ost
> hw/timer: QOM'ify pxa2xx_timer
> hw/timer: QOM'ify slavio_timer
> hw/timer: QOM'ify tusb6010 and remove all tabs
>
> hw/timer/arm_timer.c | 38 +++---
> hw/timer/etraxfs_timer.c | 11 +-
> hw/timer/exynos4210_mct.c | 10 +-
> hw/timer/exynos4210_pwm.c | 10 +-
> hw/timer/exynos4210_rtc.c | 10 +-
> hw/timer/grlib_gptimer.c | 30 ++--
> hw/timer/lm32_timer.c | 17 ++-
> hw/timer/m48t59.c | 35 ++---
> hw/timer/milkymist-sysctl.c | 19 ++-
> hw/timer/pl031.c | 9 +-
> hw/timer/puv3_ost.c | 12 +-
> hw/timer/pxa2xx_timer.c | 36 +++--
> hw/timer/slavio_timer.c | 10 +-
> hw/timer/tusb6010.c | 323 ++++++++++++++++++++++----------------------
> 14 files changed, 292 insertions(+), 278 deletions(-)
>
>--
>2.1.4
>
[-- Attachment #2: Type: text/html, Size: 1952 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer xiaoqiang zhao
@ 2016-02-15 18:06 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:06 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> * assign icp_pit_init to icp_pit_info.instance_init
> * split sp804_init into sp804_info.instance_init (sp804_init) and sp804_realize
> * use DeviceClass::realize instead of SysBusDeviceClass::init
>
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
> ---
> hw/timer/arm_timer.c | 38 +++++++++++++++++++++-----------------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/hw/timer/arm_timer.c b/hw/timer/arm_timer.c
> index d53f39a..cce1abc 100644
> --- a/hw/timer/arm_timer.c
> +++ b/hw/timer/arm_timer.c
> @@ -276,21 +276,26 @@ static const VMStateDescription vmstate_sp804 = {
> }
> };
>
> -static int sp804_init(SysBusDevice *sbd)
> +static void sp804_init(Object *obj)
> {
> - DeviceState *dev = DEVICE(sbd);
> - SP804State *s = SP804(dev);
> + SP804State *s = SP804(obj);
> + SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
>
> sysbus_init_irq(sbd, &s->irq);
> + memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s,
> + "sp804", 0x1000);
You already have an Object* here, 'obj'; you don't
need to cast s back via OBJECT() again.
> + sysbus_init_mmio(sbd, &s->iomem);
> +}
> +
> +static void sp804_realize(DeviceState *dev, Error **errp)
> +{
> + SP804State *s = SP804(dev);
> +
> s->timer[0] = arm_timer_init(s->freq0);
> s->timer[1] = arm_timer_init(s->freq1);
> s->timer[0]->irq = qemu_allocate_irq(sp804_set_irq, s, 0);
> s->timer[1]->irq = qemu_allocate_irq(sp804_set_irq, s, 1);
> - memory_region_init_io(&s->iomem, OBJECT(s), &sp804_ops, s,
> - "sp804", 0x1000);
> - sysbus_init_mmio(sbd, &s->iomem);
> vmstate_register(dev, -1, &vmstate_sp804, s);
It would be nice to register the VMState by setting the
DeviceClass vmsd member in the class init, rather than
vmstate_register(). (You can do that in a separate patch
if you prefer.)
> - return 0;
> }
>
> /* Integrator/CP timer module. */
> @@ -343,9 +348,10 @@ static const MemoryRegionOps icp_pit_ops = {
> .endianness = DEVICE_NATIVE_ENDIAN,
> };
>
> -static int icp_pit_init(SysBusDevice *dev)
> +static void icp_pit_init(Object *obj)
> {
> - icp_pit_state *s = INTEGRATOR_PIT(dev);
> + icp_pit_state *s = INTEGRATOR_PIT(obj);
> + SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>
> /* Timer 0 runs at the system clock speed (40MHz). */
> s->timer[0] = arm_timer_init(40000000);
> @@ -362,20 +368,18 @@ static int icp_pit_init(SysBusDevice *dev)
> sysbus_init_mmio(dev, &s->iomem);
> /* This device has no state to save/restore. The component timers will
> save themselves. */
> - return 0;
> }
>
> static void icp_pit_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> -
> - sdc->init = icp_pit_init;
> + /* do nothing */
If there's no need for the class init function to do anything,
just delete it from the TypeInfo rather than leaving it but
with an empty function.
> }
>
> static const TypeInfo icp_pit_info = {
> .name = TYPE_INTEGRATOR_PIT,
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(icp_pit_state),
> + .instance_init = icp_pit_init,
> .class_init = icp_pit_class_init,
> };
>
> @@ -387,17 +391,17 @@ static Property sp804_properties[] = {
>
> static void sp804_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> - DeviceClass *k = DEVICE_CLASS(klass);
> + DeviceClass *dc = DEVICE_CLASS(klass);
Doesn't seem necessary to change the name of the DeviceClass* variable here.
>
> - sdc->init = sp804_init;
> - k->props = sp804_properties;
> + dc->realize = sp804_realize;
> + dc->props = sp804_properties;
> }
>
> static const TypeInfo sp804_info = {
> .name = TYPE_SP804,
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(SP804State),
> + .instance_init = sp804_init,
> .class_init = sp804_class_init,
> };
>
> --
> 2.1.4
These devices are also missing reset handling, though that should
be added in a different patch.
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer xiaoqiang zhao
@ 2016-02-15 18:10 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:10 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> assign etraxfs_timer_init to etraxfs_timer_info.instance_init
> and drop the SysBusDeviceClass::init
>
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
You should probably cc Edgar as the CRIS/etraxfs maintainer.
> ---
> hw/timer/etraxfs_timer.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
> index aee4990..a3a6798 100644
> --- a/hw/timer/etraxfs_timer.c
> +++ b/hw/timer/etraxfs_timer.c
> @@ -314,9 +314,10 @@ static void etraxfs_timer_reset(void *opaque)
> qemu_irq_lower(t->irq);
> }
>
> -static int etraxfs_timer_init(SysBusDevice *dev)
> +static void etraxfs_timer_init(Object *obj)
> {
> - ETRAXTimerState *t = ETRAX_TIMER(dev);
> + ETRAXTimerState *t = ETRAX_TIMER(obj);
> + SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>
> t->bh_t0 = qemu_bh_new(timer0_hit, t);
> t->bh_t1 = qemu_bh_new(timer1_hit, t);
> @@ -332,20 +333,18 @@ static int etraxfs_timer_init(SysBusDevice *dev)
> "etraxfs-timer", 0x5c);
> sysbus_init_mmio(dev, &t->mmio);
> qemu_register_reset(etraxfs_timer_reset, t);
QOMification of this device should also include making
the reset function be set up in the class init rather
than with a manual call to qemu_register_reset().
> - return 0;
> }
>
> static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
> {
> - SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
> -
> - sdc->init = etraxfs_timer_init;
> + /* do nothing */
> }
Again, please don't leave empty class init functions.
> static const TypeInfo etraxfs_timer_info = {
> .name = TYPE_ETRAX_FS_TIMER,
> .parent = TYPE_SYS_BUS_DEVICE,
> .instance_size = sizeof(ETRAXTimerState),
> + .instance_init = etraxfs_timer_init,
> .class_init = etraxfs_timer_class_init,
> };
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct xiaoqiang zhao
@ 2016-02-15 18:11 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:11 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> assign exynos4210_mct_init to exynos4210_mct_info.instance_init
> and drop the SysBusDeviceClass::init
>
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm xiaoqiang zhao
@ 2016-02-15 18:12 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:12 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> assign exynos4210_pwm_init to exynos4210_pwm_info.instance_init
> and drop the SysBusDeviceClass::init
>
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
> ---
> hw/timer/exynos4210_pwm.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl xiaoqiang zhao
@ 2016-02-15 18:14 ` Peter Maydell
2016-02-16 9:34 ` hitmoon
2016-02-17 23:56 ` xiaoqiang zhao
0 siblings, 2 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:14 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> * split milkymist_sysctl_init into milkymist_sysctl_info.instance_init and milkymist_sysctl_realize
I think the "info" in this function name is wrong ?
> * use DeviceClass::realize instead of SysBusDeviceClass::init
Please make sure you line wrap your commit messages (at somewhere
around 70-72 columns is usual).
Otherwise:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Again, you should cc the maintainer for this device.
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer xiaoqiang zhao
@ 2016-02-15 18:15 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:15 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> * split lm32_timer_init into lm32_timer_info.instance_init and lm32_timer_realize
> * use DeviceClass::realize instead of SysBusDeviceClass::init
Long lines again.
> Signed-off-by: xiaoqiang zhao <zxq_yx_007@163.com>
> ---
> hw/timer/lm32_timer.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/hw/timer/lm32_timer.c b/hw/timer/lm32_timer.c
> index d2ab1e7..4ee080a 100644
> --- a/hw/timer/lm32_timer.c
> +++ b/hw/timer/lm32_timer.c
> @@ -175,21 +175,26 @@ static void timer_reset(DeviceState *d)
> ptimer_stop(s->ptimer);
> }
>
> -static int lm32_timer_init(SysBusDevice *dev)
> +static void lm32_timer_init(Object *obj)
> {
> - LM32TimerState *s = LM32_TIMER(dev);
> + LM32TimerState *s = LM32_TIMER(obj);
> + SysBusDevice *dev = SYS_BUS_DEVICE(obj);
>
> sysbus_init_irq(dev, &s->irq);
>
> s->bh = qemu_bh_new(timer_hit, s);
> s->ptimer = ptimer_init(s->bh);
> - ptimer_set_freq(s->ptimer, s->freq_hz);
>
> memory_region_init_io(&s->iomem, OBJECT(s), &timer_ops, s,
> "timer", R_MAX * 4);
> sysbus_init_mmio(dev, &s->iomem);
> +}
You could avoid the OBJECT() cast here now.
Otherwise:
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer xiaoqiang zhao
@ 2016-02-15 18:17 ` Peter Maydell
0 siblings, 0 replies; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:17 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> * split grlib_gptimer_init into grlib_gptimer_info.instance_init and grlib_gptimer_realize
> * use DeviceClass::realize instead of SysBusDeviceClass::init
Same comments as for other patches:
* line wrapping
* OBJECT casts now unnecessary
* please cc the maintainer
(in this case also adding Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
as overall sparc maintainer would be a good idea).
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/*
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
` (9 preceding siblings ...)
2016-02-03 3:13 ` [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* <zxq_yx_007@163.com>
@ 2016-02-15 18:22 ` Peter Maydell
2016-02-16 6:43 ` <zxq_yx_007@163.com>
10 siblings, 1 reply; 24+ messages in thread
From: Peter Maydell @ 2016-02-15 18:22 UTC (permalink / raw)
To: xiaoqiang zhao; +Cc: QEMU Developers, Andreas Färber
On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
> This patch series QOM'ify timer code under hw/timer directory.
> Main idea is to split the initfn's work, some to TypeInfo.instance_init
> and some is placed in DeviceClass::realize.
> Drop the use of SysBusDeviceClass::init if possible.
>
> changes since v1:
> fix a stupid typo (timmer->timer)
Hi; thanks for this patchset. I've reviewed most of these
and I think my comments on the remaining few patches would
basically be the same as the ones I have reviewed.
I would recommend that you cc the maintainers for the relevant
devices on this patchset when you send out your next version.
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/*
2016-02-15 18:22 ` Peter Maydell
@ 2016-02-16 6:43 ` <zxq_yx_007@163.com>
0 siblings, 0 replies; 24+ messages in thread
From: <zxq_yx_007@163.com> @ 2016-02-16 6:43 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Andreas Färber
Thanks Peter!
At 2016-02-16 02:22:09, "Peter Maydell" <peter.maydell@linaro.org> wrote:
>On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
>> This patch series QOM'ify timer code under hw/timer directory.
>> Main idea is to split the initfn's work, some to TypeInfo.instance_init
>> and some is placed in DeviceClass::realize.
>> Drop the use of SysBusDeviceClass::init if possible.
>>
>> changes since v1:
>> fix a stupid typo (timmer->timer)
>
>Hi; thanks for this patchset. I've reviewed most of these
>and I think my comments on the remaining few patches would
>basically be the same as the ones I have reviewed.
>I would recommend that you cc the maintainers for the relevant
>devices on this patchset when you send out your next version.
>
>thanks
>-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-02-15 18:14 ` Peter Maydell
@ 2016-02-16 9:34 ` hitmoon
2016-02-16 9:41 ` Peter Maydell
2016-02-17 23:56 ` xiaoqiang zhao
1 sibling, 1 reply; 24+ messages in thread
From: hitmoon @ 2016-02-16 9:34 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Andreas Färber
在 2016年02月16日 02:14, Peter Maydell 写道:
> On 27 January 2016 at 02:54, xiaoqiang zhao<zxq_yx_007@163.com> wrote:
>> >* split milkymist_sysctl_init into milkymist_sysctl_info.instance_init and milkymist_sysctl_realize
> I think the "info" in this function name is wrong ?
>
I can not understand , can you give me more details?
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-02-16 9:34 ` hitmoon
@ 2016-02-16 9:41 ` Peter Maydell
2016-02-16 9:51 ` hitmoon
0 siblings, 1 reply; 24+ messages in thread
From: Peter Maydell @ 2016-02-16 9:41 UTC (permalink / raw)
To: hitmoon; +Cc: QEMU Developers, Andreas Färber
On 16 February 2016 at 09:34, hitmoon <zxq_yx_007@163.com> wrote:
>
>
> 在 2016年02月16日 02:14, Peter Maydell 写道:
>>
>> On 27 January 2016 at 02:54, xiaoqiang zhao<zxq_yx_007@163.com> wrote:
>>>
>>> >* split milkymist_sysctl_init into milkymist_sysctl_info.instance_init
>>> > and milkymist_sysctl_realize
>>
>> I think the "info" in this function name is wrong ?
>>
> I can not understand , can you give me more details?
The two functions which you have split the old
milkymist_sysctl_init() into are named "milkymist_sysctl_init()"
and "milkymist_sysctl_realize()". It confused me that you
said "split FUNCTION into STRUCT.FIELDNAME and FUNCTION";
I expected to read "split FUNCTION into FUNCTION and FUNCTION".
If you want you could just say
"Split the old SysBus init function into an instance_init
and a Device realize function."
(at the moment your two bullet points in the commit message
are actually both describing the same thing.)
thanks
-- PMM
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-02-16 9:41 ` Peter Maydell
@ 2016-02-16 9:51 ` hitmoon
0 siblings, 0 replies; 24+ messages in thread
From: hitmoon @ 2016-02-16 9:51 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Andreas Färber
在 2016年02月16日 17:41, Peter Maydell 写道:
> On 16 February 2016 at 09:34, hitmoon <zxq_yx_007@163.com> wrote:
>>
>> 在 2016年02月16日 02:14, Peter Maydell 写道:
>>> On 27 January 2016 at 02:54, xiaoqiang zhao<zxq_yx_007@163.com> wrote:
>>>>> * split milkymist_sysctl_init into milkymist_sysctl_info.instance_init
>>>>> and milkymist_sysctl_realize
>>> I think the "info" in this function name is wrong ?
>>>
>> I can not understand , can you give me more details?
> The two functions which you have split the old
> milkymist_sysctl_init() into are named "milkymist_sysctl_init()"
> and "milkymist_sysctl_realize()". It confused me that you
> said "split FUNCTION into STRUCT.FIELDNAME and FUNCTION";
> I expected to read "split FUNCTION into FUNCTION and FUNCTION".
>
> If you want you could just say
> "Split the old SysBus init function into an instance_init
> and a Device realize function."
> (at the moment your two bullet points in the commit message
> are actually both describing the same thing.)
>
> thanks
> -- PMM
I see ;-)
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl
2016-02-15 18:14 ` Peter Maydell
2016-02-16 9:34 ` hitmoon
@ 2016-02-17 23:56 ` xiaoqiang zhao
1 sibling, 0 replies; 24+ messages in thread
From: xiaoqiang zhao @ 2016-02-17 23:56 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Developers, Andreas Färber
I have sent the v3, which fix this problem.
> 在 2016年2月16日,02:14,Peter Maydell <peter.maydell@linaro.org> 写道:
>
>> On 27 January 2016 at 02:54, xiaoqiang zhao <zxq_yx_007@163.com> wrote:
>> * split milkymist_sysctl_init into milkymist_sysctl_info.instance_init and milkymist_sysctl_realize
>
> I think the "info" in this function name is wrong ?
>
>> * use DeviceClass::realize instead of SysBusDeviceClass::init
>
> Please make sure you line wrap your commit messages (at somewhere
> around 70-72 columns is usual).
>
> Otherwise:
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
> Again, you should cc the maintainer for this device.
>
> thanks
> -- PMM
>
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2016-02-17 23:57 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 2:54 [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 01/14] hw/timer: QOM'ify arm_timer xiaoqiang zhao
2016-02-15 18:06 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 02/14] hw/timer: QOM'ify etraxfs_timer xiaoqiang zhao
2016-02-15 18:10 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 03/14] hw/timer: QOM'ify exynos4210_mct xiaoqiang zhao
2016-02-15 18:11 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 04/14] hw/timer: QOM'ify exynos4210_pwm xiaoqiang zhao
2016-02-15 18:12 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 05/14] hw/timer: QOM'ify exynos4210_rtc xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 06/14] hw/timer: QOM'ify grlib_gptimer xiaoqiang zhao
2016-02-15 18:17 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 07/14] hw/timer: QOM'ify lm32_timer xiaoqiang zhao
2016-02-15 18:15 ` Peter Maydell
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 08/14] hw/timer: QOM'ify m48txx_sysbus xiaoqiang zhao
2016-01-27 2:54 ` [Qemu-devel] [PATCH v2 09/14] hw/timer: QOM'ify milkymist_sysctl xiaoqiang zhao
2016-02-15 18:14 ` Peter Maydell
2016-02-16 9:34 ` hitmoon
2016-02-16 9:41 ` Peter Maydell
2016-02-16 9:51 ` hitmoon
2016-02-17 23:56 ` xiaoqiang zhao
2016-02-03 3:13 ` [Qemu-devel] [PATCH v2 00/14] QOM'ify hw/timer/* <zxq_yx_007@163.com>
2016-02-15 18:22 ` Peter Maydell
2016-02-16 6:43 ` <zxq_yx_007@163.com>
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).