Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb usb(4): Merge logic in usbd_kill_pipe and usbd_c...



details:   https://anonhg.NetBSD.org/src/rev/5df9b8947744
branches:  trunk
changeset: 1021657:5df9b8947744
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 12 15:39:57 2021 +0000

description:
usb(4): Merge logic in usbd_kill_pipe and usbd_close_pipe.

usbd_kill_pipe is now just usbd_abort/close_pipe.

No functional change intended.

diffstat:

 sys/dev/usb/usb_subr.c |  16 +++++-----------
 sys/dev/usb/usbdi.c    |  12 +++++++-----
 2 files changed, 12 insertions(+), 16 deletions(-)

diffs (74 lines):

diff -r e9db62daae45 -r 5df9b8947744 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c    Sat Jun 12 15:39:46 2021 +0000
+++ b/sys/dev/usb/usb_subr.c    Sat Jun 12 15:39:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb_subr.c,v 1.257 2021/06/12 15:39:46 riastradh Exp $ */
+/*     $NetBSD: usb_subr.c,v 1.258 2021/06/12 15:39:57 riastradh Exp $ */
 /*     $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $   */
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.257 2021/06/12 15:39:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.258 2021/06/12 15:39:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -900,19 +900,13 @@
        mutex_exit(dev->ud_bus->ub_lock);
 }
 
-/* Abort the device control pipe. */
+/* Abort and close the device control pipe. */
 void
 usbd_kill_pipe(struct usbd_pipe *pipe)
 {
+
        usbd_abort_pipe(pipe);
-       usbd_lock_pipe(pipe);
-       pipe->up_methods->upm_close(pipe);
-       usbd_unlock_pipe(pipe);
-       usb_rem_task_wait(pipe->up_dev, &pipe->up_async_task, USB_TASKQ_DRIVER,
-           NULL);
-       KASSERT(pipe->up_iface == NULL);
-       usbd_endpoint_release(pipe->up_dev, pipe->up_endpoint);
-       kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
+       usbd_close_pipe(pipe);
 }
 
 int
diff -r e9db62daae45 -r 5df9b8947744 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sat Jun 12 15:39:46 2021 +0000
+++ b/sys/dev/usb/usbdi.c       Sat Jun 12 15:39:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.211 2021/06/12 15:39:46 riastradh Exp $    */
+/*     $NetBSD: usbdi.c,v 1.212 2021/06/12 15:39:57 riastradh 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.211 2021/06/12 15:39:46 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.212 2021/06/12 15:39:57 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -319,9 +319,11 @@
                usbd_destroy_xfer(pipe->up_intrxfer);
        usb_rem_task_wait(pipe->up_dev, &pipe->up_async_task, USB_TASKQ_DRIVER,
            NULL);
-       mutex_enter(&pipe->up_iface->ui_pipelock);
-       LIST_REMOVE(pipe, up_next);
-       mutex_exit(&pipe->up_iface->ui_pipelock);
+       if (pipe->up_iface) {
+               mutex_enter(&pipe->up_iface->ui_pipelock);
+               LIST_REMOVE(pipe, up_next);
+               mutex_exit(&pipe->up_iface->ui_pipelock);
+       }
        usbd_endpoint_release(pipe->up_dev, pipe->up_endpoint);
        kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);
 



Home | Main Index | Thread Index | Old Index