From patchwork Thu Jul 4 09:13:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 256838 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 E65A92C008C for ; Thu, 4 Jul 2013 19:16:14 +1000 (EST) Received: from localhost ([::1]:38240 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uufe8-00008Y-GF for incoming@patchwork.ozlabs.org; Thu, 04 Jul 2013 05:16:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UufaB-0001wj-EC for qemu-devel@nongnu.org; Thu, 04 Jul 2013 05:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uufa6-0002lo-84 for qemu-devel@nongnu.org; Thu, 04 Jul 2013 05:12:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uufa5-0002lQ-Tp for qemu-devel@nongnu.org; Thu, 04 Jul 2013 05:12:02 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r649BxDW021248 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Jul 2013 05:11:59 -0400 Received: from redhat.com (vpn1-7-171.ams2.redhat.com [10.36.7.171]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id r649BwPZ024000; Thu, 4 Jul 2013 05:11:58 -0400 Date: Thu, 4 Jul 2013 12:13:10 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1372928939-2712-11-git-send-email-mst@redhat.com> References: <1372928939-2712-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1372928939-2712-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: David Gibson Subject: [Qemu-devel] [PATCH v3 10/18] 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 From: 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 Signed-off-by: Michael S. Tsirkin --- 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 61b681a..adf4da5 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 6ef1f97..b5edef8 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -395,8 +395,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);