From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFe4p-0002FF-Ip for qemu-devel@nongnu.org; Mon, 07 May 2018 07:13:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFe4o-0007AD-K3 for qemu-devel@nongnu.org; Mon, 07 May 2018 07:13:07 -0400 From: Igor Mammedov Date: Mon, 7 May 2018 13:12:01 +0200 Message-Id: <1525691524-32265-2-git-send-email-imammedo@redhat.com> In-Reply-To: <1525691524-32265-1-git-send-email-imammedo@redhat.com> References: <1525691524-32265-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH v4 1/4] pc: simplify MachineClass::get_hotplug_handler handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, peter.maydell@linaro.org By default MachineClass::get_hotplug_handler is NULL and concrete board should set it to it's own handler. Considering there isn't any default handler, drop saving empty MachineClass::get_hotplug_handler in child class and make PC code consistent with spapr/s390x boards. We can bring this back when actual usecase surfaces and do it consistently across boards that use get_hotplug_handler(). Suggested-by: David Gibson Signed-off-by: Igor Mammedov Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Eduardo Habkost --- include/hw/i386/pc.h | 8 -------- hw/i386/pc.c | 6 +----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ffee841..fac6689 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -84,10 +84,6 @@ struct PCMachineState { /** * PCMachineClass: * - * Methods: - * - * @get_hotplug_handler: pointer to parent class callback @get_hotplug_h= andler - * * Compat fields: * * @enforce_aligned_dimm: check that DIMM's address/size is aligned by @@ -107,10 +103,6 @@ struct PCMachineClass { =20 /*< public >*/ =20 - /* Methods: */ - HotplugHandler *(*get_hotplug_handler)(MachineState *machine, - DeviceState *dev); - /* Device configuration: */ bool pci_enabled; bool kvmclock_enabled; diff --git a/hw/i386/pc.c b/hw/i386/pc.c index b297a5d..018fd8d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -2056,15 +2056,12 @@ static void pc_machine_device_unplug_cb(HotplugHa= ndler *hotplug_dev, static HotplugHandler *pc_get_hotpug_handler(MachineState *machine, DeviceState *dev) { - PCMachineClass *pcmc =3D PC_MACHINE_GET_CLASS(machine); - if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) || object_dynamic_cast(OBJECT(dev), TYPE_CPU)) { return HOTPLUG_HANDLER(machine); } =20 - return pcmc->get_hotplug_handler ? - pcmc->get_hotplug_handler(machine, dev) : NULL; + return NULL; } =20 static void @@ -2344,7 +2341,6 @@ static void pc_machine_class_init(ObjectClass *oc, = void *data) HotplugHandlerClass *hc =3D HOTPLUG_HANDLER_CLASS(oc); NMIClass *nc =3D NMI_CLASS(oc); =20 - pcmc->get_hotplug_handler =3D mc->get_hotplug_handler; pcmc->pci_enabled =3D true; pcmc->has_acpi_build =3D true; pcmc->rsdp_in_ram =3D true; --=20 2.7.4