From patchwork Tue Feb 18 16:56:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Igor Mammedov X-Patchwork-Id: 321573 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 189372C0142 for ; Wed, 19 Feb 2014 04:04:07 +1100 (EST) Received: from localhost ([::1]:51872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFo5T-0005Zh-TY for incoming@patchwork.ozlabs.org; Tue, 18 Feb 2014 12:04:03 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFo59-0005ZS-Lo for qemu-devel@nongnu.org; Tue, 18 Feb 2014 12:03:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFo52-0002u2-Pq for qemu-devel@nongnu.org; Tue, 18 Feb 2014 12:03:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFo52-0002to-IF for qemu-devel@nongnu.org; Tue, 18 Feb 2014 12:03:36 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1IH3WgO012626 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 18 Feb 2014 12:03:32 -0500 Received: from dell-pet610-01.lab.eng.brq.redhat.com (dell-pet610-01.lab.eng.brq.redhat.com [10.34.42.20]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1IH3SFZ010926; Tue, 18 Feb 2014 12:03:29 -0500 From: Igor Mammedov To: qemu-devel@nongnu.org Date: Tue, 18 Feb 2014 17:56:53 +0100 Message-Id: <1392742613-15434-1-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id s1IH3WgO012626 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: pbonzini@redhat.com, afaerber@suse.de, anthony@codemonkey.ws, mst@redhat.com Subject: [Qemu-devel] [PATCH] qdev: set DeviceClass.hotpluggable default in class_init() 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 Move setting DeviceClass.hotpluggable default from class_base_init() to device's own class_init(). Reported-by: Andreas Färber Signed-off-by: Igor Mammedov --- hw/core/qdev.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 64b66e0..dcf331c 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -816,14 +816,6 @@ static void device_class_base_init(ObjectClass *class, void *data) * so do not propagate them to the subclasses. */ klass->props = NULL; - - /* by default all devices were considered as hotpluggable, - * so with intent to check it in generic qdev_unplug() / - * device_set_realized() functions make every device - * hotpluggable. Devices that shouldn't be hotpluggable, - * should override it in their class_init() - */ - klass->hotpluggable = true; } static void device_unparent(Object *obj) @@ -869,6 +861,14 @@ static void device_class_init(ObjectClass *class, void *data) class->unparent = device_unparent; dc->realize = device_realize; dc->unrealize = device_unrealize; + + /* by default all devices were considered as hotpluggable, + * so with intent to check it in generic qdev_unplug() / + * device_set_realized() functions make every device + * hotpluggable. Devices that shouldn't be hotpluggable, + * should override it in their class_init() + */ + dc->hotpluggable = true; } void device_reset(DeviceState *dev)