aboutsummaryrefslogtreecommitdiff
path: root/sys/i386/isa/spkr.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2000-05-05 09:05:39 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2000-05-05 09:05:39 +0000
commite4961fbf07532ac66ec1c8f88fa71c308a49d2a4 (patch)
tree3da40ec2c755476d4665f5ffb68ba25e56c22e3b /sys/i386/isa/spkr.c
parent8172e29086d50c35783cb8d6ac4a55c0f328eb0f (diff)
downloadsrc-e4961fbf07532ac66ec1c8f88fa71c308a49d2a4.tar.gz
src-e4961fbf07532ac66ec1c8f88fa71c308a49d2a4.zip
Don't use struct buf for random small temporary buffers.
Notes
Notes: svn path=/head/; revision=60038
Diffstat (limited to 'sys/i386/isa/spkr.c')
-rw-r--r--sys/i386/isa/spkr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/i386/isa/spkr.c b/sys/i386/isa/spkr.c
index 8f4b8aadcb35..0f7ed61ceee6 100644
--- a/sys/i386/isa/spkr.c
+++ b/sys/i386/isa/spkr.c
@@ -10,10 +10,10 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/ctype.h>
+#include <sys/malloc.h>
#include <i386/isa/isa.h>
#include <i386/isa/timerreg.h>
#include <machine/clock.h>
@@ -42,6 +42,8 @@ static struct cdevsw spkr_cdevsw = {
/* bmaj */ -1
};
+MALLOC_DEFINE(M_SPKR, "spkr", "Speaker buffer");
+
/**************** MACHINE DEPENDENT PART STARTS HERE *************************
*
* This section defines a function tone() which causes a tone of given
@@ -453,7 +455,7 @@ playstring(cp, slen)
*/
static int spkr_active = FALSE; /* exclusion flag */
-static struct buf *spkr_inbuf; /* incoming buf */
+static char *spkr_inbuf; /* incoming buf */
int
spkropen(dev, flags, fmt, p)
@@ -476,7 +478,7 @@ spkropen(dev, flags, fmt, p)
(void) printf("spkropen: about to perform play initialization\n");
#endif /* DEBUG */
playinit();
- spkr_inbuf = geteblk(DEV_BSIZE);
+ spkr_inbuf = malloc(DEV_BSIZE, M_SPKR, M_WAITOK);
spkr_active = TRUE;
return(0);
}
@@ -504,7 +506,7 @@ spkrwrite(dev, uio, ioflag)
int error;
n = uio->uio_resid;
- cp = spkr_inbuf->b_data;
+ cp = spkr_inbuf;
error = uiomove(cp, n, uio);
if (!error) {
cp[n] = '\0';
@@ -531,7 +533,7 @@ spkrclose(dev, flags, fmt, p)
{
wakeup((caddr_t)&endtone);
wakeup((caddr_t)&endrest);
- brelse(spkr_inbuf);
+ free(spkr_inbuf, M_SPKR);
spkr_active = FALSE;
return(0);
}