From patchwork Tue Sep 30 09:40:34 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhu Guihua X-Patchwork-Id: 394837 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 69C4E14013F for ; Tue, 30 Sep 2014 19:42:24 +1000 (EST) Received: from localhost ([::1]:41987 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtws-0006uJ-JQ for incoming@patchwork.ozlabs.org; Tue, 30 Sep 2014 05:42:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59481) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtwN-0006B4-Ri for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:41:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYtwJ-00022S-6t for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:41:51 -0400 Received: from [59.151.112.132] (port=36473 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYtwI-000202-Rw for qemu-devel@nongnu.org; Tue, 30 Sep 2014 05:41:47 -0400 X-IronPort-AV: E=Sophos;i="5.04,625,1406563200"; d="scan'208";a="36669757" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Sep 2014 17:38:34 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id s8U9fcnw004454; Tue, 30 Sep 2014 17:41:39 +0800 Received: from G08FNSTD140041.fnst.cn.fujitsu.com (10.167.226.252) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 30 Sep 2014 17:41:40 +0800 From: Zhu Guihua To: Date: Tue, 30 Sep 2014 17:40:34 +0800 Message-ID: <10d53bf553d243380f0355024a1cb300b04060a9.1412067797.git.zhugh.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.167.226.252] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Cc: peter.crosthwaite@xilinx.com, Zhu Guihua , mst@redhat.com, hutao@cn.fujitsu.com, armbru@redhat.com, lcapitulino@redhat.com, isimatu.yasuaki@jp.fujitsu.com, kroosec@gmail.com, imammedo@redhat.com, pbonzini@redhat.com, tangchen@cn.fujitsu.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v2 1/2] qdev: add list built for devices 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 For peripheral device del completion, add a function to build a list for devices. Signed-off-by: Zhu Guihua --- hw/core/qdev.c | 13 +++++++++++++ include/hw/qdev-core.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index fcb1638..041ac38 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -1074,6 +1074,19 @@ void device_reset(DeviceState *dev) } } +int device_built_list(Object *obj, void *opaque) +{ + GSList **list = opaque; + DeviceState *dev = DEVICE(obj); + + if (dev->realized) { + *list = g_slist_append(*list, dev); + } + + return 0; + +} + Object *qdev_get_machine(void) { static Object *dev; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 178fee2..3c30837 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -348,6 +348,8 @@ void qdev_machine_init(void); */ void device_reset(DeviceState *dev); +int device_built_list(Object *obj, void *opaque); + const struct VMStateDescription *qdev_get_vmsd(DeviceState *dev); const char *qdev_fw_name(DeviceState *dev);