Received: from eggs.gnu.org ([208.118.235.92]:48966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaEmF-00008A-4Z for qemu-devel@nongnu.org; Wed, 08 May 2013 20:32:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UaEm9-0006AA-5k for qemu-devel@nongnu.org; Wed, 08 May 2013 20:32:07 -0400 Received: from ozlabs.org ([203.10.76.45]:53747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UaEm8-00069U-RR for qemu-devel@nongnu.org; Wed, 08 May 2013 20:32:01 -0400 From: David Gibson Date: Thu, 9 May 2013 10:31:06 +1000 Message-Id: <1368059472-25071-3-git-send-email-david@gibson.dropbear.id.au> In-Reply-To: <1368059472-25071-1-git-send-email-david@gibson.dropbear.id.au> References: <1368059472-25071-1-git-send-email-david@gibson.dropbear.id.au> Subject: [Qemu-devel] [PATCH 2/8] pci: Move pci_read_devaddr to pci-hotplug-old.c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com, mst@redhat.com Cc: qemu-devel@nongnu.org, David Gibson 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 724a80b..1aa0ab8 100644 --- a/hw/pci/pci-hotplug-old.c +++ b/hw/pci/pci-hotplug-old.c @@ -34,6 +34,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 d5257ed..9906e84 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); -- 1.7.10.4