summaryrefslogtreecommitdiffstats
path: root/lib/libdevctl/devctl.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2016-09-30 22:05:47 +0000
committerjhb <jhb@FreeBSD.org>2016-09-30 22:05:47 +0000
commit0f41551ef9dde560d9d191d7190af02904dbf611 (patch)
tree00567e70252000c0a9f26250a859dfd20c8e1348 /lib/libdevctl/devctl.c
parentc03db820416e89f29bd1f5cb8f59a221d4d11463 (diff)
downloadFreeBSD-src-0f41551ef9dde560d9d191d7190af02904dbf611.zip
FreeBSD-src-0f41551ef9dde560d9d191d7190af02904dbf611.tar.gz
MFC 305034: Implement 'devctl clear driver' to undo a previous 'set driver'.
Add a new 'clear driver' command for devctl along with the accompanying ioctl and devctl_clear_driver() library routine to reset a device to use a wildcard devclass instead of a fixed devclass. This can be used to undo a previous 'set driver' command. After the device's name has been reset to permit wildcard names, it is reprobed so that it can attach to newly-available (to it) device drivers. Sponsored by: Chelsio Communications
Diffstat (limited to 'lib/libdevctl/devctl.c')
-rw-r--r--lib/libdevctl/devctl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libdevctl/devctl.c b/lib/libdevctl/devctl.c
index fa0e6a5..9e3b908 100644
--- a/lib/libdevctl/devctl.c
+++ b/lib/libdevctl/devctl.c
@@ -108,3 +108,11 @@ devctl_set_driver(const char *device, const char *driver, bool force)
req.dr_flags |= DEVF_SET_DRIVER_DETACH;
return (devctl_request(DEV_SET_DRIVER, &req));
}
+
+int
+devctl_clear_driver(const char *device, bool force)
+{
+
+ return (devctl_simple_request(DEV_CLEAR_DRIVER, device, force ?
+ DEVF_CLEAR_DRIVER_DETACH : 0));
+}
OpenPOWER on IntegriCloud