From 7be67f8a9364ca4407a48ee5c7af19164cc6a058 Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 11 Sep 2006 19:41:31 +0000 Subject: 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 --- sys/kern/subr_bus.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sys/kern/subr_bus.c') 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() * -- cgit v1.1