Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb fix two issues, found by maya@ while testing urn...



details:   https://anonhg.NetBSD.org/src/rev/2ee305cdeebe
branches:  trunk
changeset: 964537:2ee305cdeebe
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Aug 07 01:47:18 2019 +0000

description:
fix two issues, found by maya@ while testing urndis:
- avoid an KASSERT() in usbnet_rx_tx_init() when called early
- move the pmf and usb driver event calls out of the mii specific code,
  now suspend is able to work on them again.

urndis port to usbnet works with additional ipv6 lossage that
may indicate it doesn't work (not commited yet.)

diffstat:

 sys/dev/usb/usbnet.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (51 lines):

diff -r 3ea3d6aa9069 -r 2ee305cdeebe sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Wed Aug 07 01:09:49 2019 +0000
+++ b/sys/dev/usb/usbnet.c      Wed Aug 07 01:47:18 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.7 2019/08/07 00:38:02 pgoyette Exp $      */
+/*     $NetBSD: usbnet.c,v 1.8 2019/08/07 01:47:18 mrg Exp $   */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.7 2019/08/07 00:38:02 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.8 2019/08/07 01:47:18 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -633,7 +633,7 @@
        usbnet_rx_start_pipes(un, usbnet_rxeof);
 
        /* Indicate we are up and running. */
-       KASSERT(IFNET_LOCKED(ifp));
+       KASSERT(ifp->if_softc == NULL || IFNET_LOCKED(ifp));
        ifp->if_flags |= IFF_RUNNING;
 
        callout_schedule(&un->un_stat_ch, hz);
@@ -1055,11 +1055,6 @@
                ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_NONE);
        } else
                ifmedia_set(&mii->mii_media, IFM_ETHER | IFM_AUTO);
-
-       usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, un->un_udev, un->un_dev);
-
-       if (!pmf_device_register(un->un_dev, NULL, NULL))
-               aprint_error_dev(un->un_dev, "couldn't establish power handler\n");
 }
 
 void
@@ -1107,6 +1102,11 @@
                if_alloc_sadl(ifp);
                bpf_attach(ifp, DLT_RAW, 0);
        }
+
+       usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, un->un_udev, un->un_dev);
+
+       if (!pmf_device_register(un->un_dev, NULL, NULL))
+               aprint_error_dev(un->un_dev, "couldn't establish power handler\n");
 }
 
 int



Home | Main Index | Thread Index | Old Index