From patchwork Thu Aug 4 13:06:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 108496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8491DB6F18 for ; Fri, 5 Aug 2011 00:46:28 +1000 (EST) Received: from localhost ([::1]:45155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qoxea-0002jX-Et for incoming@patchwork.ozlabs.org; Thu, 04 Aug 2011 09:08:00 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoxdU-0000mN-1h for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QoxdM-0007QF-A7 for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16943) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QoxdL-0007Os-OK for qemu-devel@nongnu.org; Thu, 04 Aug 2011 09:06:44 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p74D6gxp021901 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 4 Aug 2011 09:06:42 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p74D6dsp010370; Thu, 4 Aug 2011 09:06:42 -0400 Received: from s01.tlv.redhat.com (s01.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id 71666250B5E; Thu, 4 Aug 2011 16:06:38 +0300 (IDT) From: Avi Kivity To: Anthony Liguori , qemu-devel@nongnu.org Date: Thu, 4 Aug 2011 16:06:33 +0300 Message-Id: <1312463195-13605-38-git-send-email-avi@redhat.com> In-Reply-To: <1312463195-13605-1-git-send-email-avi@redhat.com> References: <1312463195-13605-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH v3 37/39] pci: fold BAR mapping function into its caller 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 There is only one function, so no need for a function pointer. Reviewed-by: Richard Henderson 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;