diff options
| author | Warner Losh <imp@FreeBSD.org> | 2019-11-23 23:43:52 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2019-11-23 23:43:52 +0000 |
| commit | dd615d09c47398666a7703b66a121ef7882d81a4 (patch) | |
| tree | 3de6276a75a62f61813343c0e333e0b51e49b102 /sys/dev/pci | |
| parent | 0ee420b6082c15bcb55765c0b15a72193991ce82 (diff) | |
Notes
Diffstat (limited to 'sys/dev/pci')
| -rw-r--r-- | sys/dev/pci/pci.c | 9 | ||||
| -rw-r--r-- | sys/dev/pci/pci_user.c | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index e9e86a46a413..9a8a87a11934 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -445,18 +445,21 @@ pci_find_bsf(uint8_t bus, uint8_t slot, uint8_t func) device_t pci_find_dbsf(uint32_t domain, uint8_t bus, uint8_t slot, uint8_t func) { - struct pci_devinfo *dinfo; + struct pci_devinfo *dinfo = NULL; + /* Giant because newbus is Giant locked revisit with newbus locking */ + mtx_lock(&Giant); STAILQ_FOREACH(dinfo, &pci_devq, pci_links) { if ((dinfo->cfg.domain == domain) && (dinfo->cfg.bus == bus) && (dinfo->cfg.slot == slot) && (dinfo->cfg.func == func)) { - return (dinfo->cfg.dev); + break; } } + mtx_unlock(&Giant); - return (NULL); + return (dinfo != NULL ? dinfo->cfg.dev : NULL); } /* Find a device_t by vendor/device ID */ diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 9e3842acf889..0052c0a6844e 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -119,7 +119,7 @@ static d_ioctl_t pci_ioctl; struct cdevsw pcicdev = { .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, + .d_flags = 0, .d_open = pci_open, .d_close = pci_close, .d_ioctl = pci_ioctl, |
