[PATCH 03/42] LIBPCI: fixed RES2DEV in pci/cfg.h
Daniel Hellstrom
daniel at gaisler.com
Tue Apr 14 11:32:30 UTC 2015
---
cpukit/libpci/pci/cfg.h | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cpukit/libpci/pci/cfg.h b/cpukit/libpci/pci/cfg.h
index 18c48db..8869a51 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) */
--
1.7.0.4
More information about the devel
mailing list