From patchwork Fri Sep 25 19:42:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 34304 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3D899B7BD7 for ; Sat, 26 Sep 2009 06:29:53 +1000 (EST) Received: from localhost ([127.0.0.1]:46531 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrHQM-0001Va-BX for incoming@patchwork.ozlabs.org; Fri, 25 Sep 2009 16:29:50 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrGhM-0006bT-JZ for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrGhH-0006Vr-SB for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:19 -0400 Received: from [199.232.76.173] (port=56065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrGhG-0006VR-SN for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10816) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrGhG-0004gM-DB for qemu-devel@nongnu.org; Fri, 25 Sep 2009 15:43:14 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8PJhDa6032679 for ; Fri, 25 Sep 2009 15:43:13 -0400 Received: from zweiblum.home.kraxel.org (vpn2-8-108.ams2.redhat.com [10.36.8.108]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n8PJh63t028058; Fri, 25 Sep 2009 15:43:08 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id C3C63700FC; Fri, 25 Sep 2009 21:42:50 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 25 Sep 2009 21:42:49 +0200 Message-Id: <1253907769-1067-25-git-send-email-kraxel@redhat.com> In-Reply-To: <1253907769-1067-1-git-send-email-kraxel@redhat.com> References: <1253907769-1067-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 24/24] store a pointer to QemuOpts in DeviceState, release it when zapping a device. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/qdev.c | 3 +++ hw/qdev.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 00cb849..ae24df7 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -218,6 +218,7 @@ DeviceState *qdev_device_add(QemuOpts *opts) qdev_free(qdev); return NULL; } + qdev->opts = opts; return qdev; } @@ -276,6 +277,8 @@ void qdev_free(DeviceState *dev) qemu_unregister_reset(dev->info->reset, dev); if (dev->info->exit) dev->info->exit(dev); + if (dev->opts) + qemu_opts_del(dev->opts); } QLIST_REMOVE(dev, sibling); qemu_free(dev); diff --git a/hw/qdev.h b/hw/qdev.h index 8b6e4fe..1884160 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -29,6 +29,7 @@ enum DevState { struct DeviceState { const char *id; enum DevState state; + QemuOpts *opts; int hotplugged; DeviceInfo *info; BusState *parent_bus;