summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authormdodd <mdodd@FreeBSD.org>1999-12-03 08:41:24 +0000
committermdodd <mdodd@FreeBSD.org>1999-12-03 08:41:24 +0000
commit87e31f4b90cff07f3812e55d1980e47ac53a3904 (patch)
tree45f3bb4d1df765c421992403379a9575229036d0 /sys/kern/subr_bus.c
parentd7c9e9ad5f8564f402794c5a8175fffea1a5376e (diff)
downloadFreeBSD-src-87e31f4b90cff07f3812e55d1980e47ac53a3904.zip
FreeBSD-src-87e31f4b90cff07f3812e55d1980e47ac53a3904.tar.gz
Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered(). 'ivars' may now be set using the device_set_ivars() function. This makes it easier for us to change how arbitrary data structures are associated with a device_t. Eventually we won't be modifying device_t to add additional pointers for ivars, softc data etc. Despite my best efforts I've probably forgotten something so let me know if this breaks anything. I've been running with this change for months and its been quite involved actually isolating all the changes from the rest of the local changes in my tree. Reviewed by: peter, dfr
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index f144e60..b390b36 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -581,14 +581,12 @@ devclass_delete_device(devclass_t dc, device_t dev)
}
static device_t
-make_device(device_t parent, const char *name,
- int unit, void *ivars)
+make_device(device_t parent, const char *name, int unit)
{
device_t dev;
devclass_t dc;
- PDEBUG(("%s at %s as unit %d with%s ivars",
- name, DEVICENAME(parent), unit, (ivars? "":"out")));
+ PDEBUG(("%s at %s as unit %d", name, DEVICENAME(parent), unit));
if (name) {
dc = devclass_find_internal(name, TRUE);
@@ -622,7 +620,7 @@ make_device(device_t parent, const char *name,
dev->flags |= DF_FIXEDCLASS;
devclass_add_device(dc, dev);
}
- dev->ivars = ivars;
+ dev->ivars = NULL;
dev->softc = NULL;
dev->state = DS_NOTPRESENT;
@@ -644,22 +642,21 @@ device_print_child(device_t dev, device_t child)
}
device_t
-device_add_child(device_t dev, const char *name, int unit, void *ivars)
+device_add_child(device_t dev, const char *name, int unit)
{
- return device_add_child_ordered(dev, 0, name, unit, ivars);
+ return device_add_child_ordered(dev, 0, name, unit);
}
device_t
-device_add_child_ordered(device_t dev, int order,
- const char *name, int unit, void *ivars)
+device_add_child_ordered(device_t dev, int order, const char *name, int unit)
{
device_t child;
device_t place;
- PDEBUG(("%s at %s with order %d as unit %d with%s ivars",
- name, DEVICENAME(dev), order, unit, (ivars? "":"out")));
+ PDEBUG(("%s at %s with order %d as unit %d",
+ name, DEVICENAME(dev), order, unit));
- child = make_device(dev, name, unit, ivars);
+ child = make_device(dev, name, unit);
if (child == NULL)
return child;
child->order = order;
@@ -984,6 +981,17 @@ device_get_ivars(device_t dev)
return dev->ivars;
}
+void
+device_set_ivars(device_t dev, void * ivars)
+{
+ if (!dev)
+ return;
+
+ dev->ivars = ivars;
+
+ return;
+}
+
device_state_t
device_get_state(device_t dev)
{
OpenPOWER on IntegriCloud