Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Pre-allocate the DMA buffer. This makes the dri...



details:   https://anonhg.NetBSD.org/src/rev/28b28e52ccc1
branches:  trunk
changeset: 476267:28b28e52ccc1
user:      augustss <augustss%NetBSD.org@localhost>
date:      Sat Sep 11 10:40:07 1999 +0000

description:
Pre-allocate the DMA buffer.  This makes the driver slightly more efficient.

diffstat:

 sys/dev/usb/ulpt.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r d6815a68ad62 -r 28b28e52ccc1 sys/dev/usb/ulpt.c
--- a/sys/dev/usb/ulpt.c        Sat Sep 11 08:19:26 1999 +0000
+++ b/sys/dev/usb/ulpt.c        Sat Sep 11 10:40:07 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ulpt.c,v 1.22 1999/09/10 19:28:26 augustss Exp $       */
+/*     $NetBSD: ulpt.c,v 1.23 1999/09/11 10:40:07 augustss Exp $       */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -424,7 +424,7 @@
 {
        u_int32_t n;
        int error = 0;
-       char buf[ULPT_BSIZE];
+       void *bufp;
        usbd_request_handle reqh;
        usbd_status r;
 
@@ -432,9 +432,14 @@
        reqh = usbd_alloc_request(sc->sc_udev);
        if (reqh == 0)
                return (ENOMEM);
+       bufp = usbd_alloc_buffer(reqh, ULPT_BSIZE);
+       if (bufp == 0) {
+               usbd_free_request(reqh);
+               return (ENOMEM);
+       }
        while ((n = min(ULPT_BSIZE, uio->uio_resid)) != 0) {
                ulpt_statusmsg(ulpt_status(sc), sc);
-               error = uiomove(buf, n, uio);
+               error = uiomove(bufp, n, uio);
                if (error)
                        break;
                DPRINTFN(1, ("ulptwrite: transfer %d bytes\n", n));



Home | Main Index | Thread Index | Old Index