Patchwork [13/15] usb-ohci: convert to pci_bar_map

login
register
mail settings
Submitter Blue Swirl
Date July 12, 2010, 6:42 p.m.
Message ID <AANLkTimuCQoGZSQEL0abUt3acdK9QRkB6WocTh_4c9ZQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/58648/
State New
Headers show

Comments

Blue Swirl - July 12, 2010, 6:42 p.m.
Use pci_bar_map() instead of a mapping function.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/usb-ohci.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

Patch

diff --git a/hw/usb-ohci.c b/hw/usb-ohci.c
index c60fd8d..992400e 100644
--- a/hw/usb-ohci.c
+++ b/hw/usb-ohci.c
@@ -1717,13 +1717,6 @@  typedef struct {
     OHCIState state;
 } OHCIPCIState;

-static void ohci_mapfunc(PCIDevice *pci_dev, int i,
-            pcibus_t addr, pcibus_t size, int type)
-{
-    OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, pci_dev);
-    cpu_register_physical_memory(addr, size, ohci->state.mem);
-}
-
 static int usb_ohci_initfn_pci(struct PCIDevice *dev)
 {
     OHCIPCIState *ohci = DO_UPCAST(OHCIPCIState, pci_dev, dev);
@@ -1742,7 +1735,8 @@  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, ohci_mapfunc);
+                     PCI_BASE_ADDRESS_SPACE_MEMORY, NULL);
+    pci_bar_map((struct PCIDevice *)ohci, 0, 0, 256, 0, ohci->state.mem);
     return 0;
 }