Patchwork pci: simplify memory region registration

login
register
mail settings
Submitter Avi Kivity
Date Sept. 25, 2011, 1:22 p.m.
Message ID <1316956977-30466-1-git-send-email-avi@redhat.com>
Download mbox | patch
Permalink /patch/116294/
State New
Headers show

Comments

Avi Kivity - Sept. 25, 2011, 1:22 p.m.
The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are
identical.  Unify them.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/pci.c |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
Michael S. Tsirkin - Sept. 25, 2011, 1:30 p.m.
On Sun, Sep 25, 2011 at 04:22:57PM +0300, Avi Kivity wrote:
> The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are
> identical.  Unify them.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>

Applied, thanks

> ---
>  hw/pci.c |   13 ++-----------
>  1 files changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 749e8d8..e8cc1b0 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -998,17 +998,8 @@ static void pci_update_mappings(PCIDevice *d)
>          }
>          r->addr = new_addr;
>          if (r->addr != PCI_BAR_UNMAPPED) {
> -            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,
> -                                                    r->addr,
> -                                                    r->memory,
> -                                                    1);
> -            }
> +            memory_region_add_subregion_overlap(r->address_space,
> +                                                r->addr, r->memory, 1);
>          }
>      }
>  }
> -- 
> 1.7.6.3

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 749e8d8..e8cc1b0 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -998,17 +998,8 @@  static void pci_update_mappings(PCIDevice *d)
         }
         r->addr = new_addr;
         if (r->addr != PCI_BAR_UNMAPPED) {
-            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,
-                                                    r->addr,
-                                                    r->memory,
-                                                    1);
-            }
+            memory_region_add_subregion_overlap(r->address_space,
+                                                r->addr, r->memory, 1);
         }
     }
 }