Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb usbnet: Omit needless tests in usbnet_tick.



details:   https://anonhg.NetBSD.org/src/rev/782752fcd4d0
branches:  trunk
changeset: 362503:782752fcd4d0
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:49:22 2022 +0000

description:
usbnet: Omit needless tests in usbnet_tick.

It's harmless for us to schedule the tick task even if unp_dying or
unp_stopping is set by now, because usbnet_stop will just wait for it
to finish anyway, and the callout can't be scheduled again until the
interface is done stopping and is brought back up again.

No need for unp == NULL test -- un->un_pri is initialized well before
this callout can be scheduled, and is nulled out only at the end of
usbnet_detach, at which point we have already halted this callout.

diffstat:

 sys/dev/usb/usbnet.c |  10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diffs (31 lines):

diff -r 052d5ff7d21b -r 782752fcd4d0 sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:14 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:49:22 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.63 2022/03/03 05:49:14 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.64 2022/03/03 05:49:22 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.63 2022/03/03 05:49:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.64 2022/03/03 05:49:22 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -1203,10 +1203,8 @@
 
        USBNETHIST_CALLARGSN(10, "%jd: enter", unp->unp_number, 0, 0, 0);
 
-       if (unp != NULL && !unp->unp_stopping && !unp->unp_dying) {
-               /* Perform periodic stuff in process context */
-               usb_add_task(un->un_udev, &unp->unp_ticktask, USB_TASKQ_DRIVER);
-       }
+       /* Perform periodic stuff in process context */
+       usb_add_task(un->un_udev, &unp->unp_ticktask, USB_TASKQ_DRIVER);
 }
 
 static void



Home | Main Index | Thread Index | Old Index