aboutsummaryrefslogtreecommitdiff
path: root/sys/pci
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2005-12-20 21:06:43 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2005-12-20 21:06:43 +0000
commitc8d81a41f4b3b70b94025bfda26871f0dbdf0919 (patch)
tree0c41a839202b330b4b120a7b29390a8b8114d82b /sys/pci
parentb861e5bd4363076c6d8a6d06d161623c8903fdff (diff)
Notes
Diffstat (limited to 'sys/pci')
-rw-r--r--sys/pci/agp.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/pci/agp.c b/sys/pci/agp.c
index ac9014f6c28f..3986589e536d 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