From patchwork Sun Aug 26 15:51:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 180099 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF8302C00FD for ; Mon, 27 Aug 2012 09:17:55 +1000 (EST) Received: from localhost ([::1]:42263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5Z-0004pX-MH for incoming@patchwork.ozlabs.org; Sun, 26 Aug 2012 19:17:53 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5F-0004gZ-FC for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T5m5D-0003cf-Hu for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:33 -0400 Received: from cpe-70-123-140-180.austin.res.rr.com ([70.123.140.180]:50521 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T5m5D-0003cZ-Bi for qemu-devel@nongnu.org; Sun, 26 Aug 2012 19:17:31 -0400 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu2) with ESMTP id q7QFppNw005211; Sun, 26 Aug 2012 10:51:51 -0500 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q7QFpo5S005210; Sun, 26 Aug 2012 10:51:50 -0500 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Sun, 26 Aug 2012 10:51:36 -0500 Message-Id: <1345996298-4892-8-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> References: <1345996298-4892-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.140.180 Cc: Paolo Bonzini , Anthony Liguori , Liu Ping Fan , Andreas Faerber Subject: [Qemu-devel] [PATCH 7/9] qdev: add notifier for when the device loses its parent bus (eject) X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori --- hw/qdev.c | 2 ++ hw/qdev.h | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index fdee91f..86e1337 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -672,6 +672,8 @@ static void device_initfn(Object *obj) object_property_add_link(OBJECT(dev), "parent_bus", TYPE_BUS, (Object **)&dev->parent_bus, NULL); + + notifier_list_init(&dev->eject_notifier); } /* Unlink device from bus and free the structure. */ diff --git a/hw/qdev.h b/hw/qdev.h index 3561e3a..5009072 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -8,6 +8,7 @@ #include "qapi/qapi-visit-core.h" #include "qemu/object.h" #include "error.h" +#include "notify.h" typedef struct Property Property; @@ -76,6 +77,8 @@ struct DeviceState { int num_child_bus; int instance_id_alias; int alias_required_for_version; + + NotifierList eject_notifier; }; #define TYPE_BUS "bus"