summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Knudsen <mk@cvs.openbsd.org>2006-05-27 23:51:28 +0000
committerMichael Knudsen <mk@cvs.openbsd.org>2006-05-27 23:51:28 +0000
commit7deda7c136c56bb225688967b1a047a2e1bf42bf (patch)
tree1f155f1d6f91b3be0829f71ae8b6bdbb0ef889f8
parentce2d315383abb67fd6de726e5022d53688bd28b0 (diff)
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 */
};
/*