Remove compat ifdefs for FreeBSD versions < 500014, makes the code

quite a bit easier to read.

Approved by:	rwatson (mentor)
MFC after:	1 weeks
This commit is contained in:
Christian Brueffer 2007-05-12 05:53:53 +00:00
parent ac474f9545
commit 224aecbcdf
12 changed files with 3 additions and 120 deletions

View File

@ -70,9 +70,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
#if __FreeBSD_version < 500000
#include <machine/clock.h>
#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -357,11 +354,7 @@ cue_setmulti(struct cue_softc *sc)
/* now program new ones */
IF_ADDR_LOCK(ifp);
#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;
@ -375,11 +368,7 @@ cue_setmulti(struct cue_softc *sc)
* so we can receive broadcast frames.
*/
if (ifp->if_flags & IFF_BROADCAST) {
#if __FreeBSD_version >= 500000
h = cue_mchash(ifp->if_broadcastaddr);
#else
h = cue_mchash(etherbroadcastaddr);
#endif
sc->cue_mctab[h >> 3] |= 1 << (h & 0x7);
}
@ -487,10 +476,8 @@ USB_ATTACH(cue)
}
}
#if __FreeBSD_version >= 500000
mtx_init(&sc->cue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
#endif
CUE_LOCK(sc);
#ifdef notdef
@ -506,9 +493,7 @@ USB_ATTACH(cue)
if (ifp == NULL) {
printf("cue%d: can not if_alloc()\n", sc->cue_unit);
CUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->cue_mtx);
#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@ -529,11 +514,7 @@ USB_ATTACH(cue)
/*
* Call MI attach routine.
*/
#if __FreeBSD_version >= 500000
ether_ifattach(ifp, eaddr);
#else
ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
#endif
callout_handle_init(&sc->cue_stat_ch);
usb_register_netisr();
sc->cue_dying = 0;
@ -554,12 +535,8 @@ cue_detach(device_t dev)
sc->cue_dying = 1;
untimeout(cue_tick, sc, sc->cue_stat_ch);
#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
if_free(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
#endif
if (sc->cue_ep[CUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_TX]);
@ -569,9 +546,7 @@ cue_detach(device_t dev)
usbd_abort_pipe(sc->cue_ep[CUE_ENDPT_INTR]);
CUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->cue_mtx);
#endif
return(0);
}

View File

@ -154,9 +154,7 @@ struct cue_softc {
u_int16_t cue_rxfilt;
struct ue_cdata cue_cdata;
struct callout_handle cue_stat_ch;
#if __FreeBSD_version >= 500000
struct mtx cue_mtx;
#endif
char cue_dying;
struct timeval cue_rx_notice;
struct usb_qdat cue_qdat;

View File

@ -85,9 +85,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
#if __FreeBSD_version < 500000
#include <machine/clock.h>
#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -329,11 +326,7 @@ kue_setmulti(struct kue_softc *sc)
sc->kue_rxfilt &= ~KUE_RXFILT_ALLMULTI;
IF_ADDR_LOCK(ifp);
#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;
@ -451,18 +444,14 @@ USB_ATTACH(kue)
}
}
#if __FreeBSD_version >= 500000
mtx_init(&sc->kue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
#endif
KUE_LOCK(sc);
/* Load the firmware into the NIC. */
if (kue_load_fw(sc)) {
KUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->kue_mtx);
#endif
USB_ATTACH_ERROR_RETURN;
}
@ -480,9 +469,7 @@ USB_ATTACH(kue)
if (ifp == NULL) {
printf("kue%d: can not if_alloc()\n", sc->kue_unit);
KUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->kue_mtx);
#endif
USB_ATTACH_ERROR_RETURN;
}
ifp->if_softc = sc;
@ -503,11 +490,7 @@ USB_ATTACH(kue)
/*
* Call MI attach routine.
*/
#if __FreeBSD_version >= 500000
ether_ifattach(ifp, sc->kue_desc.kue_macaddr);
#else
ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
#endif
usb_register_netisr();
sc->kue_dying = 0;
@ -529,12 +512,8 @@ kue_detach(device_t dev)
sc->kue_dying = 1;
if (ifp != NULL)
#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
if_free(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
#endif
if (sc->kue_ep[KUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->kue_ep[KUE_ENDPT_TX]);
@ -547,9 +526,7 @@ kue_detach(device_t dev)
free(sc->kue_mcfilters, M_USBDEV);
KUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->kue_mtx);
#endif
return(0);
}

View File

@ -147,9 +147,7 @@ struct kue_softc {
u_int16_t kue_rxfilt;
u_int8_t *kue_mcfilters;
struct ue_cdata kue_cdata;
#if __FreeBSD_version >= 500000
struct mtx kue_mtx;
#endif
char kue_dying;
struct timeval kue_rx_notice;
struct usb_qdat kue_qdat;

View File

@ -86,9 +86,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
#if __FreeBSD_version < 500000
#include <machine/clock.h>
#endif
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
@ -502,11 +499,7 @@ rue_setmulti(struct rue_softc *sc)
/* now program new ones */
IF_ADDR_LOCK(ifp);
#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;
@ -651,10 +644,8 @@ USB_ATTACH(rue)
}
}
#if __FreeBSD_version >= 500000
mtx_init(&sc->rue_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
#endif
RUE_LOCK(sc);
/* Reset the adapter */
@ -695,11 +686,7 @@ USB_ATTACH(rue)
sc->rue_qdat.if_rxstart = rue_rxstart;
/* Call MI attach routine */
#if __FreeBSD_version >= 500000
ether_ifattach(ifp, eaddr);
#else
ether_ifattach(ifp, ETHER_BPF_SUPPORTED);
#endif
callout_handle_init(&sc->rue_stat_ch);
usb_register_netisr();
sc->rue_dying = 0;
@ -712,9 +699,7 @@ USB_ATTACH(rue)
if_free(ifp);
error1:
RUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->rue_mtx);
#endif
error:
free(devinfo, M_USBDEV);
USB_ATTACH_ERROR_RETURN;
@ -732,12 +717,8 @@ rue_detach(device_t dev)
sc->rue_dying = 1;
untimeout(rue_tick, sc, sc->rue_stat_ch);
#if __FreeBSD_version >= 500000
ether_ifdetach(ifp);
if_free(ifp);
#else
ether_ifdetach(ifp, ETHER_BPF_SUPPORTED);
#endif
if (sc->rue_ep[RUE_ENDPT_TX] != NULL)
usbd_abort_pipe(sc->rue_ep[RUE_ENDPT_TX]);
@ -749,9 +730,7 @@ rue_detach(device_t dev)
#endif
RUE_UNLOCK(sc);
#if __FreeBSD_version >= 500000
mtx_destroy(&sc->rue_mtx);
#endif
return (0);
}

View File

@ -200,9 +200,7 @@ struct rue_softc {
int rue_if_flags;
struct ue_cdata rue_cdata;
struct callout_handle rue_stat_ch;
#if __FreeBSD_version >= 500000
struct mtx rue_mtx;
#endif
char rue_dying;
struct timeval rue_rx_notice;
struct usb_qdat rue_qdat;

View File

@ -122,9 +122,6 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <machine/bus.h>
#if __FreeBSD_version < 500000
#include <machine/clock.h>
#endif
#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
@ -357,7 +354,7 @@ USB_ATTACH(udav)
goto bad;
}
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
#if defined(__FreeBSD__)
mtx_init(&sc->sc_mtx, device_get_nameunit(self), MTX_NETWORK_LOCK,
MTX_DEF | MTX_RECURSE);
#endif
@ -1056,11 +1053,7 @@ udav_setmulti(struct udav_softc *sc)
}
#elif defined(__FreeBSD__)
IF_ADDR_LOCK(ifp);
#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;

View File

@ -53,9 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
#endif
#include <sys/signalvar.h>
#include <sys/fcntl.h>
#if defined(__NetBSD__) || defined(__OpenBSD__)
@ -659,11 +657,7 @@ uhid_do_ioctl(struct uhid_softc *sc, u_long cmd, caddr_t addr, int flag,
if (*(int *)addr) {
if (sc->sc_async != NULL)
return (EBUSY);
#if __FreeBSD_version >= 500000
sc->sc_async = p->td_proc;
#else
sc->sc_async = p;
#endif
DPRINTF(("uhid_do_ioctl: FIOASYNC %p\n", sc->sc_async));
} else
sc->sc_async = NULL;

View File

@ -56,16 +56,8 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/file.h>
#if __FreeBSD_version >= 500000
#include <sys/limits.h>
#else
#include <machine/limits.h>
#endif
#if __FreeBSD_version >= 500014
#include <sys/selinfo.h>
#else
#include <sys/select.h>
#endif
#include <sys/sysctl.h>
#include <sys/uio.h>

View File

@ -53,11 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/fcntl.h>
#include <sys/tty.h>
#include <sys/file.h>
#if __FreeBSD_version >= 500014
#include <sys/selinfo.h>
#else
#include <sys/select.h>
#endif
#include <sys/poll.h>
#include <sys/sysctl.h>
#include <sys/uio.h>
@ -71,11 +67,7 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/usb_quirks.h>
#include <dev/usb/hid.h>
#if __FreeBSD_version >= 500000
#include <sys/mouse.h>
#else
#include <machine/mouse.h>
#endif
#ifdef USB_DEBUG
#define DPRINTF(x) if (umsdebug) logprintf x

View File

@ -58,9 +58,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#if __FreeBSD_version >= 500000
#include <sys/mutex.h>
#endif
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
#elif defined(__FreeBSD__)
@ -424,7 +422,7 @@ usb_event_thread(void *arg)
static int newthread_wchan;
struct usb_softc *sc = arg;
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
#if defined(__FreeBSD__)
mtx_lock(&Giant);
#endif
@ -483,7 +481,7 @@ usb_task_thread(void *arg)
struct usb_taskq *taskq;
int s;
#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
#if defined(__FreeBSD__)
mtx_lock(&Giant);
#endif
@ -610,11 +608,7 @@ usbioctl(struct cdev *devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p)
case FIOASYNC:
if (*(int *)data)
#if __FreeBSD_version >= 500000
usb_async_proc = p->td_proc;
#else
usb_async_proc = p;
#endif
else
usb_async_proc = 0;
return (0);

View File

@ -167,17 +167,10 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
if (p == NULL)
return (USBD_NOMEM);
#if __FreeBSD_version >= 500000
if (bus_dma_tag_create(tag, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
size, sizeof(p->segs) / sizeof(p->segs[0]), size,
0, NULL, NULL, &p->tag) == ENOMEM)
#else
if (bus_dma_tag_create(tag, align, 0,
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
size, sizeof(p->segs) / sizeof(p->segs[0]), size,
0, &p->tag) == ENOMEM)
#endif
{
goto free;
}