allow 2 successives calls to pci_system_init() and fix pci_system_cleanup()

to make it possible to call pci_system_init() again.
ok kettenis@.
This commit is contained in:
matthieu 2008-09-20 16:35:17 +00:00
parent 732bc8e6f9
commit 3f497bc04d

View File

@ -33,7 +33,7 @@
#include "pciaccess.h"
#include "pciaccess_private.h"
static int pcifd;
static int pcifd = -1;
static int aperturefd = -1;
static int
@ -216,6 +216,8 @@ pci_system_openbsd_destroy(void)
{
close(aperturefd);
close(pcifd);
aperturefd = -1;
pcifd = -1;
free(pci_sys);
pci_sys = NULL;
}
@ -318,6 +320,9 @@ pci_system_openbsd_create(void)
int bus, dev, func, ndevs, nfuncs;
uint32_t reg;
if (pcifd != -1)
return 0;
pcifd = open("/dev/pci", O_RDWR);
if (pcifd == -1)
return ENXIO;