summaryrefslogtreecommitdiff
path: root/sys/dev/radio.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/radio.c')
-rw-r--r--sys/dev/radio.c56
1 files changed, 47 insertions, 9 deletions
diff --git a/sys/dev/radio.c b/sys/dev/radio.c
index 1b210f4d3bd..0a8cf222663 100644
--- a/sys/dev/radio.c
+++ b/sys/dev/radio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radio.c,v 1.3 2002/01/02 22:05:44 mickey Exp $ */
+/* $OpenBSD: radio.c,v 1.4 2002/01/05 02:23:03 mickey Exp $ */
/* $RuOBSD: radio.c,v 1.7 2001/12/04 06:03:05 tm Exp $ */
/*
@@ -34,21 +34,22 @@
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <sys/device.h>
+#include <sys/vnode.h>
#include <sys/radioio.h>
+#include <sys/conf.h>
#include <dev/radio_if.h>
#include <dev/radiovar.h>
int radioprobe(struct device *, void *, void *);
void radioattach(struct device *, struct device *, void *);
-int radioopen(dev_t, int, int, struct proc *);
-int radioclose(dev_t, int, int, struct proc *);
-int radioioctl(dev_t, u_long, caddr_t, int, struct proc *);
+int radiodetach(struct device *, int);
+int radioactivate(struct device *, enum devact);
int radioprint(void *, const char *);
struct cfattach radio_ca = {
sizeof(struct radio_softc), radioprobe, radioattach,
- NULL, NULL
+ radiodetach, radioactivate
};
struct cfdriver radio_cd = {
@@ -85,7 +86,7 @@ radioopen(dev_t dev, int flags, int fmt, struct proc *p)
if (unit >= radio_cd.cd_ndevs ||
(sc = radio_cd.cd_devs[unit]) == NULL ||
sc->hw_if == NULL)
- return (ENXIO);
+ return (ENXIO);
if (sc->hw_if->open != NULL)
return (sc->hw_if->open(sc->hw_hdl, flags, fmt, p));
@@ -94,7 +95,7 @@ radioopen(dev_t dev, int flags, int fmt, struct proc *p)
}
int
-radioclose(dev_t dev, int flags, int fmt, struct proc *p)
+radioclose(dev_t dev, int flags, int fmt, struct proc *p)
{
struct radio_softc *sc;
@@ -146,7 +147,7 @@ radioioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
* probed/attached to the hardware driver
*/
-struct device *
+struct device *
radio_attach_mi(struct radio_hw_if *rhwp, void *hdlp, struct device *dev)
{
struct radio_attach_args arg;
@@ -159,5 +160,42 @@ radio_attach_mi(struct radio_hw_if *rhwp, void *hdlp, struct device *dev)
int
radioprint(void *aux, const char *pnp)
{
- return UNCONF;
+ if (pnp != NULL)
+ printf("radio at %s", pnp);
+ return (UNCONF);
+}
+
+int
+radiodetach(struct device *self, int flags)
+{
+ /*struct radio_softc *sc = (struct radio_softc *)self;*/
+ int maj, mn;
+
+ /* locate the major number */
+ for (maj = 0; maj < nchrdev; maj++)
+ if (cdevsw[maj].d_open == radioopen)
+ break;
+
+ /* Nuke the vnodes for any open instances (calls close). */
+ mn = self->dv_unit;
+ vdevgone(maj, mn, mn, VCHR);
+
+ return (0);
+}
+
+int
+radioactivate(struct device *self, enum devact act)
+{
+ struct radio_softc *sc = (struct radio_softc *)self;
+
+ switch (act) {
+ case DVACT_ACTIVATE:
+ return (EOPNOTSUPP);
+ break;
+
+ case DVACT_DEACTIVATE:
+ sc->sc_dying = 1;
+ break;
+ }
+ return (0);
}