Hi, >> -static int usb_ehci_initfn(PCIDevice *dev) >> +static void usb_ehci_initfn(EHCIState *s, DeviceState *dev) >> { >> - EHCIState *s = DO_UPCAST(EHCIState, dev, dev);
>> +static int usb_ehci_pci_initfn(PCIDevice *dev) >> +{ >> + EHCIPCIState *i = DO_UPCAST(EHCIPCIState, pcidev, dev); > > Same as discussed for Peter's patchset, this should be using a QOM cast > macro and may need an abstract base type if there is no unique type > matching EHCIPCIState struct. --verbose please. This is exactly like it used to be. PCIDeviceClass->init() gets passed in a PCIDevice pointer and uses DO_UPCAST to get the container struct carrying the ehci state (EHCIState before the patch, EHCIPCIState now). This is common practice all over the tree. > Should I send you a follow-up to squash if this is the approach we are > going to take? If there is a new, more QOM-ish way to do the same feel free to send patches. I see that as independent cleanup though, not as something which should be squashed into this patch. cheers, Gerd