diff options
| author | pgoyette <pgoyette@NetBSD.org> | 2017-01-06 09:32:08 +0000 |
|---|---|---|
| committer | pgoyette <pgoyette@NetBSD.org> | 2017-01-06 09:32:08 +0000 |
| commit | bccce848e50e23364a2bd85bcf5c4e447ac1fc27 (patch) | |
| tree | 32ff9dd9f043b0b8faa4150f1109c44147a35d8d /sys/dev/isa | |
| parent | 9dda8d65f690864a32d372f5c13a0ef115661ad1 (diff) | |
Implement a common spkr_detach() function and call it from the
attachment-specific detach functions. Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated. The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().
Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.
Addresses my PR kern/51785
Diffstat (limited to 'sys/dev/isa')
| -rw-r--r-- | sys/dev/isa/spkr_pcppi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/isa/spkr_pcppi.c b/sys/dev/isa/spkr_pcppi.c index 27322f351bd..39e3c3ed8b3 100644 --- a/sys/dev/isa/spkr_pcppi.c +++ b/sys/dev/isa/spkr_pcppi.c @@ -1,4 +1,4 @@ -/* $NetBSD: spkr_pcppi.c,v 1.8 2016/12/15 06:48:14 pgoyette Exp $ */ +/* $NetBSD: spkr_pcppi.c,v 1.9 2017/01/06 09:32:08 pgoyette Exp $ */ /* * Copyright (c) 1990 Eric S. Raymond (esr@snark.thyrsus.com) @@ -43,7 +43,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.8 2016/12/15 06:48:14 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.9 2017/01/06 09:32:08 pgoyette Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -129,6 +129,10 @@ static int spkr_pcppi_detach(device_t self, int flags) { struct spkr_pcppi_softc *sc = device_private(self); + int error; + + if ((error = spkr_detach(self, flags)) != 0) + return error; sc->sc_pcppicookie = NULL; pmf_device_deregister(self); |
