aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authorMatthew N. Dodd <mdodd@FreeBSD.org>1999-12-03 08:41:24 +0000
committerMatthew N. Dodd <mdodd@FreeBSD.org>1999-12-03 08:41:24 +0000
commitfe0d408987b42b531420ff2de76d534dbe7ecee7 (patch)
tree6196b778a0e888c9c44157e090059018b00a3080 /sys/kern/subr_bus.c
parentb06e7af6ddadc3933a558d3e3ab7c76125611445 (diff)
downloadsrc-fe0d408987b42b531420ff2de76d534dbe7ecee7.tar.gz
src-fe0d408987b42b531420ff2de76d534dbe7ecee7.zip
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
Notes
Notes: svn path=/head/; revision=54073
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 f144e6028251..b390b36337f9 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)
{