A small cleanup patch

Vijay Singh vijju.singh at gmail.com
Thu Oct 4 23:22:01 UTC 2012


Folks, I came up with this while going through the lltable code.

kong@[/u/vijay/bsd/CODE/cur/sys]# svn diff net/if.c
Index: net/if.c
===================================================================
--- net/if.c	(revision 241169)
+++ net/if.c	(working copy)
@@ -691,12 +691,9 @@
 if_attachdomain(void *dummy)
 {
 	struct ifnet *ifp;
-	int s;

-	s = splnet();
 	TAILQ_FOREACH(ifp, &V_ifnet, if_link)
 		if_attachdomain1(ifp);
-	splx(s);
 }
 SYSINIT(domainifattach, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_SECOND,
     if_attachdomain, NULL);
@@ -705,22 +702,17 @@
 if_attachdomain1(struct ifnet *ifp)
 {
 	struct domain *dp;
-	int s;

-	s = splnet();
-
 	/*
 	 * Since dp->dom_ifattach calls malloc() with M_WAITOK, we
 	 * cannot lock ifp->if_afdata initialization, entirely.
 	 */
 	if (IF_AFDATA_TRYLOCK(ifp) == 0) {
-		splx(s);
 		return;
 	}
 	if (ifp->if_afdata_initialized >= domain_init_status) {
 		IF_AFDATA_UNLOCK(ifp);
-		splx(s);
-		printf("if_attachdomain called more than once on %s\n",
+		log(LOG_WARNING, "if_attachdomain called more than once on %s\n",
 		    ifp->if_xname);
 		return;
 	}
@@ -734,8 +726,6 @@
 			ifp->if_afdata[dp->dom_family] =
 			    (*dp->dom_ifattach)(ifp);
 	}
-
-	splx(s);
 }

 /*


More information about the freebsd-net mailing list