Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_bus.c
Show First 20 Lines • Show All 5,197 Lines • ▼ Show 20 Lines | devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, | ||||
switch (cmd) { | switch (cmd) { | ||||
case DEV_ATTACH: | case DEV_ATTACH: | ||||
case DEV_DETACH: | case DEV_DETACH: | ||||
case DEV_ENABLE: | case DEV_ENABLE: | ||||
case DEV_DISABLE: | case DEV_DISABLE: | ||||
case DEV_SUSPEND: | case DEV_SUSPEND: | ||||
case DEV_RESUME: | case DEV_RESUME: | ||||
case DEV_SET_DRIVER: | case DEV_SET_DRIVER: | ||||
case DEV_RESCAN: | |||||
error = priv_check(td, PRIV_DRIVER); | error = priv_check(td, PRIV_DRIVER); | ||||
if (error == 0) | if (error == 0) | ||||
error = find_device(req, &dev); | error = find_device(req, &dev); | ||||
break; | break; | ||||
default: | default: | ||||
error = ENOTTY; | error = ENOTTY; | ||||
break; | break; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | case DEV_SET_DRIVER: { | ||||
/* Force the new device class. */ | /* Force the new device class. */ | ||||
error = devclass_add_device(dc, dev); | error = devclass_add_device(dc, dev); | ||||
if (error) | if (error) | ||||
break; | break; | ||||
dev->flags |= DF_FIXEDCLASS; | dev->flags |= DF_FIXEDCLASS; | ||||
error = device_probe_and_attach(dev); | error = device_probe_and_attach(dev); | ||||
break; | break; | ||||
} | } | ||||
case DEV_RESCAN: | |||||
if (!device_is_attached(dev)) { | |||||
error = ENXIO; | |||||
break; | |||||
} | |||||
error = BUS_RESCAN(dev); | |||||
break; | |||||
} | } | ||||
mtx_unlock(&Giant); | mtx_unlock(&Giant); | ||||
return (error); | return (error); | ||||
} | } | ||||
static struct cdevsw devctl2_cdevsw = { | static struct cdevsw devctl2_cdevsw = { | ||||
.d_version = D_VERSION, | .d_version = D_VERSION, | ||||
.d_ioctl = devctl2_ioctl, | .d_ioctl = devctl2_ioctl, | ||||
Show All 10 Lines |