From patchwork Sun Jul 31 17:58:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 1024462 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6VHxUBk009858 for ; Sun, 31 Jul 2011 17:59:41 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753040Ab1GaR73 (ORCPT ); Sun, 31 Jul 2011 13:59:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14310 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752670Ab1GaR6L (ORCPT ); Sun, 31 Jul 2011 13:58:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6VHw9OC026698 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 31 Jul 2011 13:58:09 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p6VHw6iP028197; Sun, 31 Jul 2011 13:58:09 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id E5009250B5A; Sun, 31 Jul 2011 20:58:04 +0300 (IDT) From: Avi Kivity To: Anthony Liguori , qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org Subject: [PATCH 37/39] pci: fold BAR mapping function into its caller Date: Sun, 31 Jul 2011 20:58:00 +0300 Message-Id: <1312135082-31985-38-git-send-email-avi@redhat.com> In-Reply-To: <1312135082-31985-1-git-send-email-avi@redhat.com> References: <1312135082-31985-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sun, 31 Jul 2011 17:59:41 +0000 (UTC) There is only one function, so no need for a function pointer. Signed-off-by: Avi Kivity --- hw/pci.c | 25 +++++++++---------------- hw/pci.h | 1 - 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index e9e4874..e6a759a 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -881,18 +881,6 @@ static int pci_unregister_device(DeviceState *dev) return 0; } -static void pci_simple_bar_mapfunc_region(PCIDevice *pci_dev, int region_num, - pcibus_t addr, pcibus_t size, - int type) -{ - PCIIORegion *r = &pci_dev->io_regions[region_num]; - - memory_region_add_subregion_overlap(r->address_space, - addr, - r->memory, - 1); -} - void pci_register_bar_region(PCIDevice *pci_dev, int region_num, uint8_t type, MemoryRegion *memory) { @@ -914,7 +902,6 @@ void pci_register_bar_region(PCIDevice *pci_dev, int region_num, r->size = size; r->filtered_size = size; r->type = type; - r->map_func = pci_simple_bar_mapfunc_region; r->memory = NULL; wmask = ~(size - 1); @@ -1102,10 +1089,16 @@ static void pci_update_mappings(PCIDevice *d) * addr & (size - 1) != 0. */ if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { - r->map_func(d, i, r->addr, r->filtered_size, r->type); + memory_region_add_subregion_overlap(r->address_space, + r->addr, + r->memory, + 1); } else { - r->map_func(d, i, pci_to_cpu_addr(d->bus, r->addr), - r->filtered_size, r->type); + memory_region_add_subregion_overlap(r->address_space, + pci_to_cpu_addr(d->bus, + r->addr), + r->memory, + 1); } } } diff --git a/hw/pci.h b/hw/pci.h index 8028176..8d1662a 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -92,7 +92,6 @@ typedef struct PCIIORegion { pcibus_t size; pcibus_t filtered_size; uint8_t type; - PCIMapIORegionFunc *map_func; MemoryRegion *memory; MemoryRegion *address_space; } PCIIORegion;