Patchwork [25/34] pci: remove now unused map_func parameter

login
register
mail settings
Submitter Blue Swirl
Date July 22, 2010, 10:01 p.m.
Message ID <AANLkTilmW9v3MsdYREIoRI0yrI97cJPOMS7gjvzehfW_@mail.gmail.com>
Download mbox | patch
Permalink /patch/59686/
State New
Headers show

Comments

Blue Swirl - July 22, 2010, 10:01 p.m.
The parameter map_func of pci_register_bar() is now completely unused
since all callers pass NULL.

Remove the unused parameter and all map_func handling. Adjust callers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/ac97.c         |    4 ++--
 hw/cirrus_vga.c   |    4 ++--
 hw/e1000.c        |    4 ++--
 hw/eepro100.c     |    6 +++---
 hw/es1370.c       |    2 +-
 hw/ide/cmd646.c   |   10 +++++-----
 hw/ide/piix.c     |    2 +-
 hw/ide/via.c      |    3 +--
 hw/lsi53c895a.c   |    6 +++---
 hw/macio.c        |    2 +-
 hw/ne2000.c       |    2 +-
 hw/openpic.c      |    2 +-
 hw/pci.c          |   36 ++++++++++++------------------------
 hw/pci.h          |    2 --
 hw/pcnet.c        |    4 ++--
 hw/rtl8139.c      |    5 ++---
 hw/sun4u.c        |    6 ++----
 hw/usb-ohci.c     |    2 +-
 hw/usb-uhci.c     |    2 +-
 hw/vga-pci.c      |    4 ++--
 hw/virtio-pci.c   |    4 ++--
 hw/vmware_vga.c   |    6 +++---
 hw/wdt_i6300esb.c |    3 +--
 23 files changed, 51 insertions(+), 70 deletions(-)

Patch

diff --git a/hw/ac97.c b/hw/ac97.c
index 2e5f02c..b1dcbc5 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1331,12 +1331,12 @@  static int ac97_initfn (PCIDevice *dev)
     /* TODO: RST# value should be 0. */
     c[PCI_INTERRUPT_PIN] = 0x01;      /* intr_pn interrupt pin ro */

-    pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO, NULL,
+    pci_register_bar (&s->dev, 0, 256 * 4, PCI_BASE_ADDRESS_SPACE_IO,
                       ac97_post_map);
     io_index = cpu_register_io (nam_reads, nam_writes, 256 * 4, s);
     pci_bar_map (&s->dev, 0, 0, 0, 256 * 4, io_index);

-    pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO, NULL,
+    pci_register_bar (&s->dev, 1, 64 * 4, PCI_BASE_ADDRESS_SPACE_IO,
                       ac97_post_map);
     io_index = cpu_register_io (nabm_reads, nabm_writes, 64 * 4, s);
     pci_bar_map (&s->dev, 1, 0, 0, 64 * 4, io_index);
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index a9ccb69..c682891 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -3190,14 +3190,14 @@  static int pci_cirrus_vga_initfn(PCIDevice *dev)
      /* memory #1 memory-mapped I/O */
      /* XXX: s->vga.vram_size must be a power of two */
      pci_register_bar((PCIDevice *)d, 0, 0x2000000,
-                      PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, cirrus_pci_lfb_map);
+                      PCI_BASE_ADDRESS_MEM_PREFETCH, cirrus_pci_lfb_map);
      pci_bar_map((PCIDevice *)d, 0, 0, 0, s->vga.vram_size,
                  s->cirrus_linear_io_addr);
      pci_bar_map((PCIDevice *)d, 0, 1, 0x1000000, 0x400000,
                  s->cirrus_linear_bitblt_io_addr);
      if (device_id == CIRRUS_ID_CLGD5446) {
          pci_register_bar((PCIDevice *)d, 1, CIRRUS_PNPMMIO_SIZE,
-                          PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                          PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
          pci_bar_map((PCIDevice *)d, 1, 0, 0, CIRRUS_PNPMMIO_SIZE,
                      s->cirrus_mmio_io_addr);
      }
diff --git a/hw/e1000.c b/hw/e1000.c
index d64fb79..200a69d 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1095,11 +1095,11 @@  static int pci_e1000_init(PCIDevice *pci_dev)
             e1000_mmio_write, d);

     pci_register_bar((PCIDevice *)d, 0, PNPMMIO_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, e1000_mmio_map);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, e1000_mmio_map);
     pci_bar_map((PCIDevice *)d, 0, 0, 0, PNPMMIO_SIZE, d->mmio_index);

     pci_register_bar((PCIDevice *)d, 1, IOPORT_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_IO, NULL);

     memmove(d->eeprom_data, e1000_eeprom_template,
         sizeof e1000_eeprom_template);
diff --git a/hw/eepro100.c b/hw/eepro100.c
index 747cb4c..0db4f8a 100644
--- a/hw/eepro100.c
+++ b/hw/eepro100.c
@@ -1862,17 +1862,17 @@  static int e100_nic_init(PCIDevice *pci_dev)
     /* Map control / status registers. */
     pci_register_bar(&s->dev, 0, PCI_MEM_SIZE,
                      PCI_BASE_ADDRESS_SPACE_MEMORY |
-                     PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, NULL);
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, NULL);
     pci_bar_map(&s->dev, 0, 0, 0, PCI_IO_SIZE, s->mmio_index);

     io_index = cpu_register_io(io_reads, io_writes, PCI_IO_SIZE, s);
-    pci_register_bar(&s->dev, 1, PCI_IO_SIZE, PCI_BASE_ADDRESS_SPACE_IO, NULL,
+    pci_register_bar(&s->dev, 1, PCI_IO_SIZE, PCI_BASE_ADDRESS_SPACE_IO,
                      pci_map);
     pci_bar_map(&s->dev, 1, 0, 0, PCI_IO_SIZE, io_index);

     /* Map flash. */
     pci_register_bar(&s->dev, 2, PCI_FLASH_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     pci_bar_map(&s->dev, 2, 0, 0, PCI_FLASH_SIZE, s->mmio_index);

     qemu_macaddr_default_if_unset(&s->conf.macaddr);
diff --git a/hw/es1370.c b/hw/es1370.c
index 3a870b4..a6f890e 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1018,7 +1018,7 @@  static int es1370_initfn (PCIDevice *dev)
     c[PCI_MIN_GNT] = 0x0c;
     c[PCI_MAX_LAT] = 0x80;

-    pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar (&s->dev, 0, 256, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io (es1370_reads, es1370_writes, 256, s);
     pci_bar_map (&s->dev, 0, 0, 0, 256, io_index);

diff --git a/hw/ide/cmd646.c b/hw/ide/cmd646.c
index ee1c7cb..ec080e0 100644
--- a/hw/ide/cmd646.c
+++ b/hw/ide/cmd646.c
@@ -255,19 +255,19 @@  static int pci_cmd646_ide_initfn(PCIDevice *dev)
         pci_conf[0x51] |= 0x08; /* enable IDE1 */
     }

-    pci_register_bar(dev, 0, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(dev, 0, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(ide_ioport_reads, ide_ioport_writes,
8, &d->bus[0]);
     pci_bar_map(&d->dev, 0, 0, 0, 8, io_index);
-    pci_register_bar(dev, 1, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(dev, 1, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(ide_status_reads, ide_cmd_writes, 1,
&d->bus[0]);
     pci_bar_map(&d->dev, 1, 0, 2, 1, io_index);
-    pci_register_bar(dev, 2, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(dev, 2, 8, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(ide_ioport_reads, ide_ioport_writes,
8, &d->bus[1]);
     pci_bar_map(&d->dev, 2, 0, 0, 8, io_index);
-    pci_register_bar(dev, 3, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(dev, 3, 4, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(ide_status_reads, ide_cmd_writes, 1,
&d->bus[1]);
     pci_bar_map(&d->dev, 3, 0, 2, 1, io_index);
-    pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/ide/piix.c b/hw/ide/piix.c
index c23fa5f..959e061 100644
--- a/hw/ide/piix.c
+++ b/hw/ide/piix.c
@@ -130,7 +130,7 @@  static int pci_piix_ide_initfn(PCIIDEState *d)

     qemu_register_reset(piix3_reset, d);

-    pci_register_bar(&d->dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(&d->dev, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/ide/via.c b/hw/ide/via.c
index 4adf1a0..36901b3 100644
--- a/hw/ide/via.c
+++ b/hw/ide/via.c
@@ -158,8 +158,7 @@  static int vt82c686b_ide_initfn(PCIDevice *dev)
     pci_set_long(pci_conf + PCI_CAPABILITY_LIST, 0x000000c0);

     qemu_register_reset(via_reset, d);
-    pci_register_bar((PCIDevice *)d, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL,
-                     NULL);
+    pci_register_bar((PCIDevice *)d, 4, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     for (i = 0; i < 2; i++) {
         BMDMAState *bm = &d->bmdma[i];

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index ed52db0..ed6c078 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -2166,15 +2166,15 @@  static int lsi_scsi_init(PCIDevice *dev)

     /* TODO: use dev and get rid of cast below */
     pci_register_bar((struct PCIDevice *)s, 0, 256, PCI_BASE_ADDRESS_SPACE_IO,
-                     NULL, NULL);
+                     NULL);
     io_index = cpu_register_io(lsi_io_reads, lsi_io_writes, 256, s);
     pci_bar_map((struct PCIDevice *)s, 0, 0, 0, 256, io_index);

     pci_register_bar((struct PCIDevice *)s, 1, 0x400,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     pci_bar_map((struct PCIDevice *)s, 1, 0, 0, 0x400, s->mmio_io_addr);
     pci_register_bar((struct PCIDevice *)s, 2, 0x2000,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, lsi_ram_mapfunc);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, lsi_ram_mapfunc);
     pci_bar_map((struct PCIDevice *)s, 2, 0, 0, 0x2000, s->ram_io_addr);
     QTAILQ_INIT(&s->queue);

diff --git a/hw/macio.c b/hw/macio.c
index f1e3625..8717bc0 100644
--- a/hw/macio.c
+++ b/hw/macio.c
@@ -46,7 +46,7 @@  void macio_init (PCIBus *bus, int device_id, int
is_oldworld, int pic_mem_index,

     d->config[0x3d] = 0x01; // interrupt on pin 1

-    pci_register_bar(d, 0, 0x80000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+    pci_register_bar(d, 0, 0x80000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     if (pic_mem_index >= 0) {
         if (is_oldworld) {
             /* Heathrow PIC */
diff --git a/hw/ne2000.c b/hw/ne2000.c
index 695b739..2b1e1ad 100644
--- a/hw/ne2000.c
+++ b/hw/ne2000.c
@@ -744,7 +744,7 @@  static int pci_ne2000_init(PCIDevice *pci_dev)
     pci_conf[PCI_INTERRUPT_PIN] = 1; // interrupt pin 0

     s = &d->ne2000;
-    pci_register_bar(&d->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(&d->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(ne2000_io_reads, ne2000_io_writes, 16, s);
     pci_bar_map(&d->dev, 0, 0, 0, 16, io_index);
     io_index = cpu_register_io(ne2000_asic_io_reads,
ne2000_asic_io_writes, 4, s);
diff --git a/hw/openpic.c b/hw/openpic.c
index 6b4140f..3f97afd 100644
--- a/hw/openpic.c
+++ b/hw/openpic.c
@@ -1170,7 +1170,7 @@  qemu_irq *openpic_init (PCIBus *bus, int
*pmem_index, int nb_cpus,

         /* Register I/O spaces */
         pci_register_bar((PCIDevice *)opp, 0, 0x40000,
-                         PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                         PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     } else {
         opp = qemu_mallocz(sizeof(openpic_t));
     }
diff --git a/hw/pci.c b/hw/pci.c
index 4ff7b79..1b20c44 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -789,7 +789,6 @@  static int pci_unregister_device(DeviceState *dev)

 void pci_register_bar(PCIDevice *pci_dev, int region_num,
                       pcibus_t size, int type,
-                      PCIMapIORegionFunc *map_func,
                       PCIMapIORegionFunc *post_map_func)
 {
     PCIIORegion *r;
@@ -809,7 +808,6 @@  void pci_register_bar(PCIDevice *pci_dev, int region_num,
     r->addr = PCI_BAR_UNMAPPED;
     r->size = size;
     r->type = type;
-    r->map_func = map_func;
     r->post_map_func = post_map_func;

     wmask = ~(size - 1);
@@ -1088,29 +1086,19 @@  static void pci_update_mappings(PCIDevice *d)
                  * addr & (size - 1) != 0.
                  */
                 if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
-                    if (r->map_func) {
-                        r->map_func(d, i, new_addr, s->filtered_size, r->type);
-                    } else {
-                        cpu_map_io(new_addr, s->ix);
-                        if (r->post_map_func) {
-                            r->post_map_func(d, i, new_addr, s->filtered_size,
-                                             r->type);
-                        }
+                    cpu_map_io(new_addr, s->ix);
+                    if (r->post_map_func) {
+                        r->post_map_func(d, i, new_addr, s->filtered_size,
+                                         r->type);
                     }
                 } else {
-                    if (r->map_func) {
-                        r->map_func(d, i, pci_to_cpu_addr(d->bus, new_addr),
-                                    s->filtered_size, r->type);
-                    } else {
-                        cpu_register_physical_memory(pci_to_cpu_addr(d->bus,
-                                                                     new_addr),
-                                                     s->filtered_size,
-                                                     s->ix);
-                        if (r->post_map_func) {
-                            r->post_map_func(d, i,
-                                             pci_to_cpu_addr(d->bus, new_addr),
-                                             s->filtered_size, r->type);
-                        }
+                    cpu_register_physical_memory(pci_to_cpu_addr(d->bus,
+                                                                 new_addr),
+                                                 s->filtered_size, s->ix);
+                    if (r->post_map_func) {
+                        r->post_map_func(d, i,
+                                         pci_to_cpu_addr(d->bus, new_addr),
+                                         s->filtered_size, r->type);
                     }
                 }
             }
@@ -1910,7 +1898,7 @@  static int pci_add_option_rom(PCIDevice *pdev)
     load_image(path, ptr);
     qemu_free(path);

-    pci_register_bar(pdev, PCI_ROM_SLOT, size, 0, NULL, NULL);
+    pci_register_bar(pdev, PCI_ROM_SLOT, size, 0, NULL);
     pci_bar_map(pdev, PCI_ROM_SLOT, 0, 0, size, pdev->rom_offset);

     return 0;
diff --git a/hw/pci.h b/hw/pci.h
index b1064d4..ac1836e 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -95,7 +95,6 @@  typedef struct PCIIORegion {
 #define PCI_BAR_UNMAPPED (~(pcibus_t)0)
     pcibus_t size;
     uint8_t type;
-    PCIMapIORegionFunc *map_func;
     PCIMapIORegionFunc *post_map_func;
     PCIIOSubRegion subregions[PCI_NUM_SUBREGIONS];
 } PCIIORegion;
@@ -191,7 +190,6 @@  PCIDevice *pci_register_device(PCIBus *bus, const
char *name,

 void pci_register_bar(PCIDevice *pci_dev, int region_num,
                       pcibus_t size, int type,
-                      PCIMapIORegionFunc *map_func,
                       PCIMapIORegionFunc *post_map_func);

 void pci_bar_map(PCIDevice *pci_dev, int region_num, int subregion_num,
diff --git a/hw/pcnet.c b/hw/pcnet.c
index e93cdff..49ff321 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -1991,14 +1991,14 @@  static int pci_pcnet_init(PCIDevice *pci_dev)
       cpu_register_io_memory(pcnet_mmio_read, pcnet_mmio_write, &d->state);

     pci_register_bar(pci_dev, 0, PCNET_IOPORT_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(pcnet_aprom_reads, pcnet_aprom_writes, 16, s);
     pci_bar_map(pci_dev, 0, 0, 0, 16, io_index);
     io_index = cpu_register_io(pcnet_ioport_reads, pcnet_ioport_writes, 16, s);
     pci_bar_map(pci_dev, 0, 1, 16, 16, io_index);

     pci_register_bar(pci_dev, 1, PCNET_PNPMMIO_SIZE,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     pci_bar_map((PCIDevice *)d, 1, 0, 0, PCNET_PNPMMIO_SIZE, s->mmio_index);

     s->irq = pci_dev->irq[0];
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index 31bc15e..bc20549 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3358,11 +3358,10 @@  static int pci_rtl8139_init(PCIDevice *dev)
     s->rtl8139_mmio_io_addr =
         cpu_register_io_memory(rtl8139_mmio_read, rtl8139_mmio_write, s);

-    pci_register_bar(&s->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(&s->dev, 0, 0x100, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(rtl8139_io_reads, rtl8139_io_writes, 0x100, s);
     pci_bar_map(&s->dev, 0, 0, 0, 0x100, io_index);
-    pci_register_bar(&s->dev, 1, 0x100, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
-                     NULL);
+    pci_register_bar(&s->dev, 1, 0x100, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     pci_bar_map(&s->dev, 1, 0, 0, 0x100, s->rtl8139_mmio_io_addr);

     qemu_macaddr_default_if_unset(&s->conf.macaddr);
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 1553cc3..8565243 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -550,13 +550,11 @@  pci_ebus_init1(PCIDevice *s)
     pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER);
     s->config[0x0D] = 0x0a; // latency_timer

-    pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
-                     NULL);
+    pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     io_index = pci_isa_mmio_init(1);
     pci_bar_map(s, 0, 0, 0, 0x1000000, io_index);

-    pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
-                     NULL);
+    pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     io_index = pci_isa_mmio_init(1);
     pci_bar_map(s, 1, 0, 0, 0x800000, io_index);

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index b09d276..992400e 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1735,7 +1735,7 @@  static int usb_ohci_initfn_pci(struct PCIDevice *dev)

     /* TODO: avoid cast below by using dev */
     pci_register_bar((struct PCIDevice *)ohci, 0, 256,
-                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL, NULL);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     pci_bar_map((struct PCIDevice *)ohci, 0, 0, 256, 0, ohci->state.mem);
     return 0;
 }
diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c
index 1129acd..2e1f5ee 100644
--- a/hw/usb-uhci.c
+++ b/hw/usb-uhci.c
@@ -1125,7 +1125,7 @@  static int usb_uhci_common_initfn(UHCIState *s)

     /* Use region 4 for consistency with real hardware.  BSD guests seem
        to rely on this.  */
-    pci_register_bar(&s->dev, 4, 0x20, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(&s->dev, 4, 0x20, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     io_index = cpu_register_io(uhci_io_reads, uhci_io_writes, 32, s);
     pci_bar_map(&s->dev, 4, 0, 0, 32, io_index);
     return 0;
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index c627a79..94e3ee0 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -91,7 +91,7 @@  static int pci_vga_initfn(PCIDevice *dev)

      /* XXX: VGA_RAM_SIZE must be a power of two */
      pci_register_bar(&d->dev, 0, VGA_RAM_SIZE, PCI_BASE_ADDRESS_MEM_PREFETCH,
-                      NULL, vga_map);
+                      vga_map);
      pci_bar_map(&d->dev, 0, 0, 0, s->vram_size, s->vram_offset);

      if (s->bios_size) {
@@ -101,7 +101,7 @@  static int pci_vga_initfn(PCIDevice *dev)
         while (bios_total_size < s->bios_size)
             bios_total_size <<= 1;
         pci_register_bar(&d->dev, PCI_ROM_SLOT, bios_total_size,
-                         PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, NULL);
+                         PCI_BASE_ADDRESS_MEM_PREFETCH, NULL);
         pci_bar_map(&d->dev, PCI_ROM_SLOT, 0, 0, s->bios_size, s->bios_offset);
      }

diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index 7e33932..7040108 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -527,7 +527,7 @@  static void virtio_init_pci(VirtIOPCIProxy *proxy,
VirtIODevice *vdev,
             pci_register_bar(&proxy->pci_dev, 1,
                              msix_bar_size(&proxy->pci_dev),
                              PCI_BASE_ADDRESS_SPACE_MEMORY,
-                             NULL, NULL);
+                             NULL);
             pci_bar_map(&proxy->pci_dev, 1, 0, 0,
                         msix_bar_size(&proxy->pci_dev), io_index);
         }
@@ -540,7 +540,7 @@  static void virtio_init_pci(VirtIOPCIProxy *proxy,
VirtIODevice *vdev,
         size = 1 << qemu_fls(size);

     pci_register_bar(&proxy->pci_dev, 0, size, PCI_BASE_ADDRESS_SPACE_IO,
-                     NULL, virtio_map);
+                     virtio_map);
     io_index = cpu_register_io(virtio_pci_config_io_reads,
                                virtio_pci_config_io_writes,
                                size, &proxy->pci_dev);
diff --git a/hw/vmware_vga.c b/hw/vmware_vga.c
index 1e2d174..a9ade91 100644
--- a/hw/vmware_vga.c
+++ b/hw/vmware_vga.c
@@ -1253,7 +1253,7 @@  static int pci_vmsvga_initfn(PCIDevice *dev)
     s->card.config[PCI_SUBSYSTEM_ID + 1] = SVGA_PCI_DEVICE_ID >> 8;
     s->card.config[PCI_INTERRUPT_LINE] = 0xff;		/* End */

-    pci_register_bar(&s->card, 0, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL, NULL);
+    pci_register_bar(&s->card, 0, 0x10, PCI_BASE_ADDRESS_SPACE_IO, NULL);
     iomemtype = cpu_register_io(vmsvga_index_io_reads, vmsvga_index_io_writes,
                                 4, &s->card);
     pci_bar_map(&s->card, 0, 0, SVGA_IO_MUL * SVGA_INDEX_PORT, 4, iomemtype);
@@ -1264,9 +1264,9 @@  static int pci_vmsvga_initfn(PCIDevice *dev)
                                 4, &s->card);
     pci_bar_map(&s->card, 0, 0, SVGA_IO_MUL * SVGA_BIOS_PORT, 4, iomemtype);
     pci_register_bar(&s->card, 1, VGA_RAM_SIZE,
-                     PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, pci_vmsvga_map_mem);
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_mem);
     pci_register_bar(&s->card, 2, SVGA_FIFO_SIZE,
-                     PCI_BASE_ADDRESS_MEM_PREFETCH, NULL, pci_vmsvga_map_fifo);
+                     PCI_BASE_ADDRESS_MEM_PREFETCH, pci_vmsvga_map_fifo);

     vmsvga_init(&s->chip, VGA_RAM_SIZE);

diff --git a/hw/wdt_i6300esb.c b/hw/wdt_i6300esb.c
index 400ff82..24409ec 100644
--- a/hw/wdt_i6300esb.c
+++ b/hw/wdt_i6300esb.c
@@ -401,8 +401,7 @@  static int i6300esb_init(PCIDevice *dev)
     pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_ESB_9);
     pci_config_set_class(pci_conf, PCI_CLASS_SYSTEM_OTHER);

-    pci_register_bar(&d->dev, 0, 0x10, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL,
-                     NULL);
+    pci_register_bar(&d->dev, 0, 0x10, PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
     io_mem = cpu_register_io_memory(mem_read, mem_write, d);
     pci_bar_map(&d->dev, 0, 0, 0, 0x10, io_mem);