Source-Changes-HG archive

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

[src/nick-nhusb]: src/sys/dev/usb Simplify usbd_do_request/usbd_setup_default...



details:   https://anonhg.NetBSD.org/src/rev/7fb91a914690
branches:  nick-nhusb
changeset: 334391:7fb91a914690
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Feb 07 15:50:43 2016 +0000

description:
Simplify usbd_do_request/usbd_setup_default_xfer.

G/C usbd_do_request_flags_pipe as it's not required

diffstat:

 sys/dev/usb/usbdi.c |  32 ++++++++++++--------------------
 sys/dev/usb/usbdi.h |   6 ++----
 2 files changed, 14 insertions(+), 24 deletions(-)

diffs (95 lines):

diff -r 6290f8a78d31 -r 7fb91a914690 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sun Feb 07 15:48:44 2016 +0000
+++ b/sys/dev/usb/usbdi.c       Sun Feb 07 15:50:43 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.162.2.41 2015/12/28 10:13:45 skrll Exp $   */
+/*     $NetBSD: usbdi.c,v 1.162.2.42 2016/02/07 15:50:43 skrll Exp $   */
 
 /*
  * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.41 2015/12/28 10:13:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.162.2.42 2016/02/07 15:50:43 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -572,7 +572,8 @@
     void *priv, uint32_t timeout, usb_device_request_t *req, void *buffer,
     uint32_t length, uint16_t flags, usbd_callback callback)
 {
-       xfer->ux_pipe = dev->ud_pipe0;
+       KASSERT(xfer->ux_pipe == dev->ud_pipe0);
+
        xfer->ux_priv = priv;
        xfer->ux_buffer = buffer;
        xfer->ux_length = length;
@@ -1075,28 +1076,19 @@
 usbd_status
 usbd_do_request(struct usbd_device *dev, usb_device_request_t *req, void *data)
 {
-       return (usbd_do_request_flags(dev, req, data, 0, 0,
-                                     USBD_DEFAULT_TIMEOUT));
+
+       return usbd_do_request_flags(dev, req, data, 0, 0,
+           USBD_DEFAULT_TIMEOUT);
 }
 
 usbd_status
 usbd_do_request_flags(struct usbd_device *dev, usb_device_request_t *req,
-                     void *data, uint16_t flags, int *actlen, uint32_t timo)
+    void *data, uint16_t flags, int *actlen, uint32_t timeout)
 {
-       return (usbd_do_request_flags_pipe(dev, dev->ud_pipe0, req,
-                                          data, flags, actlen, timo));
-}
-
-usbd_status
-usbd_do_request_flags_pipe(struct usbd_device *dev, struct usbd_pipe *pipe,
-       usb_device_request_t *req, void *data, uint16_t flags, int *actlen,
-       uint32_t timeout)
-{
+       USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
        struct usbd_xfer *xfer;
        usbd_status err;
 
-       USBHIST_FUNC(); USBHIST_CALLED(usbdebug);
-
        ASSERT_SLEEPABLE();
 
        size_t len = UGETW(req->wLength);
@@ -1104,9 +1096,9 @@
        if (error)
                return error;
 
-       usbd_setup_default_xfer(xfer, dev, 0, timeout, req,
-                               data, UGETW(req->wLength), flags, NULL);
-       xfer->ux_pipe = pipe;
+       usbd_setup_default_xfer(xfer, dev, 0, timeout, req, data,
+           UGETW(req->wLength), flags, NULL);
+       KASSERT(xfer->ux_pipe == dev->ud_pipe0);
        err = usbd_sync_transfer(xfer);
 #if defined(USB_DEBUG) || defined(DIAGNOSTIC)
        if (xfer->ux_actlen > xfer->ux_length) {
diff -r 6290f8a78d31 -r 7fb91a914690 sys/dev/usb/usbdi.h
--- a/sys/dev/usb/usbdi.h       Sun Feb 07 15:48:44 2016 +0000
+++ b/sys/dev/usb/usbdi.h       Sun Feb 07 15:50:43 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.h,v 1.90.4.10 2016/02/07 15:48:44 skrll Exp $    */
+/*     $NetBSD: usbdi.h,v 1.90.4.11 2016/02/07 15:50:44 skrll Exp $    */
 /*     $FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $      */
 
 /*
@@ -134,9 +134,7 @@
                                uint32_t, usbd_callback, int);
 usbd_status usbd_do_request(struct usbd_device *, usb_device_request_t *, void *);
 usbd_status usbd_do_request_flags(struct usbd_device *, usb_device_request_t *,
-                                 void *, uint16_t, int*, uint32_t);
-usbd_status usbd_do_request_flags_pipe(struct usbd_device *, struct usbd_pipe *,
-       usb_device_request_t *, void *, uint16_t, int *, uint32_t);
+    void *, uint16_t, int *, uint32_t);
 usb_interface_descriptor_t *usbd_get_interface_descriptor
                                (struct usbd_interface *);
 usb_config_descriptor_t *usbd_get_config_descriptor(struct usbd_device *);



Home | Main Index | Thread Index | Old Index