diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/radio.c | 56 | ||||
-rw-r--r-- | sys/dev/radiovar.h | 3 |
2 files changed, 49 insertions, 10 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); } diff --git a/sys/dev/radiovar.h b/sys/dev/radiovar.h index c1fb1b9a663..921f9ec400d 100644 --- a/sys/dev/radiovar.h +++ b/sys/dev/radiovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: radiovar.h,v 1.2 2001/12/05 10:27:06 mickey Exp $ */ +/* $OpenBSD: radiovar.h,v 1.3 2002/01/05 02:23:03 mickey Exp $ */ /* $RuOBSD: radiovar.h,v 1.3 2001/09/29 17:10:16 pva Exp $ */ /* @@ -34,6 +34,7 @@ struct radio_softc { void *hw_hdl; /* hardware driver handle */ struct device *sc_dev; /* hardware device struct */ struct radio_hw_if *hw_if; /* hardware interface */ + char sc_dying; /* device detached */ }; #endif /* _SYS_DEV_RADIOVAR_H */ |