summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-09-11 19:41:31 +0000
committerjhb <jhb@FreeBSD.org>2006-09-11 19:41:31 +0000
commit7be67f8a9364ca4407a48ee5c7af19164cc6a058 (patch)
tree8dede9a77a810fe11c00d0e49e437ddb74494ec2 /sys/kern/subr_bus.c
parent0b24ec1e7cefed500ff17d6182344e8365af41fc (diff)
downloadFreeBSD-src-7be67f8a9364ca4407a48ee5c7af19164cc6a058.zip
FreeBSD-src-7be67f8a9364ca4407a48ee5c7af19164cc6a058.tar.gz
Add a default method for BUS_ADD_CHILD() that just calls
device_add_child_ordered(). Previously, a device driver that wanted to add a new child device in its identify routine had to know if the parent driver had a custom bus_add_child method and use BUS_ADD_CHILD() in that case, otherwise use device_add_child(). Getting it wrong in either direction would result in panics or failure to add the child device. Now, BUS_ADD_CHILD() always works isolating child drivers from having to know intimate details about the parent driver. Discussed with: imp MFC after: 1 week
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 3f0a9e2..75b179d 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -2839,6 +2839,13 @@ resource_list_purge(struct resource_list *rl)
}
}
+device_t
+bus_generic_add_child(device_t dev, int order, const char *name, int unit)
+{
+
+ return (device_add_child_ordered(dev, order, name, unit));
+}
+
/**
* @brief Helper function for implementing DEVICE_PROBE()
*
OpenPOWER on IntegriCloud