diff options
author | Warner Losh <imp@FreeBSD.org> | 2018-08-23 05:06:16 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2018-08-23 05:06:16 +0000 |
commit | d36967bd2b32e8a790830e2fa45163729c7e8b00 (patch) | |
tree | dade753d78020f21048523a23de247fbe08aeaf3 /sys | |
parent | 84725a5fd073b115f45c507f3fef62a522bce466 (diff) | |
download | src-d36967bd2b32e8a790830e2fa45163729c7e8b00.tar.gz src-d36967bd2b32e8a790830e2fa45163729c7e8b00.zip |
Add a new device flag: DF_ATTACHED_ONCE
This flag is set once the device has been successfully attached. When
set, it inhibits devmatch from trying to match the device. This in
turn allows kldunload to work as expected. Prior to the change, the
driver would immediately reload because devmatch had no notion that
the driver had once been attached, and therefore shouldn't participate
in further matching.
Differential Revision: https://reviews.freebsd.org/D16735
Notes
Notes:
svn path=/head/; revision=338236
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_bus.c | 1 | ||||
-rw-r--r-- | sys/sys/bus.h | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 9d09d341ae1d..72bf63eb295c 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -2950,6 +2950,7 @@ device_attach(device_t dev) dev->state = DS_NOTPRESENT; return (error); } + dev->flags |= DF_ATTACHED_ONCE; attachtime = get_cyclecount() - attachtime; /* * 4 bits per device is a reasonable value for desktop and server diff --git a/sys/sys/bus.h b/sys/sys/bus.h index a96cfc6c8f72..e565002760d7 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -93,6 +93,7 @@ struct u_device { #define DF_REBID 0x80 /* Can rebid after attach */ #define DF_SUSPENDED 0x100 /* Device is suspended. */ #define DF_QUIET_CHILDREN 0x200 /* Default to quiet for all my children */ +#define DF_ATTACHED_ONCE 0x400 /* Has been attached at least once */ #define DF_NEEDNOMATCH 0x800 /* Has a pending NOMATCH event */ /** |