[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/20] pci: remove goto in pci_bridge_filter().
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 20/20] pci: remove goto in pci_bridge_filter(). |
Date: |
Thu, 12 Nov 2009 14:58:48 +0900 |
This patch removes ugly goto in pci_bridge_filter() by
introducing subfunction, pci_bridge_filter_nomap().
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index add919b..90bdf5e 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -691,6 +691,12 @@ static pcibus_t pci_bridge_get_limit(PCIDevice *bridge,
uint8_t type)
return limit;
}
+static void pci_bridge_filter_nomap(pcibus_t *addr, pcibus_t *size)
+{
+ *addr = PCI_BAR_UNMAPPED;
+ *size = 0;
+}
+
static void pci_bridge_filter(PCIDevice *d, pcibus_t *addr, pcibus_t *size,
uint8_t type)
{
@@ -703,11 +709,13 @@ static void pci_bridge_filter(PCIDevice *d, pcibus_t
*addr, pcibus_t *size,
if (type & PCI_BASE_ADDRESS_SPACE_IO) {
if (!(cmd & PCI_COMMAND_IO)) {
- goto no_map;
+ pci_bridge_filter_nomap(addr, size);
+ return;
}
} else {
if (!(cmd & PCI_COMMAND_MEMORY)) {
- goto no_map;
+ pci_bridge_filter_nomap(addr, size);
+ return;
}
}
@@ -716,9 +724,7 @@ static void pci_bridge_filter(PCIDevice *d, pcibus_t *addr,
pcibus_t *size,
}
if (base > limit) {
- no_map:
- *addr = PCI_BAR_UNMAPPED;
- *size = 0;
+ pci_bridge_filter_nomap(addr, size);
} else {
*addr = base;
*size = limit - base + 1;
--
1.6.0.2
- [Qemu-devel] Re: [PATCH 16/20] pci: kill goto in pci_update_mappings(), (continued)
- [Qemu-devel] [PATCH 14/20] pci: remove unused constants., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 19/20] pci: pci bridge related clean up., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 13/20] pci: move typedef, PCIHostState, PCIExpressHost to qemu-common.h., Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 20/20] pci: remove goto in pci_bridge_filter().,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 17/20] pci: remove magic number, 256 in pci.c, Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 10/20] pci: kill unnecessary included in pci.c, Isaku Yamahata, 2009/11/12
- [Qemu-devel] [PATCH 04/20] pci: remove pci_addr_to_config() by open code, Isaku Yamahata, 2009/11/12
- [Qemu-devel] Re: [PATCH 00/20] PCI express clean up patches., Michael S. Tsirkin, 2009/11/12