Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:54:45 UTC 2022

Modified Files:
        src/sys/dev/usb: if_urndis.c

Log Message:
urndis(4): Delete some crazy logic that I think is unnecessary.

XXX definitely need to test this one


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/if_urndis.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/if_urndis.c
diff -u src/sys/dev/usb/if_urndis.c:1.40 src/sys/dev/usb/if_urndis.c:1.41
--- src/sys/dev/usb/if_urndis.c:1.40	Thu Mar  3 05:50:22 2022
+++ src/sys/dev/usb/if_urndis.c	Thu Mar  3 05:54:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $ */
+/*	$NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $ */
 /*	$OpenBSD: if_urndis.c,v 1.31 2011/07/03 15:47:17 matthew Exp $ */
 
 /*
@@ -21,7 +21,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.40 2022/03/03 05:50:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.41 2022/03/03 05:54:45 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -866,16 +866,6 @@ urndis_init_un(struct ifnet *ifp, struct
 	if (err != RNDIS_STATUS_SUCCESS)
 		return EIO;
 
-	usbnet_lock_core(un);
-	if (usbnet_isdying(un))
-		err = EIO;
-	else {
-		usbnet_stop(un, ifp, 1);
-		err = usbnet_init_rx_tx(un);
-		usbnet_set_link(un, err == 0);
-	}
-	usbnet_unlock_core(un);
-
 	return err;
 }
 
@@ -887,9 +877,11 @@ urndis_uno_init(struct ifnet *ifp)
 
 	KASSERT(IFNET_LOCKED(ifp));
 
-	usbnet_unlock_core(un);
 	error = urndis_init_un(ifp, un);
-	usbnet_lock_core(un);
+	if (error)
+		return EIO;	/* XXX */
+	error = usbnet_init_rx_tx(un);
+	usbnet_set_link(un, error == 0);
 
 	return error;
 }
@@ -1064,9 +1056,6 @@ urndis_attach(device_t parent, device_t 
 	    &buf, &bufsz) != RNDIS_STATUS_SUCCESS) {
 		aprint_error("%s: unable to get hardware address\n",
 		    DEVNAME(un));
-		usbnet_lock_core(un);
-		usbnet_stop(un, ifp, 1);
-		usbnet_unlock_core(un);
 		return;
 	}
 
@@ -1077,9 +1066,6 @@ urndis_attach(device_t parent, device_t 
 		aprint_error("%s: invalid address\n", DEVNAME(un));
 		if (buf && bufsz)
 			kmem_free(buf, bufsz);
-		usbnet_lock_core(un);
-		usbnet_stop(un, ifp, 1);
-		usbnet_unlock_core(un);
 		return;
 	}
 
@@ -1090,17 +1076,9 @@ urndis_attach(device_t parent, device_t 
 	if (urndis_ctrl_set(un, OID_GEN_CURRENT_PACKET_FILTER, &filter,
 	    sizeof(filter)) != RNDIS_STATUS_SUCCESS) {
 		aprint_error("%s: unable to set data filters\n", DEVNAME(un));
-		usbnet_lock_core(un);
-		usbnet_stop(un, ifp, 1);
-		usbnet_unlock_core(un);
 		return;
 	}
 
-	/* Turn off again now it has been identified. */
-	usbnet_lock_core(un);
-	usbnet_stop(un, ifp, 1);
-	usbnet_unlock_core(un);
-
 	usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
             0, NULL);
 }

Reply via email to