diff options
| author | riastradh <riastradh@NetBSD.org> | 2021-06-12 15:39:57 +0000 |
|---|---|---|
| committer | riastradh <riastradh@NetBSD.org> | 2021-06-12 15:39:57 +0000 |
| commit | dc96aed2be7fbe13bcfb2ee84cd626bb804df6c7 (patch) | |
| tree | f3bc428cf74511afe6bfdc02eb7375cb8f3cabcc /sys | |
| parent | 256677aa3e81235d4a1769ab3deac17c9c62d658 (diff) | |
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 (limited to 'sys')
| -rw-r--r-- | sys/dev/usb/usb_subr.c | 16 | ||||
| -rw-r--r-- | sys/dev/usb/usbdi.c | 12 |
2 files changed, 12 insertions, 16 deletions
diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 63d0388fbea..58c2e2649ed 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -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 @@ usbd_endpoint_release(struct usbd_device *dev, struct usbd_endpoint *ep) 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 --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index edb33f7e99a..2a0d53ca949 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -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_close_pipe(struct usbd_pipe *pipe) 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); |
