From a2e0e6e59e4ac44b7495a215731dc0ea1c0f20e1 Mon Sep 17 00:00:00 2001 From: Daniel Hellstrom Date: Fri, 27 Feb 2015 16:44:48 +0100 Subject: LIBPCI: fixed RES2DEV in pci/cfg.h --- cpukit/libpci/pci/cfg.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cpukit/libpci') 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) */ -- cgit v1.2.3