From patchwork Wed Feb 26 18:26:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 324563 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7526E2C0096 for ; Thu, 27 Feb 2014 05:27:50 +1100 (EST) Received: from localhost ([::1]:42417 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIjCu-00069h-39 for incoming@patchwork.ozlabs.org; Wed, 26 Feb 2014 13:27:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIjBO-0003xe-LW for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:26:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WIjBJ-0007dN-O5 for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:26:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WIjBJ-0007dI-GI for qemu-devel@nongnu.org; Wed, 26 Feb 2014 13:26:09 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1QIQ7U4001179 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 26 Feb 2014 13:26:08 -0500 Received: from bling.home (ovpn-113-32.phx2.redhat.com [10.3.113.32]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1QIQ7WE001798; Wed, 26 Feb 2014 13:26:07 -0500 From: Alex Williamson To: anthony@redhat.com Date: Wed, 26 Feb 2014 11:26:06 -0700 Message-ID: <20140226182606.8018.26997.stgit@bling.home> In-Reply-To: <20140226182246.8018.81349.stgit@bling.home> References: <20140226182246.8018.81349.stgit@bling.home> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id s1QIQ7U4001179 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Bandan Das , Andreas =?utf-8?q?F=C3=A4rber?= , qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 3/4] qdev-monitor: set DeviceState opts before calling realize 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 From: Bandan Das Setting opts before the realize property is set allows the following patch to make decisions based on whether the user specified "rombar". This also avoids having to create a new tristate property especially for this purpose Reviewed-by: Andreas Färber Signed-off-by: Bandan Das Signed-off-by: Alex Williamson --- qdev-monitor.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qdev-monitor.c b/qdev-monitor.c index 3a7dc0d..6673e3c 100644 --- a/qdev-monitor.c +++ b/qdev-monitor.c @@ -548,16 +548,18 @@ DeviceState *qdev_device_add(QemuOpts *opts) OBJECT(dev), NULL); g_free(name); } + + dev->opts = opts; object_property_set_bool(OBJECT(dev), true, "realized", &err); if (err != NULL) { qerror_report_err(err); error_free(err); + dev->opts = NULL; object_unparent(OBJECT(dev)); object_unref(OBJECT(dev)); qerror_report(QERR_DEVICE_INIT_FAILED, driver); return NULL; } - dev->opts = opts; return dev; }