From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV0D-0008Sp-Bq for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwV09-0004zV-Ke for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwV08-0004y7-5v for qemu-devel@nongnu.org; Thu, 25 Aug 2011 04:09:24 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p7P89NXh010690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Aug 2011 04:09:23 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p7P89LbS020401 for ; Thu, 25 Aug 2011 04:09:22 -0400 From: Avi Kivity Date: Thu, 25 Aug 2011 11:09:18 +0300 Message-Id: <1314259758-5198-20-git-send-email-avi@redhat.com> In-Reply-To: <1314259758-5198-1-git-send-email-avi@redhat.com> References: <1314259758-5198-1-git-send-email-avi@redhat.com> Subject: [Qemu-devel] [PATCH 19/19] pci: simplify memory region registration List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are almost identical. Unify them. Signed-off-by: Avi Kivity --- hw/pci.c | 15 ++++----------- 1 files changed, 4 insertions(+), 11 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 1a5d2b6..e9e37ef 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -1059,18 +1059,11 @@ static void pci_update_mappings(PCIDevice *d) * Teach them such cases, such that filtered_size < size and * addr & (size - 1) != 0. */ - if (r->type & PCI_BASE_ADDRESS_SPACE_IO) { - memory_region_add_subregion_overlap(r->address_space, - r->addr, - r->memory, - 1); - } else { - memory_region_add_subregion_overlap(r->address_space, - pci_to_cpu_addr(d->bus, - r->addr), - r->memory, - 1); + if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO)) { + new_addr = pci_to_cpu_addr(d->bus, new_addr); } + memory_region_add_subregion_overlap(r->address_space, + new_addr, r->memory, 1); } } } -- 1.7.5.3