On 2 March 2017 at 20:18, BALATON Zoltan <bala...@eik.bme.hu> wrote: > On Thu, 2 Mar 2017, Peter Maydell wrote: >> >> Don't use qemu_register_reset(). Set the appropriate dc->reset >> function pointers instead. > > > Any reason for that? This way I could save two more boilerplate functions > because I could define reset function once, otherwise I'd need two versions > taking sysbus and pci states just to extract the SM501State function and > call this function. Do you still think I should do that instead?
qemu_register_reset is a pre-QOM method for doing reset; the standard QOM way of saying "my device has some reset behaviour" is to set its reset method pointer. Code calling qemu_register_reset() is generally either (a) doing something kind of weird or (b) old device code that hasn't yet been converted to QOM. > So should it be 4 patches: reset for pci, reset for sysbus, vmstate for pci, > vmstate for sysbus or 2 patches: reset for both, vmstate for both? I think I'd go with 2 patches, since the two are going to share the bulk of the implementation in each case. thanks -- PMM