The pmf_device_register go appearing in most drivers is what is
responsible for whitelisting drivers.

So something like this might do.

Index: device-mapper.c
===================================================================
RCS file: /cvsroot/src/sys/dev/dm/device-mapper.c,v
retrieving revision 1.59
diff -u -r1.59 device-mapper.c
--- device-mapper.c     22 Dec 2019 13:16:09 -0000      1.59
+++ device-mapper.c     14 Jan 2020 06:13:17 -0000
@@ -245,6 +245,8 @@
 static void
 dm_attach(device_t parent, device_t self, void *aux)
 {
+       if (!pmf_device_register(self, NULL, NULL))
+               aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 /*
@@ -259,6 +261,8 @@
 {
        dm_dev_t *dmv;
 
+       pmf_device_deregister(self);
+
        /* Detach device from global device list */
        if ((dmv = dm_dev_detach(self)) == NULL)
                return ENOENT;

Reply via email to