Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb umb(4): Use usbd_do_request as drivers are inten...



details:   https://anonhg.NetBSD.org/src/rev/e60029e5e401
branches:  trunk
changeset: 369489:e60029e5e401
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 20 11:32:08 2022 +0000

description:
umb(4): Use usbd_do_request as drivers are intended to do.

diffstat:

 sys/dev/usb/if_umb.c |  13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diffs (46 lines):

diff -r b2edabe6c4f6 -r e60029e5e401 sys/dev/usb/if_umb.c
--- a/sys/dev/usb/if_umb.c      Sat Aug 20 11:31:38 2022 +0000
+++ b/sys/dev/usb/if_umb.c      Sat Aug 20 11:32:08 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_umb.c,v 1.24 2022/04/17 13:17:56 riastradh Exp $ */
+/*     $NetBSD: if_umb.c,v 1.25 2022/08/20 11:32:08 riastradh Exp $ */
 /*     $OpenBSD: if_umb.c,v 1.20 2018/09/10 17:00:45 gerhard Exp $ */
 
 /*
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.24 2022/04/17 13:17:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_umb.c,v 1.25 2022/08/20 11:32:08 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2061,18 +2061,11 @@
 Static usbd_status
 umb_send_encap_command(struct umb_softc *sc, void *data, int len)
 {
-       struct usbd_xfer *xfer;
        usb_device_request_t req;
-       char *buf;
 
        if (len > sc->sc_ctrl_len)
                return USBD_INVAL;
 
-       if (usbd_create_xfer(sc->sc_udev->ud_pipe0, len, 0, 0, &xfer) != 0)
-               return USBD_NOMEM;
-       buf = usbd_get_buffer(xfer);
-       memcpy(buf, data, len);
-
        /* XXX FIXME: if (total len > sc->sc_ctrl_len) => must fragment */
        req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
        req.bRequest = UCDC_SEND_ENCAPSULATED_COMMAND;
@@ -2080,7 +2073,7 @@
        USETW(req.wIndex, sc->sc_ctrl_ifaceno);
        USETW(req.wLength, len);
        DELAY(umb_delay);
-       return usbd_request_async(sc->sc_udev, xfer, &req, NULL, NULL);
+       return usbd_do_request(sc->sc_udev, &req, data);
 }
 
 Static int



Home | Main Index | Thread Index | Old Index