summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Balmer <mbalmer@cvs.openbsd.org>2007-06-01 06:12:21 +0000
committerMarc Balmer <mbalmer@cvs.openbsd.org>2007-06-01 06:12:21 +0000
commit05f031b6a1efc9e500ae986feb6c082f0d0fa860 (patch)
tree92ba0bb18e2d5fa8d1cd69ec7f0f6c0b272235ae
parent345aee3bce68b6c6fd16ab5b361db8f748e7032e (diff)
Remove more Free(?)BSD and NetBSD #ifdef/#endifs. No functional nor
binary change. ok jsg
-rw-r--r--sys/dev/usb/if_upl.c21
-rw-r--r--sys/dev/usb/ubsa.c11
-rw-r--r--sys/dev/usb/uhub.c84
-rw-r--r--sys/dev/usb/ulpt.c94
-rw-r--r--sys/dev/usb/umass.c19
5 files changed, 5 insertions, 224 deletions
diff --git a/sys/dev/usb/if_upl.c b/sys/dev/usb/if_upl.c
index 1526c6d7300..f408cd7ab51 100644
--- a/sys/dev/usb/if_upl.c
+++ b/sys/dev/usb/if_upl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_upl.c,v 1.28 2007/05/27 04:00:25 jsg Exp $ */
+/* $OpenBSD: if_upl.c,v 1.29 2007/06/01 06:12:20 mbalmer Exp $ */
/* $NetBSD: if_upl.c,v 1.19 2002/07/11 21:14:26 augustss Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -45,11 +45,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-#if defined(__NetBSD__) || defined(__FreeBSD__)
-#include <sys/callout.h>
-#else
#include <sys/timeout.h>
-#endif
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
@@ -70,13 +66,9 @@
#ifdef INET
#include <netinet/in.h>
#include <netinet/in_var.h>
-#if defined(__NetBSD__)
-#include <netinet/if_inarp.h>
-#elif defined(__OpenBSD__)
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/if_ether.h>
-#endif
#else
#error upl without INET?
#endif
@@ -309,19 +301,12 @@ upl_attach(struct device *parent, struct device *self, void *aux)
ifp->if_hdrlen = 0;
ifp->if_output = upl_output;
ifp->if_baudrate = 12000000;
-#if defined(__NetBSD__)
- ifp->if_input = upl_input;
- ifp->if_dlt = DLT_RAW;
-#endif
IFQ_SET_READY(&ifp->if_snd);
/* Attach the interface. */
if_attach(ifp);
if_alloc_sadl(ifp);
-#if defined(__NetBSD__) && NBPFILTER > 0
- bpfattach(ifp, DLT_RAW, 0);
-#endif
sc->sc_attached = 1;
splx(s);
@@ -557,11 +542,7 @@ upl_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
DPRINTFN(10,("%s: %s: deliver %d\n", USBDEVNAME(sc->sc_dev),
__func__, m->m_len));
-#if defined(__NetBSD__) || defined(__OpenBSD__)
IF_INPUT(ifp, m);
-#else
- upl_input(ifp, m);
-#endif
done1:
splx(s);
diff --git a/sys/dev/usb/ubsa.c b/sys/dev/usb/ubsa.c
index 7a7cc7df043..b8dc82e9311 100644
--- a/sys/dev/usb/ubsa.c
+++ b/sys/dev/usb/ubsa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ubsa.c,v 1.22 2007/05/27 04:00:25 jsg Exp $ */
+/* $OpenBSD: ubsa.c,v 1.23 2007/06/01 06:12:20 mbalmer Exp $ */
/* $NetBSD: ubsa.c,v 1.5 2002/11/25 00:51:33 fvdl Exp $ */
/*-
* Copyright (c) 2002, Alexander Kabaev <kan.FreeBSD.org>.
@@ -67,11 +67,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-#if defined(__OpenBSD__)
#include <sys/device.h>
-#elif defined(__FreeBSD__)
-#include <sys/bus.h>
-#endif
#include <sys/ioccom.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
@@ -99,11 +95,6 @@
#ifdef UBSA_DEBUG
Static int ubsadebug = 0;
-#ifdef __FreeBSD__
-SYSCTL_NODE(_hw_usb, OID_AUTO, ubsa, CTLFLAG_RW, 0, "USB ubsa");
-SYSCTL_INT(_hw_usb_ubsa, OID_AUTO, debug, CTLFLAG_RW,
- &ubsadebug, 0, "ubsa debug level");
-#endif
#define DPRINTFN(n, x) do { if (ubsadebug > (n)) printf x; } while (0)
#else
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index 4009617f2bf..375c5a9f923 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.39 2007/05/27 04:00:25 jsg Exp $ */
+/* $OpenBSD: uhub.c,v 1.40 2007/06/01 06:12:20 mbalmer Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -47,14 +47,8 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
#include <sys/proc.h>
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include "bus_if.h"
-#endif
#include <machine/bus.h>
@@ -88,51 +82,18 @@ struct uhub_softc {
Static usbd_status uhub_explore(usbd_device_handle hub);
Static void uhub_intr(usbd_xfer_handle, usbd_private_handle,usbd_status);
-#if defined(__FreeBSD__)
-Static bus_child_detached_t uhub_child_detached;
-#endif
-
-
/*
* We need two attachment points:
* hub to usb and hub to hub
* Every other driver only connects to hubs
*/
-#if defined(__NetBSD__) || defined(__OpenBSD__)
USB_DECLARE_DRIVER(uhub);
-#if defined(__NetBSD__)
-/* Create the driver instance for the hub connected to hub case */
-CFATTACH_DECL(uhub_uhub, sizeof(struct uhub_softc),
- uhub_match, uhub_attach, uhub_detach, uhub_activate);
-#else
struct cfattach uhub_uhub_ca = {
sizeof(struct uhub_softc), uhub_match, uhub_attach,
uhub_detach, uhub_activate
};
-#endif
-#elif defined(__FreeBSD__)
-USB_DECLARE_DRIVER_INIT(uhub,
- DEVMETHOD(bus_child_detached, uhub_child_detached));
-
-/* Create the driver instance for the hub connected to usb case. */
-devclass_t uhubroot_devclass;
-
-Static device_method_t uhubroot_methods[] = {
- DEVMETHOD(device_probe, uhub_match),
- DEVMETHOD(device_attach, uhub_attach),
-
- /* detach is not allowed for a root hub */
- {0,0}
-};
-
-Static driver_t uhubroot_driver = {
- "uhub",
- uhubroot_methods,
- sizeof(struct uhub_softc)
-};
-#endif
int
uhub_match(struct device *parent, void *match, void *aux)
@@ -529,7 +490,6 @@ uhub_explore(usbd_device_handle dev)
return (USBD_NORMAL_COMPLETION);
}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
int
uhub_activate(device_ptr_t self, enum devact act)
{
@@ -557,7 +517,6 @@ uhub_activate(device_ptr_t self, enum devact act)
}
return (0);
}
-#endif
/*
* Called from process context when the hub is gone.
@@ -571,11 +530,7 @@ uhub_detach(struct device *self, int flags)
struct usbd_port *rup;
int port, nports;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
DPRINTF(("uhub_detach: sc=%p flags=%d\n", sc, flags));
-#elif defined(__FreeBSD__)
- DPRINTF(("uhub_detach: sc=%port\n", sc));
-#endif
if (hub == NULL) /* Must be partially working */
return (0);
@@ -601,38 +556,6 @@ uhub_detach(struct device *self, int flags)
return (0);
}
-#if defined(__FreeBSD__)
-/* Called when a device has been detached from it */
-Static void
-uhub_child_detached(device_t self, device_t child)
-{
- struct uhub_softc *sc = device_get_softc(self);
- usbd_device_handle devhub = sc->sc_hub;
- usbd_device_handle dev;
- int nports;
- int port;
- int i;
-
- if (!devhub->hub)
- /* should never happen; children are only created after init */
- panic("hub not fully initialised, but child deleted?");
-
- nports = devhub->hub->hubdesc.bNbrPorts;
- for (port = 0; port < nports; port++) {
- dev = devhub->hub->ports[port].device;
- if (dev && dev->subdevs) {
- for (i = 0; dev->subdevs[i]; i++) {
- if (dev->subdevs[i] == child) {
- dev->subdevs[i] = NULL;
- return;
- }
- }
- }
- }
-}
-#endif
-
-
/*
* Hub interrupt.
* This an indication that some port has changed status.
@@ -650,8 +573,3 @@ uhub_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
else if (status == USBD_NORMAL_COMPLETION)
usb_needs_explore(sc->sc_hub);
}
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(uhub, usb, uhubroot_driver, uhubroot_devclass, 0, 0);
-DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, usbd_driver_load, 0);
-#endif
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index fc9a630cdc2..0b58bb100be 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ulpt.c,v 1.23 2007/05/27 04:00:25 jsg Exp $ */
+/* $OpenBSD: ulpt.c,v 1.24 2007/06/01 06:12:20 mbalmer Exp $ */
/* $NetBSD: ulpt.c,v 1.57 2003/01/05 10:19:42 scw Exp $ */
/* $FreeBSD: src/sys/dev/usb/ulpt.c,v 1.24 1999/11/17 22:33:44 n_hibma Exp $ */
@@ -48,14 +48,8 @@
#include <sys/systm.h>
#include <sys/proc.h>
#include <sys/kernel.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/device.h>
#include <sys/ioctl.h>
-#elif defined(__FreeBSD__)
-#include <sys/ioccom.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#endif
#include <sys/uio.h>
#include <sys/conf.h>
#include <sys/vnode.h>
@@ -117,51 +111,8 @@ struct ulpt_softc {
int sc_refcnt;
u_char sc_dying;
-
-#if defined(__FreeBSD__)
- dev_t dev;
- dev_t dev_noprime;
-#endif
};
-#if defined(__NetBSD__)
-dev_type_open(ulptopen);
-dev_type_close(ulptclose);
-dev_type_write(ulptwrite);
-dev_type_ioctl(ulptioctl);
-
-const struct cdevsw ulpt_cdevsw = {
- ulptopen, ulptclose, noread, ulptwrite, ulptioctl,
- nostop, notty, nopoll, nommap, nokqfilter,
-};
-#elif defined(__FreeBSD__)
-Static d_open_t ulptopen;
-Static d_close_t ulptclose;
-Static d_write_t ulptwrite;
-Static d_ioctl_t ulptioctl;
-
-#define ULPT_CDEV_MAJOR 113
-
-Static struct cdevsw ulpt_cdevsw = {
- /* open */ ulptopen,
- /* close */ ulptclose,
- /* read */ noread,
- /* write */ ulptwrite,
- /* ioctl */ ulptioctl,
- /* poll */ nopoll,
- /* mmap */ nommap,
- /* strategy */ nostrategy,
- /* name */ "ulpt",
- /* maj */ ULPT_CDEV_MAJOR,
- /* dump */ nodump,
- /* psize */ nopsize,
- /* flags */ 0,
-#if !defined(__FreeBSD__) || (__FreeBSD__ < 5)
- /* bmaj */ -1
-#endif
-};
-#endif
-
void ulpt_disco(void *);
int ulpt_do_write(struct ulpt_softc *, struct uio *uio, int);
@@ -342,20 +293,10 @@ ulpt_attach(struct device *parent, struct device *self, void *aux)
}
}
#endif
-
-#if defined(__FreeBSD__)
- sc->dev = make_dev(&ulpt_cdevsw, device_get_unit(self),
- UID_ROOT, GID_OPERATOR, 0644, "ulpt%d", device_get_unit(self));
- sc->dev_noprime = make_dev(&ulpt_cdevsw,
- device_get_unit(self)|ULPT_NOPRIME,
- UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self));
-#endif
-
usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
USBDEV(sc->sc_dev));
}
-#if defined(__NetBSD__) || defined(__OpenBSD__)
int
ulpt_activate(device_ptr_t self, enum devact act)
{
@@ -371,18 +312,13 @@ ulpt_activate(device_ptr_t self, enum devact act)
}
return (0);
}
-#endif
int
ulpt_detach(struct device *self, int flags)
{
struct ulpt_softc *sc = (struct ulpt_softc *)self;
int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
int maj, mn;
-#elif defined(__FreeBSD__)
- struct vnode *vp;
-#endif
DPRINTF(("ulpt_detach: sc=%p\n", sc));
@@ -400,31 +336,15 @@ ulpt_detach(struct device *self, int flags)
}
splx(s);
-#if defined(__NetBSD__) || defined(__OpenBSD__)
/* locate the major number */
-#if defined(__NetBSD__)
- maj = cdevsw_lookup_major(&ulpt_cdevsw);
-#elif defined(__OpenBSD__)
for (maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == ulptopen)
break;
-#endif
/* Nuke the vnodes for any open instances (calls close). */
mn = self->dv_unit;
vdevgone(maj, mn, mn, VCHR);
vdevgone(maj, mn | ULPT_NOPRIME , mn | ULPT_NOPRIME, VCHR);
-#elif defined(__FreeBSD__)
- vp = SLIST_FIRST(&sc->dev->si_hlist);
- if (vp)
- VOP_REVOKE(vp, REVOKEALL);
- vp = SLIST_FIRST(&sc->dev_noprime->si_hlist);
- if (vp)
- VOP_REVOKE(vp, REVOKEALL);
-
- destroy_dev(sc->dev);
- destroy_dev(sc->dev_noprime);
-#endif
usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
USBDEV(sc->sc_dev));
@@ -514,14 +434,6 @@ ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p)
sc->sc_flags = flags;
DPRINTF(("ulptopen: flags=0x%x\n", (unsigned)flags));
-#if defined(ULPT_DEBUG) && defined(__FreeBSD__)
- /* Ignoring these flags might not be a good idea */
- if ((flags & ~ULPT_NOPRIME) != 0)
- printf("ulptopen: flags ignored: %b\n", flags,
- "\20\3POS_INIT\4POS_ACK\6PRIME_OPEN\7AUTOLF\10BYPASS");
-#endif
-
-
error = 0;
sc->sc_refcnt++;
@@ -749,7 +661,3 @@ ieee1284_print_id(char *str)
}
}
#endif
-
-#if defined(__FreeBSD__)
-DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, usbd_driver_load, 0);
-#endif
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c
index 1da92cde56c..42d9acb75cc 100644
--- a/sys/dev/usb/umass.c
+++ b/sys/dev/usb/umass.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umass.c,v 1.45 2007/05/27 04:00:25 jsg Exp $ */
+/* $OpenBSD: umass.c,v 1.46 2007/06/01 06:12:20 mbalmer Exp $ */
/* $NetBSD: umass.c,v 1.116 2004/06/30 05:53:46 mycroft Exp $ */
/*
@@ -137,17 +137,11 @@
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/conf.h>
-#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/buf.h>
#include <sys/device.h>
#include <sys/malloc.h>
#undef KASSERT
#define KASSERT(cond, msg)
-#elif defined(__FreeBSD__)
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <machine/clock.h>
-#endif
#include <machine/bus.h>
#include <scsi/scsi_all.h>
@@ -599,11 +593,7 @@ umass_attach(struct device *parent, struct device *self, void *aux)
switch (sc->sc_cmd) {
case UMASS_CPROTO_RBC:
case UMASS_CPROTO_SCSI:
-#if defined(__OpenBSD__) || NSCSIBUS > 0
error = umass_scsi_attach(sc);
-#else
- printf("%s: scsibus not configured\n", USBDEVNAME(sc->sc_dev));
-#endif
break;
case UMASS_CPROTO_UFI:
@@ -617,11 +607,7 @@ umass_attach(struct device *parent, struct device *self, void *aux)
break;
case UMASS_CPROTO_ISD_ATA:
-#if defined (__NetBSD__) && NWD > 0
- error = umass_isdata_attach(sc);
-#else
printf("%s: isdata not configured\n", USBDEVNAME(sc->sc_dev));
-#endif
break;
default:
@@ -1902,9 +1888,6 @@ umass_bbb_get_max_lun(struct umass_softc *sc, u_int8_t *maxlun)
return (err);
}
-
-
-
#ifdef UMASS_DEBUG
Static void
umass_bbb_dump_cbw(struct umass_softc *sc, umass_bbb_cbw_t *cbw)