On Wed, Jan 30, 2019 at 04:07:06PM +0100, David Hildenbrand wrote: > On 30.01.19 14:09, Paolo Bonzini wrote: > > On 30/01/19 13:35, David Hildenbrand wrote: > >> On 14.12.18 10:58, Paolo Bonzini wrote: > >>> On 12/12/18 10:57, David Hildenbrand wrote: > >>>> Let's avoid manually looking up the hotplug handler class. Use the > >>>> existing wrappers instead. > >>>> > >>>> Signed-off-by: David Hildenbrand <da...@redhat.com> > >>>> --- > >>>> hw/i386/pc.c | 30 ++++++++---------------------- > >>>> 1 file changed, 8 insertions(+), 22 deletions(-) > >>>> > >>>> diff --git a/hw/i386/pc.c b/hw/i386/pc.c > >>>> index 4cd2fbca4d..c8857138f9 100644 > >>>> --- a/hw/i386/pc.c > >>>> +++ b/hw/i386/pc.c > >>>> @@ -1711,7 +1711,6 @@ static void pc_memory_pre_plug(HotplugHandler > >>>> *hotplug_dev, DeviceState *dev, > >>>> static void pc_memory_plug(HotplugHandler *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); > >>>> @@ -1725,8 +1724,7 @@ static void pc_memory_plug(HotplugHandler > >>>> *hotplug_dev, > >>>> nvdimm_plug(&pcms->acpi_nvdimm_state); > >>>> } > >>>> > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort); > >>>> + hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &error_abort); > >>>> out: > >>>> error_propagate(errp, local_err); > >>>> } > >>>> @@ -1734,7 +1732,6 @@ out: > >>>> static void pc_memory_unplug_request(HotplugHandler *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> > >>>> @@ -1755,9 +1752,8 @@ static void > >>>> pc_memory_unplug_request(HotplugHandler *hotplug_dev, > >>>> goto out; > >>>> } > >>>> > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &local_err); > >>>> - > >>>> + hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> + &local_err); > >>>> out: > >>>> error_propagate(errp, local_err); > >>>> } > >>>> @@ -1766,12 +1762,9 @@ static void pc_memory_unplug(HotplugHandler > >>>> *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); > >>>> - > >>>> + hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &local_err); > >>>> if (local_err) { > >>>> goto out; > >>>> } > >>>> @@ -1813,14 +1806,12 @@ static void pc_cpu_plug(HotplugHandler > >>>> *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> CPUArchId *found_cpu; > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> X86CPU *cpu = X86_CPU(dev); > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> > >>>> if (pcms->acpi_dev) { > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); > >>>> + hotplug_handler_plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &local_err); > >>>> if (local_err) { > >>>> goto out; > >>>> } > >>>> @@ -1844,7 +1835,6 @@ static void > >>>> pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> int idx = -1; > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> X86CPU *cpu = X86_CPU(dev); > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> @@ -1861,9 +1851,8 @@ static void > >>>> pc_cpu_unplug_request_cb(HotplugHandler *hotplug_dev, > >>>> goto out; > >>>> } > >>>> > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &local_err); > >>>> - > >>>> + hotplug_handler_unplug_request(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> + &local_err); > >>>> if (local_err) { > >>>> goto out; > >>>> } > >>>> @@ -1877,14 +1866,11 @@ static void pc_cpu_unplug_cb(HotplugHandler > >>>> *hotplug_dev, > >>>> DeviceState *dev, Error **errp) > >>>> { > >>>> CPUArchId *found_cpu; > >>>> - HotplugHandlerClass *hhc; > >>>> Error *local_err = NULL; > >>>> X86CPU *cpu = X86_CPU(dev); > >>>> PCMachineState *pcms = PC_MACHINE(hotplug_dev); > >>>> > >>>> - hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); > >>>> - hhc->unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err); > >>>> - > >>>> + hotplug_handler_unplug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, > >>>> &local_err); > >>>> if (local_err) { > >>>> goto out; > >>>> } > >>>> > >>> > >>> Queued, thanks. > >> > >> Paolo, just wondering, is this still on your queue or fell of the wagon? > > > > I had some issues with the previous pull request and also have to really > > spend some time on KVM. But it's still queued. > > > > No worries, I have some qdev patches based on this, but will simply send > this patch along with that series. Whatever hits upstream first :)
Yes I was going to offer to put it on my queue but if there are dependencies for another queue that's fine too. You can also add Reviewed-by: Michael S. Tsirkin <m...@redhat.com> if you like. > > Paolo > > > > > -- > > Thanks, > > David / dhildenb