summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormk <mk@openbsd.org>2006-05-27 23:51:27 +0000
committermk <mk@openbsd.org>2006-05-27 23:51:27 +0000
commitbb73aa1fdb99f9c13dafd6c05444e4da51333f7e (patch)
treebf463c46ec4b85468e23a11a0a46fb8f5f9b896c
parentDocument net.inet6.ip6.mforwarding (diff)
downloadwireguard-openbsd-bb73aa1fdb99f9c13dafd6c05444e4da51333f7e.tar.xz
wireguard-openbsd-bb73aa1fdb99f9c13dafd6c05444e4da51333f7e.zip
Make sensor add/remove create hotplug events (after much prodding from henning). Idea from mbalmer. 'in it goes!' deraadt.
-rw-r--r--sys/kern/kern_sensors.c11
-rw-r--r--sys/sys/device.h5
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c
index c5ef25b1af7..f2497895d25 100644
--- a/sys/kern/kern_sensors.c
+++ b/sys/kern/kern_sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sensors.c,v 1.8 2006/03/12 13:48:32 dlg Exp $ */
+/* $OpenBSD: kern_sensors.c,v 1.9 2006/05/27 23:51:27 mk Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -26,6 +26,7 @@
#include <sys/time.h>
#include <sys/sensors.h>
+#include "hotplug.h"
int sensors_count = 0;
SLIST_HEAD(, sensor) sensors_list = SLIST_HEAD_INITIALIZER(&sensors_list);
@@ -66,6 +67,10 @@ sensor_add(struct sensor *sens)
}
sensors_count++;
splx(s);
+
+#if NHOTPLUG > 0
+ hotplug_device_attach(DV_SENSOR, sens->device);
+#endif
}
void
@@ -77,6 +82,10 @@ sensor_del(struct sensor *sens)
sensors_count--;
SLIST_REMOVE(&sensors_list, sens, sensor, list);
splx(s);
+
+#if NHOTPLUG > 0
+ hotplug_device_detach(DV_SENSOR, sens->device);
+#endif
}
struct sensor *
diff --git a/sys/sys/device.h b/sys/sys/device.h
index b6bf69dd47e..04352faaf2e 100644
--- a/sys/sys/device.h
+++ b/sys/sys/device.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: device.h,v 1.30 2006/01/21 12:20:53 miod Exp $ */
+/* $OpenBSD: device.h,v 1.31 2006/05/27 23:51:27 mk Exp $ */
/* $NetBSD: device.h,v 1.15 1996/04/09 20:55:24 cgd Exp $ */
/*
@@ -56,7 +56,8 @@ enum devclass {
DV_DISK, /* disk drive (label, etc) */
DV_IFNET, /* network interface */
DV_TAPE, /* tape device */
- DV_TTY /* serial line interface (???) */
+ DV_TTY, /* serial line interface (???) */
+ DV_SENSOR /* sensor stuff */
};
/*