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 empty uno_init functions.



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

description:
usbnet: Omit empty uno_init functions.

diffstat:

 sys/dev/usb/if_cdce.c |  13 ++-----------
 sys/dev/usb/if_upl.c  |  13 ++-----------
 sys/dev/usb/usbnet.c  |   6 +++---
 3 files changed, 7 insertions(+), 25 deletions(-)

diffs (115 lines):

diff -r 17321cad5c97 -r 4d4d292b6b5c sys/dev/usb/if_cdce.c
--- a/sys/dev/usb/if_cdce.c     Thu Mar 03 05:56:09 2022 +0000
+++ b/sys/dev/usb/if_cdce.c     Thu Mar 03 05:56:18 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_cdce.c,v 1.79 2022/03/03 05:56:09 riastradh Exp $ */
+/*     $NetBSD: if_cdce.c,v 1.80 2022/03/03 05:56:18 riastradh Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul%windriver.com@localhost>
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.79 2022/03/03 05:56:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.80 2022/03/03 05:56:18 riastradh Exp $");
 
 #include <sys/param.h>
 
@@ -82,12 +82,10 @@
                                 uint32_t);
 static unsigned        cdce_uno_tx_prepare(struct usbnet *, struct mbuf *,
                                    struct usbnet_chain *);
-static int     cdce_uno_init(struct ifnet *);
 
 static const struct usbnet_ops cdce_ops = {
        .uno_tx_prepare = cdce_uno_tx_prepare,
        .uno_rx_loop = cdce_uno_rx_loop,
-       .uno_init = cdce_uno_init,
 };
 
 static int
@@ -255,13 +253,6 @@
             0, NULL);
 }
 
-static int
-cdce_uno_init(struct ifnet *ifp)
-{
-
-       return 0;
-}
-
 static void
 cdce_uno_rx_loop(struct usbnet * un, struct usbnet_chain *c, uint32_t total_len)
 {
diff -r 17321cad5c97 -r 4d4d292b6b5c sys/dev/usb/if_upl.c
--- a/sys/dev/usb/if_upl.c      Thu Mar 03 05:56:09 2022 +0000
+++ b/sys/dev/usb/if_upl.c      Thu Mar 03 05:56:18 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_upl.c,v 1.75 2022/03/03 05:56:09 riastradh Exp $    */
+/*     $NetBSD: if_upl.c,v 1.76 2022/03/03 05:56:18 riastradh Exp $    */
 
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.75 2022/03/03 05:56:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.76 2022/03/03 05:56:18 riastradh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -111,10 +111,8 @@
 static unsigned upl_uno_tx_prepare(struct usbnet *, struct mbuf *,
                               struct usbnet_chain *);
 static int upl_uno_ioctl(struct ifnet *, u_long, void *);
-static int upl_uno_init(struct ifnet *);
 
 static const struct usbnet_ops upl_ops = {
-       .uno_init = upl_uno_init,
        .uno_tx_prepare = upl_uno_tx_prepare,
        .uno_rx_loop = upl_uno_rx_loop,
        .uno_ioctl = upl_uno_ioctl,
@@ -252,13 +250,6 @@
 }
 
 static int
-upl_uno_init(struct ifnet *ifp)
-{
-
-       return 0;
-}
-
-static int
 upl_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
        if (cmd == SIOCSIFMTU) {
diff -r 17321cad5c97 -r 4d4d292b6b5c sys/dev/usb/usbnet.c
--- a/sys/dev/usb/usbnet.c      Thu Mar 03 05:56:09 2022 +0000
+++ b/sys/dev/usb/usbnet.c      Thu Mar 03 05:56:18 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usbnet.c,v 1.88 2022/03/03 05:56:09 riastradh Exp $    */
+/*     $NetBSD: usbnet.c,v 1.89 2022/03/03 05:56:18 riastradh Exp $    */
 
 /*
  * Copyright (c) 2019 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.88 2022/03/03 05:56:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbnet.c,v 1.89 2022/03/03 05:56:18 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -205,7 +205,7 @@
 uno_init(struct usbnet *un, struct ifnet *ifp)
 {
        KASSERTMSG(IFNET_LOCKED(ifp), "%s", ifp->if_xname);
-       return (*un->un_ops->uno_init)(ifp);
+       return un->un_ops->uno_init ? (*un->un_ops->uno_init)(ifp) : 0;
 }
 
 static int



Home | Main Index | Thread Index | Old Index