From patchwork Thu Feb 11 01:49:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 45091 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 D2CD7B6F11 for ; Thu, 11 Feb 2010 13:10:01 +1100 (EST) Received: from localhost ([127.0.0.1]:34209 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfOUy-0008UZ-C9 for incoming@patchwork.ozlabs.org; Wed, 10 Feb 2010 21:09:44 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfOCa-0006yx-RC for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:45 -0500 Received: from [199.232.76.173] (port=57741 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfOCZ-0006xX-8O for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:43 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfOCX-0001IE-3B for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:42 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30978) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfOCV-0001Hm-QY for qemu-devel@nongnu.org; Wed, 10 Feb 2010 20:50:40 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1B1ocJw000792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 10 Feb 2010 20:50:39 -0500 Received: from localhost (vpn-10-105.rdu.redhat.com [10.11.10.105]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1B1objq031191; Wed, 10 Feb 2010 20:50:38 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 10 Feb 2010 23:49:56 -0200 Message-Id: <1265853007-27300-11-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1265853007-27300-1-git-send-email-lcapitulino@redhat.com> References: <1265853007-27300-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: armbru@redhat.com Subject: [Qemu-devel] [PATCH 10/21] Monitor: Convert pci_device_hot_remove() to cmd_new_ret() 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: Luiz Capitulino --- hw/pci-hotplug.c | 14 +++++++------- qemu-monitor.hx | 2 +- sysemu.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 6cc70d5..bd82c6a 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -296,26 +296,26 @@ int pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) } #endif -void pci_device_hot_remove(Monitor *mon, const char *pci_addr) +int pci_device_hot_remove(Monitor *mon, const char *pci_addr) { PCIDevice *d; int dom, bus; unsigned slot; if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) { - return; + return -1; } d = pci_find_device(pci_find_root_bus(0), bus, slot, 0); if (!d) { monitor_printf(mon, "slot %d empty\n", slot); - return; + return -1; } - qdev_unplug(&d->qdev); + return qdev_unplug(&d->qdev); } -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, - QObject **ret_data) +int do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, + QObject **ret_data) { - pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); + return pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 2831055..e987cf1 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -874,7 +874,7 @@ ETEXI .params = "[[:]:]", .help = "hot remove PCI device", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_pci_device_hot_remove, + .cmd_new_ret = do_pci_device_hot_remove, }, #endif diff --git a/sysemu.h b/sysemu.h index d41a338..8ba618e 100644 --- a/sysemu.h +++ b/sysemu.h @@ -215,9 +215,9 @@ DriveInfo *add_init_drive(const char *opts); void pci_device_hot_add_print(Monitor *mon, const QObject *data); int pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data); void drive_hot_add(Monitor *mon, const QDict *qdict); -void pci_device_hot_remove(Monitor *mon, const char *pci_addr); -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, - QObject **ret_data); +int pci_device_hot_remove(Monitor *mon, const char *pci_addr); +int do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, + QObject **ret_data); /* serial ports */