diff options
-rw-r--r-- | sys/dev/agp/agp.c | 13 | ||||
-rw-r--r-- | sys/pci/agp.c | 13 |
2 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/agp/agp.c b/sys/dev/agp/agp.c index ac9014f..3986589 100644 --- a/sys/dev/agp/agp.c +++ b/sys/dev/agp/agp.c @@ -830,9 +830,18 @@ agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) device_t agp_find_device() { + device_t *children; + int i, count; + if (!agp_devclass) - return 0; - return devclass_get_device(agp_devclass, 0); + return NULL; + if (devclass_get_devices(agp_devclass, &children, &count) != 0) + return NULL; + for (i = 0; i < count; i++) { + if (device_is_attached(children[i])) + return (children[i]); + } + return NULL; } enum agp_acquire_state diff --git a/sys/pci/agp.c b/sys/pci/agp.c index ac9014f..3986589 100644 --- a/sys/pci/agp.c +++ b/sys/pci/agp.c @@ -830,9 +830,18 @@ agp_mmap(struct cdev *kdev, vm_offset_t offset, vm_paddr_t *paddr, int prot) device_t agp_find_device() { + device_t *children; + int i, count; + if (!agp_devclass) - return 0; - return devclass_get_device(agp_devclass, 0); + return NULL; + if (devclass_get_devices(agp_devclass, &children, &count) != 0) + return NULL; + for (i = 0; i < count; i++) { + if (device_is_attached(children[i])) + return (children[i]); + } + return NULL; } enum agp_acquire_state |