summaryrefslogtreecommitdiffstats
path: root/cpukit/libpci
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2015-02-27 16:44:48 +0100
committerDaniel Hellstrom <daniel@gaisler.com>2015-04-17 01:10:26 +0200
commita2e0e6e59e4ac44b7495a215731dc0ea1c0f20e1 (patch)
tree18967e22fbfa096afe38aeeada312799426676d0 /cpukit/libpci
parentDRVMGR: updated copyright into one line only (diff)
downloadrtems-a2e0e6e59e4ac44b7495a215731dc0ea1c0f20e1.tar.bz2
LIBPCI: fixed RES2DEV in pci/cfg.h
Diffstat (limited to 'cpukit/libpci')
-rw-r--r--cpukit/libpci/pci/cfg.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/cpukit/libpci/pci/cfg.h b/cpukit/libpci/pci/cfg.h
index 18c48db5c2..8869a512af 100644
--- a/cpukit/libpci/pci/cfg.h
+++ b/cpukit/libpci/pci/cfg.h
@@ -146,9 +146,12 @@ struct pci_res {
uint32_t end;
};
-/* Get Device from resource pointer */
+/* Get Device from resource pointer. bar is the index of the pci_dev.resources
+ * array and used to get the device base address of which the resource is
+ * associated with.
+ */
#define RES2DEV(res) ((struct pci_dev *) \
- ((void *)res - (res->bar * (sizeof(struct pci_res)))))
+ ((uintptr_t)res - (uintptr_t)(res->bar * (sizeof(struct pci_res)))))
/* Device flags */
#define PCI_DEV_BRIDGE 0x01 /* Device is a Bridge (struct pci_bus) */