From patchwork Mon Dec 17 16:24:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 206921 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 25A762C007B for ; Tue, 18 Dec 2012 03:56:37 +1100 (EST) Received: from localhost ([::1]:47355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdW4-0001O8-2c for incoming@patchwork.ozlabs.org; Mon, 17 Dec 2012 11:26:08 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVd-00013Y-NX for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkdVc-0008Lz-DB for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:41 -0500 Received: from mail-ie0-f173.google.com ([209.85.223.173]:46953) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVc-0008LA-3U for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:40 -0500 Received: by mail-ie0-f173.google.com with SMTP id e13so9604328iej.4 for ; Mon, 17 Dec 2012 08:25:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=+aYemZID5V0TlOZ41cSWul0vf+zmSn+nvLMnHLMxvTg=; b=KNdOEpwSw/rUnK/mChzNogOVVPsw+skGbH69fcYjlwRg534DO2S/zvUY8T9qR7yoqL ipfB6uEHCBpRVbE+qYDRq3U9cKN84xH0rGZFZ17ziXRQxa00JHQLVzBNEwdIt/MSLiwb gWBp/Zm/NfXKKhMihkYOiL4IPFSnGvAQ74aljAfavcCcH6IIHO/bS7aTFN0h4suE/WLA Rziw6yPS8srwMxfNalaSq9/mpoxJOT+5OGODIoX+4pV2q0oMusBrjR61M8g7q929weGU +O/wwMLWK2ebbkrOWXQVawQHqfetxsYXAQzpm6iVQSY4+owLsSiFr7aM3gKR+fRzcfOk aspA== Received: by 10.42.57.11 with SMTP id b11mr11609680ich.15.1355761539695; Mon, 17 Dec 2012 08:25:39 -0800 (PST) Received: from yakj.usersys.redhat.com (93-34-219-150.ip51.fastwebnet.it. [93.34.219.150]) by mx.google.com with ESMTPS id bh3sm5950327igc.0.2012.12.17.08.25.36 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Dec 2012 08:25:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 17 Dec 2012 17:24:46 +0100 Message-Id: <1355761490-10073-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.0.2 In-Reply-To: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> References: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.223.173 Cc: aliguori@us.ibm.com, mst@redhat.com Subject: [Qemu-devel] [PATCH 11/15] qdev: remove device_reset 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 The right thing to do is always to use qdev_reset_all (or qbus_reset_all). Call the reset method straight from qdev_reset_one. Signed-off-by: Paolo Bonzini --- hw/qdev-core.h | 7 ------- hw/qdev.c | 15 +++++---------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index 7c2598e..28f12a4 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -218,13 +218,6 @@ char *qdev_get_fw_dev_path(DeviceState *dev); */ void qdev_machine_init(void); -/** - * @device_reset - * - * Reset a single device (by calling the reset method). - */ -void device_reset(DeviceState *dev); - const struct VMStateDescription *qdev_get_vmsd(DeviceState *dev); const char *qdev_fw_name(DeviceState *dev); diff --git a/hw/qdev.c b/hw/qdev.c index 833d571..1736d6f 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -211,7 +211,11 @@ void qdev_unplug(DeviceState *dev, Error **errp) static int qdev_reset_one(DeviceState *dev, void *opaque) { - device_reset(dev); + DeviceClass *klass = DEVICE_GET_CLASS(dev); + + if (klass->reset) { + klass->reset(dev); + } return 0; } @@ -750,15 +754,6 @@ static void device_class_init(ObjectClass *class, void *data) class->unparent = qdev_remove_from_bus; } -void device_reset(DeviceState *dev) -{ - DeviceClass *klass = DEVICE_GET_CLASS(dev); - - if (klass->reset) { - klass->reset(dev); - } -} - Object *qdev_get_machine(void) { static Object *dev;