From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPX00-0006Ln-Az for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPWzm-0006xr-0r for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:22:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPWzl-0006x8-OV for qemu-devel@nongnu.org; Thu, 04 Sep 2014 09:22:37 -0400 Date: Thu, 4 Sep 2014 15:22:27 +0200 From: Igor Mammedov Message-ID: <20140904152227.28adee98@nial.usersys.redhat.com> In-Reply-To: <1409126919-22233-5-git-send-email-tangchen@cn.fujitsu.com> References: <1409126919-22233-1-git-send-email-tangchen@cn.fujitsu.com> <1409126919-22233-5-git-send-email-tangchen@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RESEND PATCH v3 4/8] qdev: Add memory hot unplug support for bus-less devices. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tang Chen Cc: zhugh.fnst@cn.fujitsu.com, mst@redhat.com, hutao@cn.fujitsu.com, qemu-devel@nongnu.org, isimatu.yasuaki@jp.fujitsu.com, pbonzini@redhat.com On Wed, 27 Aug 2014 16:08:35 +0800 Tang Chen wrote: > From: Hu Tao > > Implement bus-less device hot-remove in qdev_unplug(). It will call PCMachine > callback introduced in previous patch. > subject/commit message doesn't need to mention memory hotplug/PCMachine, it's generic handling that applies to other devices even though pc-dimm is the only bus-less device handled here. > Signed-off-by: Hu Tao > Signed-off-by: Tang Chen > --- > hw/core/qdev.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/hw/core/qdev.c b/hw/core/qdev.c > index da1ba48..e365a74 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -228,6 +228,14 @@ void qdev_unplug(DeviceState *dev, Error **errp) > > if (dev->parent_bus && dev->parent_bus->hotplug_handler) { > hotplug_handler_unplug(dev->parent_bus->hotplug_handler, dev, errp); > + } else if (*errp == NULL) { what's the reason for ^^^ condition here? > + HotplugHandler *hotplug_ctrl; > + MachineState *machine = MACHINE(qdev_get_machine()); > + MachineClass *mc = MACHINE_GET_CLASS(machine); > + > + hotplug_ctrl = mc->get_hotplug_handler(machine, dev); > + if (hotplug_ctrl) > + hotplug_handler_unplug(hotplug_ctrl, dev, errp); > } else { > assert(dc->unplug != NULL); > if (dc->unplug(dev) < 0) { /* legacy handler */