From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnaHP-0005Qj-51 for qemu-devel@nongnu.org; Sun, 31 Jul 2011 13:58:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QnaHD-0007hk-PW for qemu-devel@nongnu.org; Sun, 31 Jul 2011 13:58:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QnaHC-0007f3-Ro for qemu-devel@nongnu.org; Sun, 31 Jul 2011 13:58:11 -0400 From: Avi Kivity 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> Subject: [Qemu-devel] [PATCH 37/39] pci: fold BAR mapping function into its caller List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori , qemu-devel@nongnu.org Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" 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; -- 1.7.5.3