diff options
| author | augustss <augustss@NetBSD.org> | 2002-01-02 02:44:02 +0000 |
|---|---|---|
| committer | augustss <augustss@NetBSD.org> | 2002-01-02 02:44:02 +0000 |
| commit | 040f1e8c058bee86d7af0cf2e4af9b86e0e1b2ff (patch) | |
| tree | 538d09afdc6fe8a84df91c17ce65a3e7485c81c0 /sys/dev | |
| parent | a152e6e23ee7d755281b3eeea7d33cc333c34539 (diff) | |
Support detach.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/radio.c | 50 | ||||
| -rw-r--r-- | sys/dev/radiovar.h | 3 |
2 files changed, 49 insertions, 4 deletions
diff --git a/sys/dev/radio.c b/sys/dev/radio.c index e13bd308913..fa0dacd971d 100644 --- a/sys/dev/radio.c +++ b/sys/dev/radio.c @@ -1,4 +1,4 @@ -/* $NetBSD: radio.c,v 1.1 2002/01/01 21:51:38 augustss Exp $ */ +/* $NetBSD: radio.c,v 1.2 2002/01/02 02:44:02 augustss Exp $ */ /* $OpenBSD: radio.c,v 1.2 2001/12/05 10:27:06 mickey Exp $ */ /* $RuOBSD: radio.c,v 1.7 2001/12/04 06:03:05 tm Exp $ */ @@ -29,13 +29,18 @@ /* This is the /dev/radio driver from OpenBSD */ +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: radio.c,v 1.2 2002/01/02 02:44:02 augustss Exp $"); + #include <sys/param.h> #include <sys/systm.h> #include <sys/proc.h> #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> @@ -46,6 +51,8 @@ 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 radioprint(void *, const char *); +int radiodetach(struct device *, int); +int radioactivate(struct device *, enum devact); struct cfattach radio_ca = { sizeof(struct radio_softc), radioprobe, radioattach, @@ -144,7 +151,7 @@ radioioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) * Called from hardware driver. This is where the MI radio driver gets * 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; @@ -157,5 +164,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 eb431d714b5..d6c167e0979 100644 --- a/sys/dev/radiovar.h +++ b/sys/dev/radiovar.h @@ -1,4 +1,4 @@ -/* $NetBSD: radiovar.h,v 1.1 2002/01/01 21:51:39 augustss Exp $ */ +/* $NetBSD: radiovar.h,v 1.2 2002/01/02 02:44:03 augustss Exp $ */ /* $OpenBSD: radiovar.h,v 1.2 2001/12/05 10:27:06 mickey Exp $ */ /* $RuOBSD: radiovar.h,v 1.3 2001/09/29 17:10:16 pva Exp $ */ @@ -35,6 +35,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 */ |
