On 09/01/2015 03:10, Fam Zheng wrote: > On Thu, 01/08 11:03, Paolo Bonzini wrote: >> The current pointer free API for timers is very low level. Introduce >> a new API that matches timer_new_ns/us/ms and also a new API timer_deinit >> that can be used instead of timer_free. >> >> Finally, mechanically change timer macro names in vmstate, to make it >> clear that they accept a pointer. >> >> This prepares for conversion of timers from QEMUTimer * to QEMUTimer. > > Novice question: what's the advantage, please?
No need to free them, so no memory leaks. From a quick look I found two (hw/net/pcnet.c and hw/char/serial.c). Also it matches more recent device model APIs like memory regions or throttling. Paolo > Fam > >> >> Paolo >> >> Paolo Bonzini (4): >> qemu-timer: rename timer_init to timer_init_tl >> qemu-timer: add timer_init and timer_init_ns/us/ms >> qemu-timer: introduce timer_deinit >> vmstate: accept QEMUTimer in VMSTATE_TIMER*, add VMSTATE_TIMER_PTR* >> >> hw/acpi/ich9.c | 2 +- >> hw/acpi/piix4.c | 2 +- >> hw/arm/stellaris.c | 2 +- >> hw/block/fdc.c | 2 +- >> hw/char/cadence_uart.c | 2 +- >> hw/char/serial.c | 4 +- >> hw/core/ptimer.c | 2 +- >> hw/dma/pl330.c | 2 +- >> hw/input/lm832x.c | 2 +- >> hw/intc/armv7m_nvic.c | 2 +- >> hw/isa/vt82c686.c | 2 +- >> hw/misc/macio/cuda.c | 2 +- >> hw/net/pcnet.c | 2 +- >> hw/sd/sdhci.c | 4 +- >> hw/timer/a9gtimer.c | 2 +- >> hw/timer/arm_mptimer.c | 2 +- >> hw/timer/hpet.c | 2 +- >> hw/timer/mc146818rtc.c | 4 +- >> hw/usb/hcd-ehci.c | 2 +- >> hw/usb/hcd-ohci.c | 2 +- >> hw/usb/hcd-uhci.c | 2 +- >> hw/usb/hcd-xhci.c | 2 +- >> hw/usb/redirect.c | 2 +- >> hw/watchdog/wdt_i6300esb.c | 2 +- >> hw/watchdog/wdt_ib700.c | 2 +- >> include/block/aio.h | 2 +- >> include/migration/vmstate.h | 18 +++++++-- >> include/qemu/timer.h | 94 >> ++++++++++++++++++++++++++++++++++++++++++--- >> qemu-timer.c | 20 +++++++--- >> target-arm/machine.c | 4 +- >> 30 files changed, 149 insertions(+), 45 deletions(-) >> >> -- >> 2.1.0 >> >> > >