summaryrefslogtreecommitdiffstats
path: root/cpukit/libpci
diff options
context:
space:
mode:
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) */