From patchwork Thu Jun 6 08:48:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 249323 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0D4C52C007C for ; Thu, 6 Jun 2013 18:50:06 +1000 (EST) Received: from localhost ([::1]:46473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkVtT-0006hA-T2 for incoming@patchwork.ozlabs.org; Thu, 06 Jun 2013 04:50:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkVse-0006V9-Hp for qemu-devel@nongnu.org; Thu, 06 Jun 2013 04:49:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkVsR-0000oi-W8 for qemu-devel@nongnu.org; Thu, 06 Jun 2013 04:49:12 -0400 Received: from ozlabs.org ([2402:b800:7003:1:1::1]:38857) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkVsR-0000nn-K3 for qemu-devel@nongnu.org; Thu, 06 Jun 2013 04:48:59 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 9A3B52C00A7; Thu, 6 Jun 2013 18:48:57 +1000 (EST) From: David Gibson To: aliguori@us.ibm.com, mst@redhat.com Date: Thu, 6 Jun 2013 18:48:46 +1000 Message-Id: <1370508534-12335-3-git-send-email-david@gibson.dropbear.id.au> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370508534-12335-1-git-send-email-david@gibson.dropbear.id.au> References: <1370508534-12335-1-git-send-email-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2402:b800:7003:1:1::1 Cc: bonzini@redhat.com, qemu-devel@nongnu.org, David Gibson Subject: [Qemu-devel] [PATCH 02/10] pci: Move pci_read_devaddr to pci-hotplug-old.c 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 pci_read_devaddr() is only used by the legacy functions for the old PCI hotplug interface in pci-hotplug-old.c. So we move the function there, and make it static. Signed-off-by: David Gibson --- hw/pci/pci-hotplug-old.c | 14 ++++++++++++++ hw/pci/pci.c | 16 +--------------- include/hw/pci/pci.h | 4 ++-- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/hw/pci/pci-hotplug-old.c b/hw/pci/pci-hotplug-old.c index b3c233c..a0b5558 100644 --- a/hw/pci/pci-hotplug-old.c +++ b/hw/pci/pci-hotplug-old.c @@ -36,6 +36,20 @@ #include "sysemu/blockdev.h" #include "qapi/error.h" +static int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, + int *busp, unsigned *slotp) +{ + /* strip legacy tag */ + if (!strncmp(addr, "pci_addr=", 9)) { + addr += 9; + } + if (pci_parse_devaddr(addr, domp, busp, slotp, NULL)) { + monitor_printf(mon, "Invalid pci address\n"); + return -1; + } + return 0; +} + static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon, const char *devaddr, const char *opts_str) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index bb3879b..f0005c6 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -522,7 +522,7 @@ static void pci_set_default_subsystem_id(PCIDevice *pci_dev) * Parse [[:]:], return -1 on error if funcp == NULL * [[:]:]., return -1 on error */ -static int pci_parse_devaddr(const char *addr, int *domp, int *busp, +int pci_parse_devaddr(const char *addr, int *domp, int *busp, unsigned int *slotp, unsigned int *funcp) { const char *p; @@ -581,20 +581,6 @@ static int pci_parse_devaddr(const char *addr, int *domp, int *busp, return 0; } -int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp, - unsigned *slotp) -{ - /* strip legacy tag */ - if (!strncmp(addr, "pci_addr=", 9)) { - addr += 9; - } - if (pci_parse_devaddr(addr, domp, busp, slotp, NULL)) { - monitor_printf(mon, "Invalid pci address\n"); - return -1; - } - return 0; -} - PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr) { int dom, bus; diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 8d075ab..3ef2ee1 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -396,8 +396,8 @@ PCIDevice *pci_find_device(PCIBus *bus, int bus_num, uint8_t devfn); int pci_qdev_find_device(const char *id, PCIDevice **pdev); PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr); -int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp, - unsigned *slotp); +int pci_parse_devaddr(const char *addr, int *domp, int *busp, + unsigned int *slotp, unsigned int *funcp); void pci_device_deassert_intx(PCIDevice *dev);