Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb urndis(4): Simplify circuitous initialization lo...



details:   https://anonhg.NetBSD.org/src/rev/a572e799d0b6
branches:  trunk
changeset: 362557:a572e799d0b6
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 03 05:56:58 2022 +0000

description:
urndis(4): Simplify circuitous initialization logic.

diffstat:

 sys/dev/usb/if_urndis.c |  31 +++++++++----------------------
 1 files changed, 9 insertions(+), 22 deletions(-)

diffs (72 lines):

diff -r d36ec708961e -r a572e799d0b6 sys/dev/usb/if_urndis.c
--- a/sys/dev/usb/if_urndis.c   Thu Mar 03 05:56:51 2022 +0000
+++ b/sys/dev/usb/if_urndis.c   Thu Mar 03 05:56:58 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_urndis.c,v 1.46 2022/03/03 05:56:28 riastradh Exp $ */
+/*     $NetBSD: if_urndis.c,v 1.47 2022/03/03 05:56:58 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.46 2022/03/03 05:56:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urndis.c,v 1.47 2022/03/03 05:56:58 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -72,8 +72,6 @@
 static unsigned urndis_uno_tx_prepare(struct usbnet *, struct mbuf *,
                                      struct usbnet_chain *);
 
-static int urndis_init_un(struct ifnet *, struct usbnet *);
-
 static uint32_t urndis_ctrl_handle_init(struct usbnet *,
     const struct rndis_comp_hdr *);
 static uint32_t urndis_ctrl_handle_query(struct usbnet *,
@@ -855,28 +853,14 @@
 #endif
 
 static int
-urndis_init_un(struct ifnet *ifp, struct usbnet *un)
-{
-       int                      err;
-
-       err = urndis_ctrl_init(un);
-       if (err != RNDIS_STATUS_SUCCESS)
-               return EIO;
-
-       return err;
-}
-
-static int
 urndis_uno_init(struct ifnet *ifp)
 {
        struct usbnet *un = ifp->if_softc;
-       int error;
 
        KASSERT(IFNET_LOCKED(ifp));
 
-       error = urndis_init_un(ifp, un);
-       if (error)
-               return EIO;     /* XXX */
+       if (urndis_ctrl_init(un) != RNDIS_STATUS_SUCCESS)
+               return EIO;
 
        return 0;
 }
@@ -1044,8 +1028,11 @@
 
        usbnet_attach(un);
 
-       struct ifnet *ifp = usbnet_ifp(un);
-       urndis_init_un(ifp, un);
+       if (urndis_ctrl_init(un) != RNDIS_STATUS_SUCCESS) {
+               aprint_error("%s: unable to initialize hardware\n",
+                   DEVNAME(un));
+               return;
+       }
 
        if (urndis_ctrl_query(un, OID_802_3_PERMANENT_ADDRESS, NULL, 0,
            &buf, &bufsz) != RNDIS_STATUS_SUCCESS) {



Home | Main Index | Thread Index | Old Index