diff options
| author | isaki <isaki@NetBSD.org> | 2021-04-03 04:10:30 +0000 |
|---|---|---|
| committer | isaki <isaki@NetBSD.org> | 2021-04-03 04:10:30 +0000 |
| commit | 7a449eaf86d151bb89c3c0ae2cc7688a10808e07 (patch) | |
| tree | 76580c81037d520fe7209e0b0f52b3ff597e7721 /sys/dev/isa/spkr_pcppi.c | |
| parent | c195ab7ced8ca6e8f84813a47e8e4d5578e749c3 (diff) | |
Rework about the rest note in speaker(4).
- Obsolete the sc_rest callback. The rest note operation can be done by
the common spkr layer. This also fixes PR kern/56060.
This work-in-progress patch was left in my local tree for years. :(
- Improve calculations of tone and rest length.
Diffstat (limited to 'sys/dev/isa/spkr_pcppi.c')
| -rw-r--r-- | sys/dev/isa/spkr_pcppi.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/sys/dev/isa/spkr_pcppi.c b/sys/dev/isa/spkr_pcppi.c index 96af16d865e..aa0f6842813 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.12 2021/04/03 03:21:53 isaki Exp $ */ +/* $NetBSD: spkr_pcppi.c,v 1.13 2021/04/03 04:10:30 isaki 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.12 2021/04/03 03:21:53 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: spkr_pcppi.c,v 1.13 2021/04/03 04:10:30 isaki Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -79,8 +79,6 @@ CFATTACH_DECL3_NEW(spkr_pcppi, sizeof(struct spkr_pcppi_softc), spkr_pcppi_probe, spkr_pcppi_attach, spkr_pcppi_detach, NULL, spkr_pcppi_rescan, spkr_pcppi_childdet, 0); -#define SPKRPRI (PZERO - 1) - /* emit tone of frequency hz for given number of ticks */ static void spkr_pcppi_tone(device_t self, u_int xhz, u_int ticks) @@ -92,22 +90,6 @@ spkr_pcppi_tone(device_t self, u_int xhz, u_int ticks) (*sc->sc_bell_func)(sc->sc_pcppicookie, xhz, ticks, PCPPI_BELL_SLEEP); } -/* rest for given number of ticks */ -static void -spkr_pcppi_rest(device_t self, int ticks) -{ - /* - * Set timeout to endrest function, then give up the timeslice. - * This is so other processes can execute while the rest is being - * waited out. - */ -#ifdef SPKRDEBUG - aprint_debug_dev(self, "%s: %d\n", __func__, ticks); -#endif /* SPKRDEBUG */ - if (ticks > 0) - tsleep(self, SPKRPRI | PCATCH, device_xname(self), ticks); -} - static int spkr_pcppi_probe(device_t parent, cfdata_t cf, void *aux) { @@ -125,7 +107,7 @@ spkr_pcppi_attach(device_t parent, device_t self, void *aux) sc->sc_pcppicookie = pa->pa_cookie; sc->sc_bell_func = pa->pa_bell_func; - spkr_attach(self, spkr_pcppi_tone, spkr_pcppi_rest); + spkr_attach(self, spkr_pcppi_tone); if (!pmf_device_register(self, NULL, NULL)) aprint_error_dev(self, "couldn't establish power handler\n"); } |
