PERFORCE change 130535 for review

Sam Leffler sam at FreeBSD.org
Sat Dec 8 23:33:55 PST 2007


http://perforce.freebsd.org/chv.cgi?CH=130535

Change 130535 by sam at sam_ebb on 2007/12/09 07:33:29

	de-ifdef code before conversion; this driver is clearly
	dead as it's not even been converted to allocate an ifnet

Affected files ...

.. //depot/projects/vap/sys/dev/awi/awi.c#6 edit
.. //depot/projects/vap/sys/dev/awi/awivar.h#5 edit

Differences ...

==== //depot/projects/vap/sys/dev/awi/awi.c#6 (text+ko) ====

@@ -85,20 +85,9 @@
  */
 
 #include <sys/cdefs.h>
-#ifdef __NetBSD__
-__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.62 2004/01/16 14:13:15 onoe Exp $");
-#endif
-#ifdef __FreeBSD__
 __FBSDID("$FreeBSD: src/sys/dev/awi/awi.c,v 1.45 2007/09/05 21:31:31 sam Exp $");
-#endif
 
 #include "opt_inet.h"
-#ifdef __NetBSD__
-#include "bpfilter.h"
-#endif
-#ifdef __FreeBSD__
-#define	NBPFILTER	1
-#endif
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -110,53 +99,28 @@
 #include <sys/sockio.h>
 #include <sys/errno.h>
 #include <sys/endian.h>
-#ifdef __FreeBSD__
 #include <sys/bus.h>
-#endif
-#ifdef __NetBSD__
-#include <sys/device.h>
-#endif
 
 #include <net/if.h>
 #include <net/if_dl.h>
-#ifdef __NetBSD__
-#include <net/if_ether.h>
-#endif
-#ifdef __FreeBSD__
 #include <net/ethernet.h>
 #include <net/if_arp.h>
-#endif
 #include <net/if_media.h>
 #include <net/if_llc.h>
 
 #include <net80211/ieee80211_var.h>
-#ifdef __NetBSD__
-#include <net80211/ieee80211_compat.h>
-#endif
 
-#if NBPFILTER > 0
 #include <net/bpf.h>
-#endif
 
 #include <machine/cpu.h>
 #include <machine/bus.h>
 
-#ifdef __NetBSD__
-#include <dev/ic/am79c930reg.h>
-#include <dev/ic/am79c930var.h>
-#include <dev/ic/awireg.h>
-#include <dev/ic/awivar.h>
-#endif
-#ifdef __FreeBSD__
 #include <dev/awi/am79c930reg.h>
 #include <dev/awi/am79c930var.h>
 #include <dev/awi/awireg.h>
 #include <dev/awi/awivar.h>
-#endif
 
-#ifdef __FreeBSD__
 static void awi_init0(void *);
-#endif
 static int  awi_init(struct ifnet *);
 static void awi_stop(struct ifnet *, int);
 static void awi_start(struct ifnet *);
@@ -219,31 +183,8 @@
     { 0, 0 }
 };
 
-#ifdef __FreeBSD__
 devclass_t awi_devclass;
 
-#if __FreeBSD_version < 500043
-static char *ether_sprintf(u_int8_t *);
-
-static char *
-ether_sprintf(u_int8_t *enaddr)
-{
-	static char strbuf[18];
-
-	sprintf(strbuf, "%6D", enaddr, ":");
-	return strbuf;
-}
-#endif
-
-#if 0 /* ALTQ */
-#define	IFQ_PURGE(ifq)		IF_DRAIN(ifq)
-#define IF_POLL(ifq, m)		((m) = (ifq)->ifq_head)
-#define IFQ_POLL(ifq, m)	IF_POLL((ifq), (m))
-#define IFQ_DEQUEUE(ifq, m)	IF_DEQUEUE((ifq), (m))
-#endif
-
-#endif
-
 #ifdef AWI_DEBUG
 int awi_debug = 0;
 
@@ -287,18 +228,10 @@
 	ifp->if_ioctl = awi_ioctl;
 	ifp->if_start = awi_start;
 	ifp->if_watchdog = awi_watchdog;
-#ifdef __NetBSD__
-	ifp->if_init = awi_init;
-	ifp->if_stop = awi_stop;
-	IFQ_SET_READY(&ifp->if_snd);
-	memcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
-#endif
-#ifdef __FreeBSD__
 	ifp->if_init = awi_init0;
 	ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
 	if_initname(ifp, device_get_name(sc->sc_dev),
 	    device_get_unit(sc->sc_dev));
-#endif
 
 	ic->ic_ifp = ifp;
 	ic->ic_caps = IEEE80211_C_WEP | IEEE80211_C_IBSS | IEEE80211_C_HOSTAP;
@@ -320,9 +253,6 @@
 	printf("%s: IEEE802.11 %s (firmware %s)\n", ifp->if_xname,
 	    (ic->ic_phytype == IEEE80211_T_FH) ? "FH" : "DS", sc->sc_banner);
 
-#ifdef __NetBSD__
-	if_attach(ifp);
-#endif
 	ieee80211_ifattach(ic);
 
 	sc->sc_newstate = ic->ic_newstate;
@@ -350,14 +280,6 @@
 	}
 #undef	ADD
 
-#ifdef __NetBSD__
-	if ((sc->sc_sdhook = shutdownhook_establish(awi_shutdown, sc)) == NULL)
-		printf("%s: WARNING: unable to establish shutdown hook\n",
-		    ifp->if_xname);
-	if ((sc->sc_powerhook = powerhook_establish(awi_power, sc)) == NULL)
-		printf("%s: WARNING: unable to establish power hook\n",
-		    ifp->if_xname);
-#endif
 	sc->sc_attached = 1;
 	splx(s);
 
@@ -388,71 +310,11 @@
 	}
 	sc->sc_attached = 0;
 	ieee80211_ifdetach(&sc->sc_ic);
-#ifdef __NetBSD__
-	if_detach(ifp);
-	shutdownhook_disestablish(sc->sc_sdhook);
-	powerhook_disestablish(sc->sc_powerhook);
-#endif
 	splx(s);
 	return 0;
 }
 
-#ifdef __NetBSD__
-int
-awi_activate(struct device *self, enum devact act)
-{
-	struct awi_softc *sc = (struct awi_softc *)self;
-	struct ifnet *ifp = AC2IFP(&sc->sc_arp);
-	int s, error = 0;
-
-	s = splnet();
-	switch (act) {
-	case DVACT_ACTIVATE:
-		error = EOPNOTSUPP;
-		break;
-	case DVACT_DEACTIVATE:
-		sc->sc_invalid = 1;
-		if_deactivate(ifp);
-		break;
-	}
-	splx(s);
-	return error;
-}
-
 void
-awi_power(int why, void *arg)
-{
-	struct awi_softc *sc = arg;
-	struct ifnet *ifp = AC2IFP(&sc->sc_arp);
-	int s;
-	int ocansleep;
-
-	DPRINTF(("awi_power: %d\n", why));
-	s = splnet();
-	ocansleep = sc->sc_cansleep;
-	sc->sc_cansleep = 0;
-	switch (why) {
-	case PWR_SUSPEND:
-	case PWR_STANDBY:
-		awi_stop(ifp, 1);
-		break;
-	case PWR_RESUME:
-		if (ifp->if_flags & IFF_UP) {
-			awi_init(ifp);
-			(void)awi_intr(sc);	/* make sure */
-		}
-		break;
-	case PWR_SOFTSUSPEND:
-	case PWR_SOFTSTANDBY:
-	case PWR_SOFTRESUME:
-		break;
-	}
-	sc->sc_cansleep = ocansleep;
-	splx(s);
-}
-#endif /* __NetBSD__ */
-
-void
 awi_shutdown(void *arg)
 {
 	struct awi_softc *sc = arg;
@@ -537,7 +399,6 @@
 	return handled;
 }
 
-#ifdef __FreeBSD__
 static void
 awi_init0(void *arg)
 {
@@ -545,7 +406,6 @@
 
 	(void)awi_init(AC2IFP(&sc->sc_arp));
 }
-#endif
 
 static int
 awi_init(struct ifnet *ifp)
@@ -797,9 +657,7 @@
 				break;
 			}
 			IFQ_DEQUEUE(&ifp->if_snd, m0);
-#if NBPFILTER > 0
 			BPF_MTAP(ifp, m0);
-#endif
 			if ((ifp->if_flags & IFF_LINK0) || sc->sc_adhoc_ap)
 				m0 = awi_ether_encap(sc, m0);
 			else {
@@ -839,10 +697,8 @@
 			}
 			ifp->if_opackets++;
 		}
-#if NBPFILTER > 0
 		if (bpf_peers_present(ic->ic_rawbpf))
 			bpf_mtap(ic->ic_rawbpf, m0);
-#endif
 		if (dowep) {
 			struct ieee80211_key *k;
 
@@ -969,13 +825,7 @@
 		break;
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
-#ifdef __FreeBSD__
 		error = ENETRESET;	/* XXX */
-#else
-		error = (cmd == SIOCADDMULTI) ?
-		    ether_addmulti(ifr, &sc->sc_ic.ic_ec) :
-		    ether_delmulti(ifr, &sc->sc_ic.ic_ec);
-#endif
 		if (error == ENETRESET) {
 			/* do not rescan */
 			if (sc->sc_enabled)
@@ -1129,12 +979,7 @@
 {
 	struct ifnet *ifp = AC2IFP(&sc->sc_arp);
 	int n, error;
-#ifdef __FreeBSD__
 	struct ifmultiaddr *ifma;
-#else
-	struct ether_multi *enm;
-	struct ether_multistep step;
-#endif
 
 	/* reinitialize muticast filter */
 	n = 0;
@@ -1145,7 +990,6 @@
 		goto set_mib;
 	}
 	sc->sc_mib_mac.aPromiscuous_Enable = 0;
-#ifdef __FreeBSD__
 	if (ifp->if_flags & IFF_ALLMULTI)
 		goto set_mib;
 	IF_ADDR_LOCK(ifp);
@@ -1161,30 +1005,12 @@
 		n++;
 	}
 	IF_ADDR_UNLOCK(ifp);
-#else
-	ETHER_FIRST_MULTI(step, &sc->sc_ic.ic_ec, enm);
-	while (enm != NULL) {
-		if (n == AWI_GROUP_ADDR_SIZE ||
-		    !IEEE80211_ADDR_EQ(enm->enm_addrlo, enm->enm_addrhi))
-			goto set_mib;
-		IEEE80211_ADDR_COPY(sc->sc_mib_addr.aGroup_Addresses[n],
-		    enm->enm_addrlo);
-		n++;
-		ETHER_NEXT_MULTI(step, enm);
-	}
-#endif
 	for (; n < AWI_GROUP_ADDR_SIZE; n++)
 		memset(sc->sc_mib_addr.aGroup_Addresses[n], 0,
 		    IEEE80211_ADDR_LEN);
 	sc->sc_mib_local.Accept_All_Multicast_Dis = 1;
 
   set_mib:
-#ifndef __FreeBSD__
-	if (sc->sc_mib_local.Accept_All_Multicast_Dis)
-		ifp->if_flags &= ~IFF_ALLMULTI;
-	else
-		ifp->if_flags |= IFF_ALLMULTI;
-#endif
 	sc->sc_mib_mgt.Wep_Required =
 	    (sc->sc_ic.ic_flags & IEEE80211_F_PRIVACY) ? AWI_WEP_ON : AWI_WEP_OFF;
 
@@ -1793,11 +1619,7 @@
 {
 	int error = 0;
 
-#ifdef __NetBSD__
-	if (curlwp == NULL)
-#else
 	if (curproc == NULL)
-#endif
 	{
 		/*
 		 * XXX

==== //depot/projects/vap/sys/dev/awi/awivar.h#5 (text+ko) ====

@@ -74,14 +74,8 @@
 };
 
 struct awi_softc {
-#ifdef __NetBSD__
-	struct device		sc_dev;
-	void			(*sc_power)(struct awi_softc *, int);
-#endif
-#ifdef __FreeBSD__
 	struct arpcom		sc_arp;
 	device_t		sc_dev;
-#endif
 	struct am79c930_softc 	sc_chip;
 	struct ieee80211com	sc_ic;
 	u_char			sc_banner[AWI_BANNER_LEN];
@@ -151,10 +145,6 @@
 
 int	awi_attach(struct awi_softc *);
 int	awi_detach(struct awi_softc *);
-#ifdef __NetBSD__
-int	awi_activate(struct device *, enum devact);
-void	awi_power(int, void *);
-#endif
 void	awi_shutdown(void *);
 int	awi_intr(void *);
 


More information about the p4-projects mailing list