diff options
author | jhb <jhb@FreeBSD.org> | 2008-01-15 21:40:46 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-01-15 21:40:46 +0000 |
commit | 837d10831db91fb23919bf032d332ac1f5652b8d (patch) | |
tree | f3771353428d3015c75f497feef12f615eb877ea /sys/dev/pci/pci_user.c | |
parent | 0957a8f3c9fa6c7e136e9a27bf9226045545ae8f (diff) | |
download | FreeBSD-src-837d10831db91fb23919bf032d332ac1f5652b8d.zip FreeBSD-src-837d10831db91fb23919bf032d332ac1f5652b8d.tar.gz |
Don't cache the new-bus name of a PCI device in the PCI conf structure,
but reread it from the device_t every time the device list is fetched.
Previously the device name in pciconf -l would not be updated when a driver
was unloaded or if a device was detached and attached to a different
driver.
MFC after: 1 week
PR: kern/104777
Submitted by: "Iasen Kostoff" tbyte | otel net
Diffstat (limited to 'sys/dev/pci/pci_user.c')
-rw-r--r-- | sys/dev/pci/pci_user.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 0af05a9..b7ae55a 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -467,7 +467,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t /* Populate pd_name and pd_unit */ name = NULL; - if (dinfo->cfg.dev && dinfo->conf.pd_name[0] == '\0') + if (dinfo->cfg.dev) name = device_get_name(dinfo->cfg.dev); if (name) { strncpy(dinfo->conf.pd_name, name, @@ -475,6 +475,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t dinfo->conf.pd_name[PCI_MAXNAMELEN] = 0; dinfo->conf.pd_unit = device_get_unit(dinfo->cfg.dev); + } else { + dinfo->conf.pd_name[0] = '\0'; + dinfo->conf.pd_unit = 0; } #ifdef PRE7_COMPAT |