Index: subr_bus.c =================================================================== RCS file: /home/ncvs/src/sys/kern/subr_bus.c,v retrieving revision 1.207 diff -u -r1.207 subr_bus.c --- subr_bus.c 20 Mar 2008 21:24:32 -0000 1.207 +++ subr_bus.c 11 Apr 2008 04:47:13 -0000 @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -403,8 +404,10 @@ static int devopen(struct cdev *dev, int oflags, int devtype, d_thread_t *td) { +#if 0 if (devsoftc.inuse) return (EBUSY); +#endif /* move to init */ devsoftc.inuse = 1; devsoftc.nonblock = 0; @@ -479,6 +482,26 @@ devsoftc.async_proc = NULL; return (0); + case DEVIOC_SUSPEND: + case DEVIOC_RESUME: + { + devclass_t dc; + device_t dev; + struct device_ioctl *dio = (struct device_ioctl *)data; + int err; + + dc = devclass_find(dio->dio_devclass); + if (dc == NULL) + return (ENXIO); + dev = devclass_get_device(dc, dio->dio_unit); + if (dev == NULL) + return (ENXIO); + if (cmd == DEVIOC_SUSPEND) + err = BUS_SUSPEND_CHILD(device_get_parent(dev), dev); + else + err = BUS_RESUME_CHILD(device_get_parent(dev), dev); + return (err); + } /* (un)Support for other fcntl() calls. */ case FIOCLEX: case FIONCLEX: @@ -2352,7 +2375,7 @@ int device_probe_and_attach(device_t dev) { - int error; + int error, disable; GIANT_REQUIRED; @@ -2374,6 +2397,11 @@ } return (error); } + disable = 0; + resource_int_value(device_get_name(dev), device_get_unit(dev), + "disable", &disable); + if (disable) + return (0); error = device_attach(dev); return (error); @@ -2871,6 +2899,18 @@ } } +int +bus_generic_resume_child(device_t dev, device_t child) +{ + return DEVICE_RESUME(child); +} + +int +bus_generic_suspend_child(device_t dev, device_t child) +{ + return DEVICE_SUSPEND(child); +} + device_t bus_generic_add_child(device_t dev, int order, const char *name, int unit) {