diff --git a/sys/dev/ppbus/lpt.c b/sys/dev/ppbus/lpt.c index a7f8dd97767..cf2a325ea1e 100644 --- a/sys/dev/ppbus/lpt.c +++ b/sys/dev/ppbus/lpt.c @@ -68,10 +68,10 @@ #include #include #include -#include #include #include #include +#include #include #include @@ -86,6 +86,8 @@ #include "ppbus_if.h" #include +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 ;