diff options
| author | drochner <drochner@NetBSD.org> | 2008-05-26 18:00:33 +0000 |
|---|---|---|
| committer | drochner <drochner@NetBSD.org> | 2008-05-26 18:00:33 +0000 |
| commit | 736f4fcd27bfa8a07b9e27d7423accb5cb328b76 (patch) | |
| tree | 7e47d4aa104ac0142d7635c52dbe0b7fd073f87f /sys/dev | |
| parent | 409e8d93e6c7cd7dcd639864c08f7fe312403dbe (diff) | |
some cleanup:
-unifdef
-since the roothub attach doesn't use locators, don't call
config_stdsubmatch() -- it is a no-op in that case
-ifsubmatch has configuration and interface always set to useful values,
remove unnecessary checks
-remove now unused locator definitions from shared header
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/usb/usb.c | 6 | ||||
| -rw-r--r-- | sys/dev/usb/usb.h | 9 | ||||
| -rw-r--r-- | sys/dev/usb/usb_subr.c | 82 | ||||
| -rw-r--r-- | sys/dev/usb/usbdi.c | 31 | ||||
| -rw-r--r-- | sys/dev/usb/usbdi_util.c | 8 | ||||
| -rw-r--r-- | sys/dev/usb/usbdivar.h | 47 |
6 files changed, 14 insertions, 169 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index a03b229ff06..2a1d6d621eb 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb.c,v 1.114 2008/05/25 21:41:35 drochner Exp $ */ +/* $NetBSD: usb.c,v 1.115 2008/05/26 18:00:33 drochner Exp $ */ /* * Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.114 2008/05/25 21:41:35 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.115 2008/05/26 18:00:33 drochner Exp $"); #include "opt_compat_netbsd.h" @@ -283,7 +283,6 @@ usb_doattach(device_t self) static const char *taskq_names[] = USB_TASKQ_NAMES; -#if defined(__NetBSD__) || defined(__OpenBSD__) void usb_create_event_thread(device_t self) { @@ -435,7 +434,6 @@ usbctlprint(void *aux, const char *pnp) return (UNCONF); } -#endif /* defined(__NetBSD__) || defined(__OpenBSD__) */ int usbopen(dev_t dev, int flag, int mode, struct lwp *l) diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index 866f70ad682..ebe7dd1a919 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -1,4 +1,4 @@ -/* $NetBSD: usb.h,v 1.79 2008/04/28 20:24:00 martin Exp $ */ +/* $NetBSD: usb.h,v 1.80 2008/05/26 18:00:33 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb.h,v 1.14 1999/11/17 22:33:46 n_hibma Exp $ */ /* @@ -38,14 +38,7 @@ #include <sys/types.h> #include <sys/time.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/ioctl.h> -#endif -#if defined(__FreeBSD__) -/* These two defines are used by usbd to autoload the usb kld */ -#define USB_KLD "usb" /* name of usb module */ -#define USB_UHUB "usb/uhub" /* root hub */ -#endif #if defined(_KERNEL) #include <dev/usb/usb_port.h> diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 3b4bcbf6883..3184a823876 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.155 2008/05/25 21:41:35 drochner Exp $ */ +/* $NetBSD: usb_subr.c,v 1.156 2008/05/26 18:00:33 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ /* @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.155 2008/05/25 21:41:35 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.156 2008/05/26 18:00:33 drochner Exp $"); #include "opt_compat_netbsd.h" #include "opt_usbverbose.h" @@ -41,13 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.155 2008/05/25 21:41:35 drochner Exp #include <sys/systm.h> #include <sys/kernel.h> #include <sys/malloc.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/device.h> #include <sys/select.h> -#elif defined(__FreeBSD__) -#include <sys/module.h> -#include <sys/bus.h> -#endif #include <sys/proc.h> #include <sys/bus.h> @@ -60,11 +55,6 @@ __KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.155 2008/05/25 21:41:35 drochner Exp #include <dev/usb/usbdevs.h> #include <dev/usb/usb_quirks.h> -#if defined(__FreeBSD__) -#include <machine/clock.h> -#define delay(d) DELAY(d) -#endif - #ifdef USB_DEBUG #define DPRINTF(x) if (usbdebug) logprintf x #define DPRINTFN(n,x) if (usbdebug>(n)) logprintf x @@ -81,13 +71,8 @@ Static void usbd_devinfo_vp(usbd_device_handle dev, char *p, int usedev, int useencoded ); Static int usbd_getnewaddr(usbd_bus_handle bus); -#if defined(__NetBSD__) Static int usbd_print(void *, const char *); Static int usbd_ifprint(void *, const char *); -#elif defined(__OpenBSD__) -Static int usbd_print(void *aux, const char *pnp); -Static int usbd_submatch(device_ptr_t, void *, void *); -#endif Static void usbd_free_iface_data(usbd_device_handle dev, int ifcno); Static void usbd_kill_pipe(usbd_pipe_handle); usbd_status usbd_attach_roothub(device_t, usbd_device_handle); @@ -795,8 +780,7 @@ usbd_attach_roothub(device_t parent, usbd_device_handle dev) uaa.subclass = dd->bDeviceSubClass; uaa.proto = dd->bDeviceProtocol; - dv = config_found_sm_loc(parent, "usbroothubif", 0, &uaa, 0, - config_stdsubmatch); + dv = config_found_ia(parent, "usbroothubif", &uaa, 0); if (dv) { dev->subdevs = malloc(sizeof dv, M_USB, M_NOWAIT); if (dev->subdevs == NULL) @@ -819,20 +803,6 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, device_ptr_t dv; usbd_interface_handle *ifaces; -#if defined(__FreeBSD__) - /* - * XXX uaa is a static var. Not a problem as it _should_ be used only - * during probe and attach. Should be changed however. - */ - device_t bdev; - bdev = device_add_child(parent, NULL, -1, &uaa); - if (!bdev) { - printf("%s: Device creation failed\n", USBDEVNAME(dev->bus->bdev)); - return (USBD_INVAL); - } - device_quiet(bdev); -#endif - uaa.device = dev; uaa.usegeneric = 0; uaa.port = port; @@ -880,10 +850,6 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, printf("%s: port %d, set config at addr %d failed\n", USBDEVPTRNAME(parent), port, addr); #endif -#if defined(__FreeBSD__) - device_delete_child(parent, bdev); -#endif - return (err); } nifaces = dev->cdesc->bNumInterface; @@ -900,9 +866,6 @@ usbd_probe_and_attach(device_ptr_t parent, usbd_device_handle dev, if (dev->subdevs == NULL) { free(ifaces, M_USB); nomem: -#if defined(__FreeBSD__) - device_delete_child(parent, bdev); -#endif return (USBD_NOMEM); } dev->subdevlen = nifaces; @@ -922,25 +885,9 @@ nomem: found++; dev->subdevs[i] = dv; ifaces[i] = 0; /* consumed */ - -#if defined(__FreeBSD__) - /* create another child for the next iface */ - bdev = device_add_child(parent, NULL, -1,&uaa); - if (!bdev) { - printf("%s: Device creation failed\n", - USBDEVNAME(dev->bus->bdev)); - free(ifaces, M_USB); - return (USBD_NORMAL_COMPLETION); - } - device_quiet(bdev); -#endif } } if (found != 0) { -#if defined(__FreeBSD__) - /* remove the last created child again; it is unused */ - device_delete_child(parent, bdev); -#endif free(ifaces, M_USB); return (USBD_NORMAL_COMPLETION); } @@ -975,9 +922,6 @@ nomem: * fully operational and not harming anyone. */ DPRINTF(("usbd_probe_and_attach: generic attach failed\n")); -#if defined(__FreeBSD__) - device_delete_child(parent, bdev); -#endif return (USBD_NORMAL_COMPLETION); } @@ -1245,10 +1189,8 @@ usbd_ifprint(void *aux, const char *pnp) if (pnp) return (QUIET); aprint_normal(" port %d", uaa->port); - if (uaa->configno != UHUB_UNK_CONFIGURATION) - aprint_normal(" configuration %d", uaa->configno); - if (uaa->ifaceno != UHUB_UNK_INTERFACE) - aprint_normal(" interface %d", uaa->ifaceno); + aprint_normal(" configuration %d", uaa->configno); + aprint_normal(" interface %d", uaa->ifaceno); #if 0 /* * It gets very crowded with these locators on the attach line. @@ -1477,17 +1419,3 @@ usb_disconnect_port(struct usbd_port *up, device_ptr_t parent) up->device = NULL; usb_free_device(dev); } - -#ifdef __OpenBSD__ -void *usb_realloc(void *p, u_int size, int pool, int flags) -{ - void *q; - - q = malloc(size, pool, flags); - if (q == NULL) - return (NULL); - bcopy(p, q, size); - free(p, pool); - return (q); -} -#endif diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 139d953d3d0..7b0f8852502 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.122 2008/04/28 20:24:01 martin Exp $ */ +/* $NetBSD: usbdi.c,v 1.123 2008/05/26 18:00:33 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ /* @@ -32,24 +32,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.122 2008/04/28 20:24:01 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.123 2008/05/26 18:00:33 drochner Exp $"); #include "opt_compat_netbsd.h" #include <sys/param.h> #include <sys/systm.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/kernel.h> #include <sys/device.h> -#elif defined(__FreeBSD__) -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/conf.h> -#include "usb_if.h" -#if defined(DIAGNOSTIC) && defined(__i386__) -#include <sys/cpu.h> -#endif -#endif #include <sys/malloc.h> #include <sys/proc.h> @@ -394,7 +384,7 @@ usbd_free_xfer(usbd_xfer_handle xfer) DPRINTFN(5,("usbd_free_xfer: %p\n", xfer)); if (xfer->rqflags & (URQ_DEV_DMABUF | URQ_AUTO_DMABUF)) usbd_free_buffer(xfer); -#if defined(__NetBSD__) && defined(DIAGNOSTIC) +#if defined(DIAGNOSTIC) if (callout_pending(&xfer->timeout_handle)) { callout_stop(&xfer->timeout_handle); printf("usbd_free_xfer: timout_handle pending"); @@ -927,10 +917,6 @@ usbd_do_request_flags_pipe(usbd_device_handle dev, usbd_pipe_handle pipe, usbd_status err; #ifdef DIAGNOSTIC -#if defined(__i386__) && defined(__FreeBSD__) - KASSERT(intr_nesting_level == 0, - ("usbd_do_request: in interrupt context")); -#endif if (dev->bus->intr_context) { printf("usbd_do_request: not in process context\n"); return (USBD_INVAL); @@ -1219,14 +1205,3 @@ usbd_get_string0(usbd_device_handle dev, int si, char *buf, int unicode) #endif return (USBD_NORMAL_COMPLETION); } - -#if defined(__FreeBSD__) -int -usbd_driver_load(module_t mod, int what, void *arg) -{ - /* XXX should implement something like a function that removes all generic devices */ - - return (0); -} - -#endif diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index c6ae6e5214e..9bef62f8600 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.c,v 1.50 2008/04/28 20:24:01 martin Exp $ */ +/* $NetBSD: usbdi_util.c,v 1.51 2008/05/26 18:00:33 drochner Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -31,18 +31,14 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.50 2008/04/28 20:24:01 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.51 2008/05/26 18:00:33 drochner Exp $"); #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> #include <sys/malloc.h> -#if defined(__NetBSD__) || defined(__OpenBSD__) #include <sys/proc.h> #include <sys/device.h> -#elif defined(__FreeBSD__) -#include <sys/bus.h> -#endif #include <dev/usb/usb.h> #include <dev/usb/usbhid.h> diff --git a/sys/dev/usb/usbdivar.h b/sys/dev/usb/usbdivar.h index 7c695c099a7..99e6cad6ebe 100644 --- a/sys/dev/usb/usbdivar.h +++ b/sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdivar.h,v 1.85 2008/05/25 21:41:35 drochner Exp $ */ +/* $NetBSD: usbdivar.h,v 1.86 2008/05/26 18:00:33 drochner Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ /* @@ -31,9 +31,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#if defined(__NetBSD__) #include <sys/callout.h> -#endif /* From usb_mem.h */ DECLARE_USB_DMA_T; @@ -118,9 +116,7 @@ struct usbd_bus { #define USBREV_STR { "unknown", "pre 1.0", "1.0", "1.1", "2.0" } void *soft; /* soft interrupt cookie */ -#if defined(__NetBSD__) || defined(__OpenBSD__) bus_dma_tag_t dmatag; /* DMA tag */ -#endif }; struct usbd_device { @@ -267,44 +263,3 @@ void usb_schedsoftintr(struct usbd_bus *); #else #define SPLUSBCHECK #endif - -/* Locator stuff. */ - -#if defined(__NetBSD__) -#include "locators.h" -#elif defined(__FreeBSD__) || defined(__OpenBSD__) -/* XXX these values are used to statically bind some elements in the USB tree - * to specific driver instances. This should be somehow emulated in FreeBSD - * but can be done later on. - * The values are copied from the files.usb file in the NetBSD sources. - */ -#define UHUBCF_PORT_DEFAULT -1 -#define UHUBCF_CONFIGURATION_DEFAULT -1 -#define UHUBCF_INTERFACE_DEFAULT -1 -#define UHUBCF_VENDOR_DEFAULT -1 -#define UHUBCF_PRODUCT_DEFAULT -1 -#define UHUBCF_RELEASE_DEFAULT -1 -#endif - -#if defined (__OpenBSD__) -#define UHUBCF_PORT 0 -#define UHUBCF_CONFIGURATION 1 -#define UHUBCF_INTERFACE 2 -#define UHUBCF_VENDOR 3 -#define UHUBCF_PRODUCT 4 -#define UHUBCF_RELEASE 5 -#endif - -#define uhubcf_port cf_loc[USBDEVIFCF_PORT] -#define uhubcf_configuration cf_loc[USBDEVIFCF_CONFIGURATION] -#define uhubcf_interface cf_loc[USBDEVIFCF_INTERFACE] -#define uhubcf_vendor cf_loc[USBDEVIFCF_VENDOR] -#define uhubcf_product cf_loc[USBDEVIFCF_PRODUCT] -#define uhubcf_release cf_loc[USBDEVIFCF_RELEASE] -#define UHUB_UNK_PORT USBDEVIFCF_PORT_DEFAULT /* wildcarded 'port' */ -#define UHUB_UNK_CONFIGURATION USBDEVIFCF_CONFIGURATION_DEFAULT /* wildcarded 'configuration' */ -#define UHUB_UNK_INTERFACE USBDEVIFCF_INTERFACE_DEFAULT /* wildcarded 'interface' */ -#define UHUB_UNK_VENDOR USBDEVIFCF_VENDOR_DEFAULT /* wildcarded 'vendor' */ -#define UHUB_UNK_PRODUCT USBDEVIFCF_PRODUCT_DEFAULT /* wildcarded 'product' */ -#define UHUB_UNK_RELEASE USBDEVIFCF_RELEASE_DEFAULT /* wildcarded 'release' */ - |
