summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Yurchenko <grange@cvs.openbsd.org>2004-11-23 21:18:38 +0000
committerAlexander Yurchenko <grange@cvs.openbsd.org>2004-11-23 21:18:38 +0000
commitdc1613f1f15bef319641dfc903da06dccbf34e41 (patch)
tree7a27c51dbb04d2559b749463624c801e68960786 /sys
parent2ddb009591c7614d76bc64f22494724fb3c019ea (diff)
Let gpio_detach() do something useful.
Tested by reyk@ on gpio@ath.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/gpio/gpio.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/gpio/gpio.c b/sys/dev/gpio/gpio.c
index 880beba48d2..fc4f6844696 100644
--- a/sys/dev/gpio/gpio.c
+++ b/sys/dev/gpio/gpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gpio.c,v 1.3 2004/11/22 15:37:42 reyk Exp $ */
+/* $OpenBSD: gpio.c,v 1.4 2004/11/23 21:18:37 grange Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@@ -25,6 +25,7 @@
#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/gpio.h>
+#include <sys/vnode.h>
#include <dev/gpio/gpiovar.h>
@@ -87,8 +88,19 @@ gpio_attach(struct device *parent, struct device *self, void *aux)
}
int
-gpio_detach(struct device *parent, int flags)
+gpio_detach(struct device *self, int flags)
{
+ int maj, mn;
+
+ /* Locate the major number */
+ for (maj = 0; maj < nchrdev; maj++)
+ if (cdevsw[maj].d_open == gpioopen)
+ break;
+
+ /* Nuke the vnodes for any open instances (calls close) */
+ mn = self->dv_unit;
+ vdevgone(maj, mn, mn, VCHR);
+
return (0);
}