Module Name:    src
Committed By:   riastradh
Date:           Thu Mar  3 05:56:19 UTC 2022

Modified Files:
        src/sys/dev/usb: if_cdce.c if_upl.c usbnet.c

Log Message:
usbnet: Omit empty uno_init functions.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/usb/usbnet.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_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.79 src/sys/dev/usb/if_cdce.c:1.80
--- src/sys/dev/usb/if_cdce.c:1.79	Thu Mar  3 05:56:09 2022
+++ src/sys/dev/usb/if_cdce.c	Thu Mar  3 05:56:18 2022
@@ -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 <wp...@windriver.com>
@@ -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 @@ static void	cdce_uno_rx_loop(struct usbn
 				 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 @@ cdce_attach(device_t parent, device_t se
             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)
 {

Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.75 src/sys/dev/usb/if_upl.c:1.76
--- src/sys/dev/usb/if_upl.c:1.75	Thu Mar  3 05:56:09 2022
+++ src/sys/dev/usb/if_upl.c	Thu Mar  3 05:56:18 2022
@@ -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 void upl_uno_rx_loop(struct usbne
 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 @@ upl_uno_tx_prepare(struct usbnet *un, st
 }
 
 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) {

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.88 src/sys/dev/usb/usbnet.c:1.89
--- src/sys/dev/usb/usbnet.c:1.88	Thu Mar  3 05:56:09 2022
+++ src/sys/dev/usb/usbnet.c	Thu Mar  3 05:56:18 2022
@@ -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 @@ static int
 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

Reply via email to