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): Omit needless lock/unlock cycle in usbd_...



details:   https://anonhg.NetBSD.org/src/rev/106b9302f6c2
branches:  trunk
changeset: 379620:106b9302f6c2
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Jun 12 13:57:51 2021 +0000

description:
usb(4): Omit needless lock/unlock cycle in usbd_pipe_close.

pipe->up_intrxfer is stable after construction, so no need to hold
the lock to check it.

diffstat:

 sys/dev/usb/usbdi.c |  12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diffs (34 lines):

diff -r c6867f042219 -r 106b9302f6c2 sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c       Sat Jun 12 13:57:40 2021 +0000
+++ b/sys/dev/usb/usbdi.c       Sat Jun 12 13:57:51 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbdi.c,v 1.205 2021/06/12 13:57:40 riastradh Exp $    */
+/*     $NetBSD: usbdi.c,v 1.206 2021/06/12 13:57:51 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.205 2021/06/12 13:57:40 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.206 2021/06/12 13:57:51 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -320,13 +320,9 @@ usbd_close_pipe(struct usbd_pipe *pipe)
 
        pipe->up_methods->upm_close(pipe);
 
-       if (pipe->up_intrxfer != NULL) {
-               usbd_unlock_pipe(pipe);
+       usbd_unlock_pipe(pipe);
+       if (pipe->up_intrxfer != NULL)
                usbd_destroy_xfer(pipe->up_intrxfer);
-               usbd_lock_pipe(pipe);
-       }
-
-       usbd_unlock_pipe(pipe);
        usb_rem_task_wait(pipe->up_dev, &pipe->up_async_task, USB_TASKQ_DRIVER,
            NULL);
        kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);



Home | Main Index | Thread Index | Old Index