From d36967bd2b32e8a790830e2fa45163729c7e8b00 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 23 Aug 2018 05:06:16 +0000 Subject: 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 --- sbin/devmatch/devmatch.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sbin') diff --git a/sbin/devmatch/devmatch.c b/sbin/devmatch/devmatch.c index a53cd5d81f827..9173270520a6c 100644 --- a/sbin/devmatch/devmatch.c +++ b/sbin/devmatch/devmatch.c @@ -422,6 +422,8 @@ find_unmatched(struct devinfo_dev *dev, void *arg) break; if (!(dev->dd_flags & DF_ENABLED)) break; + if (dev->dd_flags & DF_ATTACHED_ONCE) + break; parent = devinfo_handle_to_device(dev->dd_parent); bus = strdup(parent->dd_name); p = bus + strlen(bus) - 1; -- cgit v1.3