From f85e5b20307bb5377ef122a6392725fa13576de6 Mon Sep 17 00:00:00 2001 From: rsm Date: Wed, 8 Dec 2004 22:02:58 +0000 Subject: [PATCH] Diff-reduction before merging if_axe to RELENG_4. Approved by: imp (mentor) MFC after: 1 week --- sys/dev/usb/FILES | 2 ++ sys/dev/usb/if_axe.c | 24 +++++++++++++++++++++++- sys/dev/usb/if_axereg.h | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/FILES b/sys/dev/usb/FILES index 09db78cd8522..5bccdb79939f 100644 --- a/sys/dev/usb/FILES +++ b/sys/dev/usb/FILES @@ -16,6 +16,8 @@ hid.c subroutines to parse and access HID data hid.h API for hid.c if_aue.c USB Pegasus Ethernet driver if_auereg.h and definitions for it +if_axe.c USB ASIX Electronics Ethernet driver +if_axereg.h and definitions for it if_cue.c USB CATC Ethernet driver if_cuereg.h and definitions for it if_kue.c USB Kawasaki Ethernet driver diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 3cf7670a47ab..ef477d8cc7c4 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -86,6 +86,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if __FreeBSD_version < 500000 +#include +#endif #include #include @@ -336,7 +339,12 @@ axe_setmulti(struct axe_softc *sc) } else rxmode &= ~AXE_RXCMD_ALLMULTI; - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { +#if __FreeBSD_version >= 500000 + TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) +#else + LIST_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) +#endif + { if (ifma->ifma_addr->sa_family != AF_LINK) continue; h = ether_crc32_be(LLADDR((struct sockaddr_dl *) @@ -450,8 +458,10 @@ USB_ATTACH(axe) } } +#if __FreeBSD_version >= 500000 mtx_init(&sc->axe_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK, MTX_DEF | MTX_RECURSE); +#endif AXE_LOCK(sc); /* @@ -493,7 +503,9 @@ USB_ATTACH(axe) axe_ifmedia_upd, axe_ifmedia_sts)) { printf("axe%d: MII without any PHY!\n", sc->axe_unit); AXE_UNLOCK(sc); +#if __FreeBSD_version >= 500000 mtx_destroy(&sc->axe_mtx); +#endif USB_ATTACH_ERROR_RETURN; } @@ -501,7 +513,11 @@ USB_ATTACH(axe) * Call MI attach routine. */ +#if __FreeBSD_version >= 500000 ether_ifattach(ifp, eaddr); +#else + ether_ifattach(ifp, ETHER_BPF_SUPPORTED); +#endif callout_handle_init(&sc->axe_stat_ch); usb_register_netisr(); @@ -524,7 +540,11 @@ axe_detach(device_ptr_t dev) sc->axe_dying = 1; untimeout(axe_tick, sc, sc->axe_stat_ch); +#if __FreeBSD_version >= 500000 ether_ifdetach(ifp); +#else + ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); +#endif if (sc->axe_ep[AXE_ENDPT_TX] != NULL) usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_TX]); @@ -534,7 +554,9 @@ axe_detach(device_ptr_t dev) usbd_abort_pipe(sc->axe_ep[AXE_ENDPT_INTR]); AXE_UNLOCK(sc); +#if __FreeBSD_version >= 500000 mtx_destroy(&sc->axe_mtx); +#endif return(0); } diff --git a/sys/dev/usb/if_axereg.h b/sys/dev/usb/if_axereg.h index a9938f4a229c..04fa92df8e51 100644 --- a/sys/dev/usb/if_axereg.h +++ b/sys/dev/usb/if_axereg.h @@ -162,7 +162,9 @@ struct axe_softc { int axe_if_flags; struct axe_cdata axe_cdata; struct callout_handle axe_stat_ch; +#if __FreeBSD_version >= 500000 struct mtx axe_mtx; +#endif char axe_dying; int axe_link; unsigned char axe_ipgs[3];