summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-05-05 07:50:53 +0000
committerphk <phk@FreeBSD.org>2000-05-05 07:50:53 +0000
commit5a822df7a843606e7f89afca9e134cfbed60b058 (patch)
treeca7f5775602fb10522dbed9bad42a9690589256f /sys/dev/ppbus
parent3bb1877ba6cfcf0c5cf79c652fefcaa606e084e2 (diff)
downloadFreeBSD-src-5a822df7a843606e7f89afca9e134cfbed60b058.zip
FreeBSD-src-5a822df7a843606e7f89afca9e134cfbed60b058.tar.gz
Don't use getebuf() unless you really need a struct buf. Malloc will
do fine in this case.
Diffstat (limited to 'sys/dev/ppbus')
-rw-r--r--sys/dev/ppbus/lpt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c
index a7f8dd9..cf2a325 100644
--- a/sys/dev/ppbus/lpt.c
+++ b/sys/dev/ppbus/lpt.c
@@ -68,10 +68,10 @@
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/conf.h>
-#include <sys/buf.h>
#include <sys/kernel.h>
#include <sys/uio.h>
#include <sys/syslog.h>
+#include <sys/malloc.h>
#include <machine/clock.h>
#include <machine/bus.h>
@@ -86,6 +86,8 @@
#include "ppbus_if.h"
#include <dev/ppbus/ppbio.h>
+MALLOC_DEFINE(M_LPT, "lpt", "LPT buffers");
+
#ifndef LPT_DEBUG
#define lprintf(args)
#else
@@ -120,8 +122,8 @@ struct lpt_data {
#define LP_PRIMEOPEN 0x20 /* prime on every open */
#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */
#define LP_BYPASS 0x80 /* bypass printer ready checks */
- struct buf *sc_inbuf;
- struct buf *sc_statbuf;
+ void *sc_inbuf;
+ void *sc_statbuf;
short sc_xfercnt ;
char sc_primed;
char *sc_cp ;
@@ -551,8 +553,8 @@ lptopen(dev_t dev, int flags, int fmt, struct proc *p)
ppb_wctr(ppbus, sc->sc_control);
sc->sc_state = OPEN;
- sc->sc_inbuf = geteblk(BUFSIZE);
- sc->sc_statbuf = geteblk(BUFSTATSIZE);
+ sc->sc_inbuf = malloc(BUFSIZE, M_LPT, M_WAITOK);
+ sc->sc_statbuf = malloc(BUFSTATSIZE, M_LPT, M_WAITOK);
sc->sc_xfercnt = 0;
splx(s);
@@ -605,8 +607,8 @@ lptclose(dev_t dev, int flags, int fmt, struct proc *p)
break;
ppb_wctr(ppbus, LPC_NINIT);
- brelse(sc->sc_inbuf);
- brelse(sc->sc_statbuf);
+ free(sc->sc_inbuf, M_LPT);
+ free(sc->sc_statbuf, M_LPT);
end_close:
/* release the bus anyway
@@ -707,7 +709,7 @@ lptread(dev_t dev, struct uio *uio, int ioflag)
len = 0;
while (uio->uio_resid) {
if ((error = ppb_1284_read(ppbus, PPB_NIBBLE,
- sc->sc_statbuf->b_data, min(BUFSTATSIZE,
+ sc->sc_statbuf, min(BUFSTATSIZE,
uio->uio_resid), &len))) {
goto error;
}
@@ -715,7 +717,7 @@ lptread(dev_t dev, struct uio *uio, int ioflag)
if (!len)
goto error; /* no more data */
- if ((error = uiomove(sc->sc_statbuf->b_data, len, uio)))
+ if ((error = uiomove(sc->sc_statbuf, len, uio)))
goto error;
}
@@ -765,7 +767,7 @@ lptwrite(dev_t dev, struct uio *uio, int ioflag)
sc->sc_state &= ~INTERRUPTED;
while ((n = min(BUFSIZE, uio->uio_resid)) != 0) {
- sc->sc_cp = sc->sc_inbuf->b_data ;
+ sc->sc_cp = sc->sc_inbuf;
uiomove(sc->sc_cp, n, uio);
sc->sc_xfercnt = n ;
OpenPOWER on IntegriCloud