Module Name:    src
Committed By:   riastradh
Date:           Sat Jun 12 15:39:57 UTC 2021

Modified Files:
        src/sys/dev/usb: usb_subr.c usbdi.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.257 -r1.258 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.211 -r1.212 src/sys/dev/usb/usbdi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.257 src/sys/dev/usb/usb_subr.c:1.258
--- src/sys/dev/usb/usb_subr.c:1.257	Sat Jun 12 15:39:46 2021
+++ src/sys/dev/usb/usb_subr.c	Sat Jun 12 15:39:57 2021
@@ -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
 	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

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.211 src/sys/dev/usb/usbdi.c:1.212
--- src/sys/dev/usb/usbdi.c:1.211	Sat Jun 12 15:39:46 2021
+++ src/sys/dev/usb/usbdi.c	Sat Jun 12 15:39:57 2021
@@ -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);
 

Reply via email to