summaryrefslogtreecommitdiffstats
path: root/cpukit/libpci/pci_cfg_read.c
diff options
context:
space:
mode:
authorDaniel Hellstrom <daniel@gaisler.com>2017-08-30 11:01:38 +0200
committerDaniel Hellstrom <daniel@gaisler.com>2017-09-29 13:36:44 +0200
commitf9fbb3336ff4e9044795e02b2847bbc1206674f5 (patch)
treed74bd69e94b597ea75e8b82e78d6950905219b4e /cpukit/libpci/pci_cfg_read.c
parentbsp/bf537Stamp: Fix warning (diff)
downloadrtems-f9fbb3336ff4e9044795e02b2847bbc1206674f5.tar.bz2
libpci: fix pci device allocation
The refactoring of pci_dev_create() was incorrect since the code relied on different defines before including pci/cfg.h. This reverts back to the original code having two pci_dev_create() one in auto and one in read library. confdefs.h selectes between the two libraries so both there is no link conflict. Updates #3029
Diffstat (limited to 'cpukit/libpci/pci_cfg_read.c')
-rw-r--r--cpukit/libpci/pci_cfg_read.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/cpukit/libpci/pci_cfg_read.c b/cpukit/libpci/pci_cfg_read.c
index 16c2928bab..07837431b0 100644
--- a/cpukit/libpci/pci_cfg_read.c
+++ b/cpukit/libpci/pci_cfg_read.c
@@ -36,6 +36,22 @@
/* The Host Bridge bus is initialized here */
extern struct pci_bus pci_hb;
+static struct pci_dev *pci_dev_create(int isbus)
+{
+ void *ptr;
+ int size;
+
+ if (isbus)
+ size = sizeof(struct pci_bus);
+ else
+ size = sizeof(struct pci_dev);
+
+ ptr = calloc(1, size);
+ if (!ptr)
+ rtems_fatal_error_occurred(RTEMS_NO_MEMORY);
+ return ptr;
+}
+
/* Check if address is accessible from host */
static int pci_read_addressable(struct pci_dev *dev, struct pci_res *res)
{