[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 17/36] qdev: add wrapper to set BUS as Hotplu
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v2 17/36] qdev: add wrapper to set BUS as HotplugHandler |
Date: |
Mon, 29 Sep 2014 12:59:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 |
Il 26/09/2014 11:28, Igor Mammedov ha scritto:
> to be used for conversion of SCSI and USB devices,
> and would allow to make every HBA/USB host switch
> to HotplugHandler API without touching each controller
> explicitly.
>
> Signed-off-by: Igor Mammedov <address@hidden>
> ---
> hw/core/qdev.c | 19 +++++++++++++++++++
> include/hw/qdev-core.h | 11 ++++-------
> 2 files changed, 23 insertions(+), 7 deletions(-)
>
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 1d1b113..0de99b2 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -112,6 +112,25 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
> bus_add_child(bus, dev);
> }
>
> +static void qbus_set_hotplug_handler_internal(BusState *bus, Object *handler,
> + Error **errp)
> +{
> +
> + object_property_set_link(OBJECT(bus), OBJECT(handler),
> + QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
> + bus->allow_hotplug = 1;
> +}
> +
> +void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error
> **errp)
> +{
> + qbus_set_hotplug_handler_internal(bus, OBJECT(handler), errp);
> +}
> +
> +void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp)
> +{
> + qbus_set_hotplug_handler_internal(bus, OBJECT(bus), errp);
> +}
> +
> /* Create a new device. This only initializes the device state structure
> and allows properties to be set. qdev_init should be called to
> initialize the actual device emulation. */
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index ba812c5..48e9579 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -363,13 +363,10 @@ extern int qdev_hotplug;
>
> char *qdev_get_dev_path(DeviceState *dev);
>
> -static inline void qbus_set_hotplug_handler(BusState *bus, DeviceState
> *handler,
> - Error **errp)
> -{
> - object_property_set_link(OBJECT(bus), OBJECT(handler),
> - QDEV_HOTPLUG_HANDLER_PROPERTY, errp);
> - bus->allow_hotplug = 1;
> -}
> +void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler,
> + Error **errp);
> +
> +void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp);
>
> static inline bool qbus_is_hotpluggable(BusState *bus)
> {
>
Reviewed-by: Paolo Bonzini <address@hidden>
- [Qemu-devel] [PATCH v2 10/36] test: usb: usb-storage hotplug test, (continued)
- [Qemu-devel] [PATCH v2 10/36] test: usb: usb-storage hotplug test, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 12/36] access BusState.allow_hotplug using wraper qbus_is_hotpluggable(), Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 13/36] qdev: do not allow to instantiate non hotpluggable device with device_add, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 14/36] qdev: HotplugHandler: rename unplug callback to unplug_request, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 15/36] qdev: HotplugHandler: provide unplug callback, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 16/36] qdev: add simple/generic unplug callback for HotplugHandler, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 18/36] qdev: drop hotplug check from bus_add_child(), Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 17/36] qdev: add wrapper to set BUS as HotplugHandler, Igor Mammedov, 2014/09/26
- Re: [Qemu-devel] [PATCH v2 17/36] qdev: add wrapper to set BUS as HotplugHandler,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 20/36] virtio-pci: drop BusState.allow_hotplug, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 21/36] virtio-serial: convert to hotplug-handler API, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 22/36] virtio-mmio: drop useless bus->allow_hotplug = 0, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 23/36] s390x: drop not used allow_hotplug in event-facility, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v2 24/36] s390x: convert s390-virtio to hotplug handler API, Igor Mammedov, 2014/09/26
- [Qemu-devel] [PATCH v3 24/36] s390x: convert s390-virtio to hotplug handler API, Igor Mammedov, 2014/09/26