From 54aef3621773e7a3cca1b434d305b2948d3d87dc Mon Sep 17 00:00:00 2001 From: joe Date: Sun, 3 Feb 2002 17:03:34 +0000 Subject: Follow NetBSD and ANSIfy the function definitions. Remove trailing whitespaces (submitted to NetBSD). --- sys/dev/usb/ohci.c | 408 +++++++++++++++++++---------------------------------- sys/dev/usb/uhci.c | 139 +++++++++--------- sys/dev/usb/usb.c | 28 ++-- 3 files changed, 232 insertions(+), 343 deletions(-) (limited to 'sys') diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 68ab884..b6eaea9 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -122,11 +122,11 @@ Static ohci_soft_itd_t *ohci_alloc_sitd(ohci_softc_t *); Static void ohci_free_sitd(ohci_softc_t *,ohci_soft_itd_t *); #if 0 -Static void ohci_free_std_chain(ohci_softc_t *, - ohci_soft_td_t *, ohci_soft_td_t *); +Static void ohci_free_std_chain(ohci_softc_t *, ohci_soft_td_t *, + ohci_soft_td_t *); #endif Static usbd_status ohci_alloc_std_chain(struct ohci_pipe *, - ohci_softc_t *, int, int, u_int16_t, usb_dma_t *, + ohci_softc_t *, int, int, u_int16_t, usb_dma_t *, ohci_soft_td_t *, ohci_soft_td_t **); #if defined(__NetBSD__) || defined(__OpenBSD__) @@ -135,26 +135,21 @@ Static void ohci_power(int, void *); #endif Static usbd_status ohci_open(usbd_pipe_handle); Static void ohci_poll(struct usbd_bus *); -Static void ohci_softintr __P((struct usbd_bus *)); -Static void ohci_waitintr(ohci_softc_t *, - usbd_xfer_handle); +Static void ohci_softintr (struct usbd_bus *); +Static void ohci_waitintr(ohci_softc_t *, usbd_xfer_handle); Static void ohci_rhsc(ohci_softc_t *, usbd_xfer_handle); Static usbd_status ohci_device_request(usbd_xfer_handle xfer); Static void ohci_add_ed(ohci_soft_ed_t *, ohci_soft_ed_t *); Static void ohci_rem_ed(ohci_soft_ed_t *, ohci_soft_ed_t *); -Static void ohci_hash_add_td(ohci_softc_t *, - ohci_soft_td_t *); -Static void ohci_hash_rem_td(ohci_softc_t *, - ohci_soft_td_t *); -Static ohci_soft_td_t *ohci_hash_find_td(ohci_softc_t *, - ohci_physaddr_t); +Static void ohci_hash_add_td(ohci_softc_t *, ohci_soft_td_t *); +Static void ohci_hash_rem_td(ohci_softc_t *, ohci_soft_td_t *); +Static ohci_soft_td_t *ohci_hash_find_td(ohci_softc_t *, ohci_physaddr_t); Static usbd_status ohci_setup_isoc(usbd_pipe_handle pipe); Static void ohci_device_isoc_enter(usbd_xfer_handle); -Static usbd_status ohci_allocm(struct usbd_bus *, usb_dma_t *, - u_int32_t); +Static usbd_status ohci_allocm(struct usbd_bus *, usb_dma_t *, u_int32_t); Static void ohci_freem(struct usbd_bus *, usb_dma_t *); Static usbd_xfer_handle ohci_allocx(struct usbd_bus *); @@ -164,39 +159,39 @@ Static usbd_status ohci_root_ctrl_transfer(usbd_xfer_handle); Static usbd_status ohci_root_ctrl_start(usbd_xfer_handle); Static void ohci_root_ctrl_abort(usbd_xfer_handle); Static void ohci_root_ctrl_close(usbd_pipe_handle); -Static void ohci_root_ctrl_done (usbd_xfer_handle); +Static void ohci_root_ctrl_done(usbd_xfer_handle); Static usbd_status ohci_root_intr_transfer(usbd_xfer_handle); Static usbd_status ohci_root_intr_start(usbd_xfer_handle); Static void ohci_root_intr_abort(usbd_xfer_handle); Static void ohci_root_intr_close(usbd_pipe_handle); -Static void ohci_root_intr_done (usbd_xfer_handle); +Static void ohci_root_intr_done(usbd_xfer_handle); Static usbd_status ohci_device_ctrl_transfer(usbd_xfer_handle); Static usbd_status ohci_device_ctrl_start(usbd_xfer_handle); Static void ohci_device_ctrl_abort(usbd_xfer_handle); Static void ohci_device_ctrl_close(usbd_pipe_handle); -Static void ohci_device_ctrl_done (usbd_xfer_handle); +Static void ohci_device_ctrl_done(usbd_xfer_handle); Static usbd_status ohci_device_bulk_transfer(usbd_xfer_handle); Static usbd_status ohci_device_bulk_start(usbd_xfer_handle); Static void ohci_device_bulk_abort(usbd_xfer_handle); Static void ohci_device_bulk_close(usbd_pipe_handle); -Static void ohci_device_bulk_done (usbd_xfer_handle); +Static void ohci_device_bulk_done(usbd_xfer_handle); Static usbd_status ohci_device_intr_transfer(usbd_xfer_handle); Static usbd_status ohci_device_intr_start(usbd_xfer_handle); Static void ohci_device_intr_abort(usbd_xfer_handle); Static void ohci_device_intr_close(usbd_pipe_handle); -Static void ohci_device_intr_done (usbd_xfer_handle); +Static void ohci_device_intr_done(usbd_xfer_handle); Static usbd_status ohci_device_isoc_transfer(usbd_xfer_handle); Static usbd_status ohci_device_isoc_start(usbd_xfer_handle); Static void ohci_device_isoc_abort(usbd_xfer_handle); Static void ohci_device_isoc_close(usbd_pipe_handle); -Static void ohci_device_isoc_done (usbd_xfer_handle); +Static void ohci_device_isoc_done(usbd_xfer_handle); -Static usbd_status ohci_device_setintr(ohci_softc_t *sc, +Static usbd_status ohci_device_setintr(ohci_softc_t *sc, struct ohci_pipe *pipe, int ival); Static int ohci_str(usb_string_descriptor_t *, int, const char *); @@ -204,10 +199,8 @@ Static int ohci_str(usb_string_descriptor_t *, int, const char *); Static void ohci_timeout(void *); Static void ohci_rhsc_able(ohci_softc_t *, int); -Static void ohci_close_pipe(usbd_pipe_handle pipe, - ohci_soft_ed_t *head); -Static void ohci_abort_xfer(usbd_xfer_handle xfer, - usbd_status status); +Static void ohci_close_pipe(usbd_pipe_handle, ohci_soft_ed_t *); +Static void ohci_abort_xfer(usbd_xfer_handle, usbd_status); Static void ohci_abort_xfer_end(void *); Static void ohci_device_clear_toggle(usbd_pipe_handle pipe); @@ -225,7 +218,7 @@ Static void ohci_dump_ed(ohci_soft_ed_t *); #define OREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r)) /* Reverse the bits in a value 0 .. 31 */ -Static u_int8_t revbits[OHCI_NO_INTRS] = +Static u_int8_t revbits[OHCI_NO_INTRS] = { 0x00, 0x10, 0x08, 0x18, 0x04, 0x14, 0x0c, 0x1c, 0x02, 0x12, 0x0a, 0x1a, 0x06, 0x16, 0x0e, 0x1e, 0x01, 0x11, 0x09, 0x19, 0x05, 0x15, 0x0d, 0x1d, @@ -275,7 +268,7 @@ Static struct usbd_bus_methods ohci_bus_methods = { ohci_freex, }; -Static struct usbd_pipe_methods ohci_root_ctrl_methods = { +Static struct usbd_pipe_methods ohci_root_ctrl_methods = { ohci_root_ctrl_transfer, ohci_root_ctrl_start, ohci_root_ctrl_abort, @@ -284,7 +277,7 @@ Static struct usbd_pipe_methods ohci_root_ctrl_methods = { ohci_root_ctrl_done, }; -Static struct usbd_pipe_methods ohci_root_intr_methods = { +Static struct usbd_pipe_methods ohci_root_intr_methods = { ohci_root_intr_transfer, ohci_root_intr_start, ohci_root_intr_abort, @@ -293,7 +286,7 @@ Static struct usbd_pipe_methods ohci_root_intr_methods = { ohci_root_intr_done, }; -Static struct usbd_pipe_methods ohci_device_ctrl_methods = { +Static struct usbd_pipe_methods ohci_device_ctrl_methods = { ohci_device_ctrl_transfer, ohci_device_ctrl_start, ohci_device_ctrl_abort, @@ -302,7 +295,7 @@ Static struct usbd_pipe_methods ohci_device_ctrl_methods = { ohci_device_ctrl_done, }; -Static struct usbd_pipe_methods ohci_device_intr_methods = { +Static struct usbd_pipe_methods ohci_device_intr_methods = { ohci_device_intr_transfer, ohci_device_intr_start, ohci_device_intr_abort, @@ -311,7 +304,7 @@ Static struct usbd_pipe_methods ohci_device_intr_methods = { ohci_device_intr_done, }; -Static struct usbd_pipe_methods ohci_device_bulk_methods = { +Static struct usbd_pipe_methods ohci_device_bulk_methods = { ohci_device_bulk_transfer, ohci_device_bulk_start, ohci_device_bulk_abort, @@ -331,9 +324,7 @@ Static struct usbd_pipe_methods ohci_device_isoc_methods = { #if defined(__NetBSD__) || defined(__OpenBSD__) int -ohci_activate(self, act) - device_ptr_t self; - enum devact act; +ohci_activate(device_ptr_t self, enum devact act) { struct ohci_softc *sc = (struct ohci_softc *)self; int rv = 0; @@ -352,15 +343,13 @@ ohci_activate(self, act) } int -ohci_detach(sc, flags) - struct ohci_softc *sc; - int flags; +ohci_detach(struct ohci_softc *sc, int flags) { int rv = 0; if (sc->sc_child != NULL) rv = config_detach(sc->sc_child, flags); - + if (rv != 0) return (rv); @@ -375,8 +364,7 @@ ohci_detach(sc, flags) #endif ohci_soft_ed_t * -ohci_alloc_sed(sc) - ohci_softc_t *sc; +ohci_alloc_sed(ohci_softc_t *sc) { ohci_soft_ed_t *sed; usbd_status err; @@ -405,17 +393,14 @@ ohci_alloc_sed(sc) } void -ohci_free_sed(sc, sed) - ohci_softc_t *sc; - ohci_soft_ed_t *sed; +ohci_free_sed(ohci_softc_t *sc, ohci_soft_ed_t *sed) { sed->next = sc->sc_freeeds; sc->sc_freeeds = sed; } ohci_soft_td_t * -ohci_alloc_std(sc) - ohci_softc_t *sc; +ohci_alloc_std(ohci_softc_t *sc) { ohci_soft_td_t *std; usbd_status err; @@ -453,9 +438,7 @@ ohci_alloc_std(sc) } void -ohci_free_std(sc, std) - ohci_softc_t *sc; - ohci_soft_td_t *std; +ohci_free_std(ohci_softc_t *sc, ohci_soft_td_t *std) { int s; @@ -468,13 +451,9 @@ ohci_free_std(sc, std) } usbd_status -ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) - struct ohci_pipe *opipe; - ohci_softc_t *sc; - int len, rd; - u_int16_t flags; - usb_dma_t *dma; - ohci_soft_td_t *std, **rstd; +ohci_alloc_std_chain(struct ohci_pipe *opipe, ohci_softc_t *sc, + int len, int rd, u_int16_t flags, usb_dma_t *dma, + ohci_soft_td_t *std, ohci_soft_td_t **rstd) { ohci_soft_td_t *next, *cur; ohci_physaddr_t dataphys, dataphysend; @@ -487,9 +466,9 @@ ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) cur = std; dataphysend = DMAADDR(dma, len - 1); - tdflags = - (rd ? OHCI_TD_IN : OHCI_TD_OUT) | - OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | + tdflags = + (rd ? OHCI_TD_IN : OHCI_TD_OUT) | + OHCI_TD_NOCC | OHCI_TD_TOGGLE_CARRY | (flags & USBD_SHORT_XFER_OK ? OHCI_TD_R : 0); for (;;) { @@ -525,11 +504,11 @@ ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) */ #if defined(__NetBSD__) || defined(__OpenBSD__) /* must use multiple TDs, fill as much as possible. */ - curlen = 2 * OHCI_PAGE_SIZE - + curlen = 2 * OHCI_PAGE_SIZE - OHCI_PAGE_MASK(dataphys); #elif defined(__FreeBSD__) /* See comment above (XXX) */ - curlen = OHCI_PAGE_SIZE - + curlen = OHCI_PAGE_SIZE - OHCI_PAGE_MASK(dataphys); #endif } @@ -584,10 +563,8 @@ ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) #if 0 Static void -ohci_free_std_chain(sc, std, stdend) - ohci_softc_t *sc; - ohci_soft_td_t *std; - ohci_soft_td_t *stdend; +ohci_free_std_chain(ohci_softc_t *sc, ohci_soft_td_t *std, + ohci_soft_td_t *stdend) { ohci_soft_td_t *p; @@ -599,8 +576,7 @@ ohci_free_std_chain(sc, std, stdend) #endif ohci_soft_itd_t * -ohci_alloc_sitd(sc) - ohci_softc_t *sc; +ohci_alloc_sitd(ohci_softc_t *sc) { ohci_soft_itd_t *sitd; usbd_status err; @@ -629,17 +605,14 @@ ohci_alloc_sitd(sc) } void -ohci_free_sitd(sc, sitd) - ohci_softc_t *sc; - ohci_soft_itd_t *sitd; +ohci_free_sitd(ohci_softc_t *sc, ohci_soft_itd_t *sitd) { sitd->nextitd = sc->sc_freeitds; sc->sc_freeitds = sitd; } usbd_status -ohci_init(sc) - ohci_softc_t *sc; +ohci_init(ohci_softc_t *sc) { ohci_soft_ed_t *sed, *psed; usbd_status err; @@ -657,7 +630,7 @@ ohci_init(sc) OHCI_REV_LEGACY(rev) ? ", legacy support" : ""); if (OHCI_REV_HI(rev) != 1 || OHCI_REV_LO(rev) != 0) { - printf("%s: unsupported OHCI revision\n", + printf("%s: unsupported OHCI revision\n", USBDEVNAME(sc->sc_bus.bdev)); sc->sc_bus.usbrev = USBREV_UNKNOWN; return (USBD_INVAL); @@ -671,7 +644,7 @@ ohci_init(sc) /* XXX determine alignment by R/W */ /* Allocate the HCCA area. */ - err = usb_allocmem(&sc->sc_bus, OHCI_HCCA_SIZE, + err = usb_allocmem(&sc->sc_bus, OHCI_HCCA_SIZE, OHCI_HCCA_ALIGN, &sc->sc_hccadma); if (err) return (err); @@ -723,12 +696,12 @@ ohci_init(sc) sed->next = psed; sed->ed.ed_nexted = htole32(psed->physaddr); } - /* + /* * Fill HCCA interrupt table. The bit reversal is to get * the tree set up properly to spread the interrupts. */ for (i = 0; i < OHCI_NO_INTRS; i++) - sc->sc_hcca->hcca_interrupt_table[revbits[i]] = + sc->sc_hcca->hcca_interrupt_table[revbits[i]] = htole32(sc->sc_eds[OHCI_NO_EDS-OHCI_NO_INTRS+i]->physaddr); #ifdef OHCI_DEBUG @@ -843,7 +816,7 @@ ohci_init(sc) if (ohcidebug > 5) ohci_dumpregs(sc); #endif - + /* Set up the bus struct. */ sc->sc_bus.methods = &ohci_bus_methods; sc->sc_bus.pipe_size = sizeof(struct ohci_pipe); @@ -870,10 +843,7 @@ ohci_init(sc) } usbd_status -ohci_allocm(bus, dma, size) - struct usbd_bus *bus; - usb_dma_t *dma; - u_int32_t size; +ohci_allocm(struct usbd_bus *bus, usb_dma_t *dma, u_int32_t size) { #if defined(__NetBSD__) || defined(__OpenBSD__) struct ohci_softc *sc = (struct ohci_softc *)bus; @@ -883,9 +853,7 @@ ohci_allocm(bus, dma, size) } void -ohci_freem(bus, dma) - struct usbd_bus *bus; - usb_dma_t *dma; +ohci_freem(struct usbd_bus *bus, usb_dma_t *dma) { #if defined(__NetBSD__) || defined(__OpenBSD__) struct ohci_softc *sc = (struct ohci_softc *)bus; @@ -895,8 +863,7 @@ ohci_freem(bus, dma) } usbd_xfer_handle -ohci_allocx(bus) - struct usbd_bus *bus; +ohci_allocx(struct usbd_bus *bus) { struct ohci_softc *sc = (struct ohci_softc *)bus; usbd_xfer_handle xfer; @@ -912,9 +879,7 @@ ohci_allocx(bus) } void -ohci_freex(bus, xfer) - struct usbd_bus *bus; - usbd_xfer_handle xfer; +ohci_freex(struct usbd_bus *bus, usbd_xfer_handle xfer) { struct ohci_softc *sc = (struct ohci_softc *)bus; @@ -926,8 +891,7 @@ ohci_freex(bus, xfer) */ #if defined(__NetBSD__) || defined(__OpenBSD__) void -ohci_shutdown(v) - void *v; +ohci_shutdown(void *v) { ohci_softc_t *sc = v; @@ -943,9 +907,7 @@ ohci_shutdown(v) * are almost suspended anyway. */ void -ohci_power(why, v) - int why; - void *v; +ohci_power(int why, void *v) { #ifdef OHCI_DEBUG ohci_softc_t *sc = v; @@ -959,8 +921,7 @@ ohci_power(why, v) #ifdef OHCI_DEBUG void -ohci_dumpregs(sc) - ohci_softc_t *sc; +ohci_dumpregs(ohci_softc_t *sc) { DPRINTF(("ohci_dumpregs: rev=0x%08x control=0x%08x command=0x%08x\n", OREAD4(sc, OHCI_REVISION), @@ -1002,8 +963,7 @@ ohci_dumpregs(sc) Static int ohci_intr1(ohci_softc_t *); int -ohci_intr(p) - void *p; +ohci_intr(void *p) { ohci_softc_t *sc = p; @@ -1015,12 +975,11 @@ ohci_intr(p) return (0); } - return (ohci_intr1(sc)); + return (ohci_intr1(sc)); } Static int -ohci_intr1(sc) - ohci_softc_t *sc; +ohci_intr1(ohci_softc_t *sc) { u_int32_t intrs, eintrs; ohci_physaddr_t done; @@ -1073,7 +1032,7 @@ ohci_intr1(sc) sc->sc_bus.intr_context++; sc->sc_bus.no_intrs++; - DPRINTFN(7, ("ohci_intr: sc=%p intrs=0x%x(0x%x) eintrs=0x%x\n", + DPRINTFN(7, ("ohci_intr: sc=%p intrs=0x%x(0x%x) eintrs=0x%x\n", sc, (u_int)intrs, OREAD4(sc, OHCI_INTERRUPT_STATUS), (u_int)eintrs)); @@ -1091,7 +1050,7 @@ ohci_intr1(sc) ohci_physaddr_t ldone; ohci_soft_td_t *std; - for (ldone = sc->sc_done; ldone != 0; + for (ldone = sc->sc_done; ldone != 0; ldone = le32toh(std->td.td_nexttd)) std = ohci_hash_find_td(sc, ldone); std->td.td_nexttd = le32toh(done); @@ -1114,7 +1073,7 @@ ohci_intr1(sc) ohci_rhsc(sc, sc->sc_intrxfer); intrs &= ~OHCI_RHSC; - /* + /* * Disable RHSC interrupt for now, because it will be * on until the port has been reset. */ @@ -1131,9 +1090,7 @@ ohci_intr1(sc) } void -ohci_rhsc_able(sc, on) - ohci_softc_t *sc; - int on; +ohci_rhsc_able(ohci_softc_t *sc, int on) { DPRINTFN(4, ("ohci_rhsc_able: on=%d\n", on)); if (on) { @@ -1167,8 +1124,7 @@ char *ohci_cc_strs[] = { #endif void -ohci_softintr(bus) - struct usbd_bus *bus; +ohci_softintr(struct usbd_bus *bus) { ohci_softc_t *sc = (ohci_softc_t *)bus; ohci_physaddr_t done; @@ -1257,7 +1213,7 @@ ohci_softintr(bus) * the endpoint. */ ohci_soft_td_t *p, *n; - struct ohci_pipe *opipe = + struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; DPRINTF(("ohci_process_done: err cc=%d (%s), xfer=%p\n", @@ -1296,8 +1252,7 @@ ohci_softintr(bus) } void -ohci_device_ctrl_done(xfer) - usbd_xfer_handle xfer; +ohci_device_ctrl_done(usbd_xfer_handle xfer) { DPRINTFN(10,("ohci_ctrl_done: xfer=%p\n", xfer)); @@ -1310,8 +1265,7 @@ ohci_device_ctrl_done(xfer) } void -ohci_device_intr_done(xfer) - usbd_xfer_handle xfer; +ohci_device_intr_done(usbd_xfer_handle xfer) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; ohci_softc_t *sc = (ohci_softc_t *)opipe->pipe.device->bus; @@ -1319,7 +1273,7 @@ ohci_device_intr_done(xfer) ohci_soft_td_t *data, *tail; - DPRINTFN(10,("ohci_intr_done: xfer=%p, actlen=%d\n", + DPRINTFN(10,("ohci_intr_done: xfer=%p, actlen=%d\n", xfer, xfer->actlen)); xfer->hcpriv = NULL; @@ -1332,9 +1286,9 @@ ohci_device_intr_done(xfer) return; } tail->xfer = NULL; - + data->td.td_flags = htole32( - OHCI_TD_IN | OHCI_TD_NOCC | + OHCI_TD_IN | OHCI_TD_NOCC | OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY); if (xfer->flags & USBD_SHORT_XFER_OK) data->td.td_flags |= htole32(OHCI_TD_R); @@ -1354,19 +1308,16 @@ ohci_device_intr_done(xfer) } void -ohci_device_bulk_done(xfer) - usbd_xfer_handle xfer; +ohci_device_bulk_done(usbd_xfer_handle xfer) { - DPRINTFN(10,("ohci_bulk_done: xfer=%p, actlen=%d\n", + DPRINTFN(10,("ohci_bulk_done: xfer=%p, actlen=%d\n", xfer, xfer->actlen)); xfer->hcpriv = NULL; } void -ohci_rhsc(sc, xfer) - ohci_softc_t *sc; - usbd_xfer_handle xfer; +ohci_rhsc(ohci_softc_t *sc, usbd_xfer_handle xfer) { usbd_pipe_handle pipe; struct ohci_pipe *opipe; @@ -1375,7 +1326,7 @@ ohci_rhsc(sc, xfer) int hstatus; hstatus = OREAD4(sc, OHCI_RH_STATUS); - DPRINTF(("ohci_rhsc: sc=%p xfer=%p hstatus=0x%08x\n", + DPRINTF(("ohci_rhsc: sc=%p xfer=%p hstatus=0x%08x\n", sc, xfer, hstatus)); if (xfer == NULL) { @@ -1401,15 +1352,13 @@ ohci_rhsc(sc, xfer) } void -ohci_root_intr_done(xfer) - usbd_xfer_handle xfer; +ohci_root_intr_done(usbd_xfer_handle xfer) { xfer->hcpriv = NULL; } void -ohci_root_ctrl_done(xfer) - usbd_xfer_handle xfer; +ohci_root_ctrl_done(usbd_xfer_handle xfer) { xfer->hcpriv = NULL; } @@ -1420,9 +1369,7 @@ ohci_root_ctrl_done(xfer) * too long. */ void -ohci_waitintr(sc, xfer) - ohci_softc_t *sc; - usbd_xfer_handle xfer; +ohci_waitintr(ohci_softc_t *sc, usbd_xfer_handle xfer) { int timo = xfer->timeout; int usecs; @@ -1455,8 +1402,7 @@ ohci_waitintr(sc, xfer) } void -ohci_poll(bus) - struct usbd_bus *bus; +ohci_poll(struct usbd_bus *bus) { ohci_softc_t *sc = (ohci_softc_t *)bus; @@ -1465,8 +1411,7 @@ ohci_poll(bus) } usbd_status -ohci_device_request(xfer) - usbd_xfer_handle xfer; +ohci_device_request(usbd_xfer_handle xfer) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; usb_device_request_t *req = &xfer->request; @@ -1486,7 +1431,7 @@ ohci_device_request(xfer) DPRINTFN(3,("ohci_device_control type=0x%02x, request=0x%02x, " "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n", req->bmRequestType, req->bRequest, UGETW(req->wValue), - UGETW(req->wIndex), len, addr, + UGETW(req->wIndex), len, addr, opipe->pipe.endpoint->edesc->bEndpointAddress)); setup = opipe->tail.td; @@ -1605,9 +1550,7 @@ ohci_device_request(xfer) * Add an ED to the schedule. Called at splusb(). */ void -ohci_add_ed(sed, head) - ohci_soft_ed_t *sed; - ohci_soft_ed_t *head; +ohci_add_ed(ohci_soft_ed_t *sed, ohci_soft_ed_t *head) { SPLUSBCHECK; sed->next = head->next; @@ -1620,11 +1563,9 @@ ohci_add_ed(sed, head) * Remove an ED from the schedule. Called at splusb(). */ void -ohci_rem_ed(sed, head) - ohci_soft_ed_t *sed; - ohci_soft_ed_t *head; +ohci_rem_ed(ohci_soft_ed_t *sed, ohci_soft_ed_t *head) { - ohci_soft_ed_t *p; + ohci_soft_ed_t *p; SPLUSBCHECK; @@ -1650,9 +1591,7 @@ ohci_rem_ed(sed, head) #define HASH(a) (((a) >> 4) % OHCI_HASH_SIZE) /* Called at splusb() */ void -ohci_hash_add_td(sc, std) - ohci_softc_t *sc; - ohci_soft_td_t *std; +ohci_hash_add_td(ohci_softc_t *sc, ohci_soft_td_t *std) { int h = HASH(std->physaddr); @@ -1663,9 +1602,7 @@ ohci_hash_add_td(sc, std) /* Called at splusb() */ void -ohci_hash_rem_td(sc, std) - ohci_softc_t *sc; - ohci_soft_td_t *std; +ohci_hash_rem_td(ohci_softc_t *sc, ohci_soft_td_t *std) { SPLUSBCHECK; @@ -1673,9 +1610,7 @@ ohci_hash_rem_td(sc, std) } ohci_soft_td_t * -ohci_hash_find_td(sc, a) - ohci_softc_t *sc; - ohci_physaddr_t a; +ohci_hash_find_td(ohci_softc_t *sc, ohci_physaddr_t a) { int h = HASH(a); ohci_soft_td_t *std; @@ -1687,7 +1622,7 @@ ohci_hash_find_td(sc, a) USBDEVNAME(sc->sc_bus.bdev), (int) a, "\20\1HALT\2TOGGLE")); - for (std = LIST_FIRST(&sc->sc_hash_tds[h]); + for (std = LIST_FIRST(&sc->sc_hash_tds[h]); std != NULL; std = LIST_NEXT(std, hnext)) if (std->physaddr == a) @@ -1699,8 +1634,7 @@ ohci_hash_find_td(sc, a) } void -ohci_timeout(addr) - void *addr; +ohci_timeout(void *addr) { usbd_xfer_handle xfer = addr; int s; @@ -1716,19 +1650,17 @@ ohci_timeout(addr) #ifdef OHCI_DEBUG void -ohci_dump_tds(std) - ohci_soft_td_t *std; +ohci_dump_tds(ohci_soft_td_t *std) { for (; std; std = std->nexttd) ohci_dump_td(std); } void -ohci_dump_td(std) - ohci_soft_td_t *std; +ohci_dump_td(ohci_soft_td_t *std) { DPRINTF(("TD(%p) at %08lx: %b delay=%d ec=%d cc=%d\ncbp=0x%08lx " - "nexttd=0x%08lx be=0x%08lx\n", + "nexttd=0x%08lx be=0x%08lx\n", std, (u_long)std->physaddr, (int)le32toh(std->td.td_flags), "\20\23R\24OUT\25IN\31TOG1\32SETTOGGLE", @@ -1741,12 +1673,11 @@ ohci_dump_td(std) } void -ohci_dump_ed(sed) - ohci_soft_ed_t *sed; +ohci_dump_ed(ohci_soft_ed_t *sed) { DPRINTF(("ED(%p) at 0x%08lx: addr=%d endpt=%d maxp=%d %b\ntailp=0x%08lx " "headflags=%b headp=0x%08lx nexted=0x%08lx\n", - sed, (u_long)sed->physaddr, + sed, (u_long)sed->physaddr, OHCI_ED_GET_FA(le32toh(sed->ed.ed_flags)), OHCI_ED_GET_EN(le32toh(sed->ed.ed_flags)), OHCI_ED_GET_MAXP(le32toh(sed->ed.ed_flags)), @@ -1762,8 +1693,7 @@ ohci_dump_ed(sed) #endif usbd_status -ohci_open(pipe) - usbd_pipe_handle pipe; +ohci_open(usbd_pipe_handle pipe) { usbd_device_handle dev = pipe->device; ohci_softc_t *sc = (ohci_softc_t *)dev->bus; @@ -1818,9 +1748,9 @@ ohci_open(pipe) fmt = OHCI_ED_FORMAT_GEN; } sed->ed.ed_flags = htole32( - OHCI_ED_SET_FA(addr) | + OHCI_ED_SET_FA(addr) | OHCI_ED_SET_EN(ed->bEndpointAddress) | - OHCI_ED_DIR_TD | + OHCI_ED_DIR_TD | (dev->lowspeed ? OHCI_ED_SPEED : 0) | fmt | OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize))); sed->ed.ed_headp = sed->ed.ed_tailp = htole32(tdphys); @@ -1828,8 +1758,8 @@ ohci_open(pipe) switch (xfertype) { case UE_CONTROL: pipe->methods = &ohci_device_ctrl_methods; - err = usb_allocmem(&sc->sc_bus, - sizeof(usb_device_request_t), + err = usb_allocmem(&sc->sc_bus, + sizeof(usb_device_request_t), 0, &opipe->u.ctl.reqdma); if (err) goto bad; @@ -1862,7 +1792,7 @@ ohci_open(pipe) ohci_free_sed(sc, sed); bad0: return (USBD_NOMEM); - + } /* @@ -1870,9 +1800,7 @@ ohci_open(pipe) * Assumes that there are no pending transactions. */ void -ohci_close_pipe(pipe, head) - usbd_pipe_handle pipe; - ohci_soft_ed_t *head; +ohci_close_pipe(usbd_pipe_handle pipe, ohci_soft_ed_t *head) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; @@ -1886,7 +1814,7 @@ ohci_close_pipe(pipe, head) (le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) { ohci_physaddr_t td = sed->ed.ed_headp; ohci_soft_td_t *std; - for (std = LIST_FIRST(&sc->sc_hash_tds[HASH(td)]); + for (std = LIST_FIRST(&sc->sc_hash_tds[HASH(td)]); std != NULL; std = LIST_NEXT(std, hnext)) if (std->physaddr == td) @@ -1907,7 +1835,7 @@ ohci_close_pipe(pipe, head) ohci_free_sed(sc, opipe->sed); } -/* +/* * Abort a device request. * If this routine is called at splusb() it guarantees that the request * will be removed from the hardware scheduling and that the callback @@ -1918,9 +1846,7 @@ ohci_close_pipe(pipe, head) * interrupt processing to process it. */ void -ohci_abort_xfer(xfer, status) - usbd_xfer_handle xfer; - usbd_status status; +ohci_abort_xfer(usbd_xfer_handle xfer, usbd_status status) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; ohci_soft_ed_t *sed; @@ -1957,8 +1883,7 @@ ohci_abort_xfer(xfer, status) } void -ohci_abort_xfer_end(v) - void *v; +ohci_abort_xfer_end(void *v) { usbd_xfer_handle xfer = v; struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; @@ -2054,10 +1979,7 @@ Static usb_hub_descriptor_t ohci_hubd = { }; Static int -ohci_str(p, l, s) - usb_string_descriptor_t *p; - int l; - const char *s; +ohci_str(usb_string_descriptor_t *p, int l, const char *s) { int i; @@ -2077,8 +1999,7 @@ ohci_str(p, l, s) * Simulate a hardware hub by handling all the necessary requests. */ Static usbd_status -ohci_root_ctrl_transfer(xfer) - usbd_xfer_handle xfer; +ohci_root_ctrl_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2092,8 +2013,7 @@ ohci_root_ctrl_transfer(xfer) } Static usbd_status -ohci_root_ctrl_start(xfer) - usbd_xfer_handle xfer; +ohci_root_ctrl_start(usbd_xfer_handle xfer) { ohci_softc_t *sc = (ohci_softc_t *)xfer->pipe->device->bus; usb_device_request_t *req; @@ -2112,7 +2032,7 @@ ohci_root_ctrl_start(xfer) #endif req = &xfer->request; - DPRINTFN(4,("ohci_root_ctrl_control type=0x%02x request=%02x\n", + DPRINTFN(4,("ohci_root_ctrl_control type=0x%02x request=%02x\n", req->bmRequestType, req->bRequest)); len = UGETW(req->wLength); @@ -2127,7 +2047,7 @@ ohci_root_ctrl_start(xfer) case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE): case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE): case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT): - /* + /* * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops * for the integrated root hub. */ @@ -2295,13 +2215,13 @@ ohci_root_ctrl_start(xfer) hubd = ohci_hubd; hubd.bNbrPorts = sc->sc_noport; USETW(hubd.wHubCharacteristics, - (v & OHCI_NPS ? UHD_PWR_NO_SWITCH : + (v & OHCI_NPS ? UHD_PWR_NO_SWITCH : v & OHCI_PSM ? UHD_PWR_GANGED : UHD_PWR_INDIVIDUAL) /* XXX overcurrent */ ); hubd.bPwrOn2PwrGood = OHCI_GET_POTPGT(v); v = OREAD4(sc, OHCI_RH_DESCRIPTOR_B); - for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8) + for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8) hubd.DeviceRemovable[i++] = (u_int8_t)v; hubd.bDescLength = USB_HUB_DESCRIPTOR_SIZE + i; l = min(len, hubd.bDescLength); @@ -2393,24 +2313,21 @@ ohci_root_ctrl_start(xfer) /* Abort a root control request. */ Static void -ohci_root_ctrl_abort(xfer) - usbd_xfer_handle xfer; +ohci_root_ctrl_abort(usbd_xfer_handle xfer) { /* Nothing to do, all transfers are synchronous. */ } /* Close the root pipe. */ Static void -ohci_root_ctrl_close(pipe) - usbd_pipe_handle pipe; +ohci_root_ctrl_close(usbd_pipe_handle pipe) { DPRINTF(("ohci_root_ctrl_close\n")); /* Nothing to do. */ } Static usbd_status -ohci_root_intr_transfer(xfer) - usbd_xfer_handle xfer; +ohci_root_intr_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2424,8 +2341,7 @@ ohci_root_intr_transfer(xfer) } Static usbd_status -ohci_root_intr_start(xfer) - usbd_xfer_handle xfer; +ohci_root_intr_start(usbd_xfer_handle xfer) { usbd_pipe_handle pipe = xfer->pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; @@ -2437,8 +2353,7 @@ ohci_root_intr_start(xfer) /* Abort a root interrupt request. */ Static void -ohci_root_intr_abort(xfer) - usbd_xfer_handle xfer; +ohci_root_intr_abort(usbd_xfer_handle xfer) { int s; @@ -2454,11 +2369,10 @@ ohci_root_intr_abort(xfer) /* Close the root pipe. */ Static void -ohci_root_intr_close(pipe) - usbd_pipe_handle pipe; +ohci_root_intr_close(usbd_pipe_handle pipe) { ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; - + DPRINTF(("ohci_root_intr_close\n")); sc->sc_intrxfer = NULL; @@ -2467,8 +2381,7 @@ ohci_root_intr_close(pipe) /************************/ Static usbd_status -ohci_device_ctrl_transfer(xfer) - usbd_xfer_handle xfer; +ohci_device_ctrl_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2482,8 +2395,7 @@ ohci_device_ctrl_transfer(xfer) } Static usbd_status -ohci_device_ctrl_start(xfer) - usbd_xfer_handle xfer; +ohci_device_ctrl_start(usbd_xfer_handle xfer) { ohci_softc_t *sc = (ohci_softc_t *)xfer->pipe->device->bus; usbd_status err; @@ -2507,8 +2419,7 @@ ohci_device_ctrl_start(xfer) /* Abort a device control request. */ Static void -ohci_device_ctrl_abort(xfer) - usbd_xfer_handle xfer; +ohci_device_ctrl_abort(usbd_xfer_handle xfer) { DPRINTF(("ohci_device_ctrl_abort: xfer=%p\n", xfer)); ohci_abort_xfer(xfer, USBD_CANCELLED); @@ -2516,8 +2427,7 @@ ohci_device_ctrl_abort(xfer) /* Close a device control pipe. */ Static void -ohci_device_ctrl_close(pipe) - usbd_pipe_handle pipe; +ohci_device_ctrl_close(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; @@ -2530,8 +2440,7 @@ ohci_device_ctrl_close(pipe) /************************/ Static void -ohci_device_clear_toggle(pipe) - usbd_pipe_handle pipe; +ohci_device_clear_toggle(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; @@ -2539,14 +2448,12 @@ ohci_device_clear_toggle(pipe) } Static void -ohci_noop(pipe) - usbd_pipe_handle pipe; +ohci_noop(usbd_pipe_handle pipe) { } Static usbd_status -ohci_device_bulk_transfer(xfer) - usbd_xfer_handle xfer; +ohci_device_bulk_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2560,8 +2467,7 @@ ohci_device_bulk_transfer(xfer) } Static usbd_status -ohci_device_bulk_start(xfer) - usbd_xfer_handle xfer; +ohci_device_bulk_start(usbd_xfer_handle xfer) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; usbd_device_handle dev = opipe->pipe.device; @@ -2652,19 +2558,17 @@ ohci_device_bulk_start(xfer) } Static void -ohci_device_bulk_abort(xfer) - usbd_xfer_handle xfer; +ohci_device_bulk_abort(usbd_xfer_handle xfer) { DPRINTF(("ohci_device_bulk_abort: xfer=%p\n", xfer)); ohci_abort_xfer(xfer, USBD_CANCELLED); } -/* +/* * Close a device bulk pipe. */ Static void -ohci_device_bulk_close(pipe) - usbd_pipe_handle pipe; +ohci_device_bulk_close(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; @@ -2677,8 +2581,7 @@ ohci_device_bulk_close(pipe) /************************/ Static usbd_status -ohci_device_intr_transfer(xfer) - usbd_xfer_handle xfer; +ohci_device_intr_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2692,8 +2595,7 @@ ohci_device_intr_transfer(xfer) } Static usbd_status -ohci_device_intr_start(xfer) - usbd_xfer_handle xfer; +ohci_device_intr_start(usbd_xfer_handle xfer) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; usbd_device_handle dev = opipe->pipe.device; @@ -2721,7 +2623,7 @@ ohci_device_intr_start(xfer) tail->xfer = NULL; data->td.td_flags = htole32( - OHCI_TD_IN | OHCI_TD_NOCC | + OHCI_TD_IN | OHCI_TD_NOCC | OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY); if (xfer->flags & USBD_SHORT_XFER_OK) data->td.td_flags |= htole32(OHCI_TD_R); @@ -2769,8 +2671,7 @@ ohci_device_intr_start(xfer) /* Abort a device control request. */ Static void -ohci_device_intr_abort(xfer) - usbd_xfer_handle xfer; +ohci_device_intr_abort(usbd_xfer_handle xfer) { if (xfer->pipe->intrxfer == xfer) { DPRINTF(("ohci_device_intr_abort: remove\n")); @@ -2781,8 +2682,7 @@ ohci_device_intr_abort(xfer) /* Close a device interrupt pipe. */ Static void -ohci_device_intr_close(pipe) - usbd_pipe_handle pipe; +ohci_device_intr_close(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; @@ -2824,10 +2724,7 @@ ohci_device_intr_close(pipe) } Static usbd_status -ohci_device_setintr(sc, opipe, ival) - ohci_softc_t *sc; - struct ohci_pipe *opipe; - int ival; +ohci_device_setintr(ohci_softc_t *sc, struct ohci_pipe *opipe, int ival) { int i, j, s, best; u_int npoll, slow, shigh, nslots; @@ -2868,7 +2765,7 @@ ohci_device_setintr(sc, opipe, ival) bestbw = bw; } } - DPRINTFN(2, ("ohci_setintr: best=%d(%d..%d) bestbw=%d\n", + DPRINTFN(2, ("ohci_setintr: best=%d(%d..%d) bestbw=%d\n", best, slow, shigh, bestbw)); s = splusb(); @@ -2891,8 +2788,7 @@ ohci_device_setintr(sc, opipe, ival) /***********************/ usbd_status -ohci_device_isoc_transfer(xfer) - usbd_xfer_handle xfer; +ohci_device_isoc_transfer(usbd_xfer_handle xfer) { usbd_status err; @@ -2918,15 +2814,14 @@ ohci_device_isoc_transfer(xfer) } void -ohci_device_isoc_enter(xfer) - usbd_xfer_handle xfer; +ohci_device_isoc_enter(usbd_xfer_handle xfer) { struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe; usbd_device_handle dev = opipe->pipe.device; ohci_softc_t *sc = (ohci_softc_t *)dev->bus; ohci_soft_ed_t *sed = opipe->sed; struct iso *iso = &opipe->u.iso; - ohci_soft_itd_t *sitd, *nsitd; + ohci_soft_itd_t *sitd, *nsitd; ohci_physaddr_t buf, offs; int i, ncur, nframes; int ncross = 0; @@ -2941,7 +2836,7 @@ ohci_device_isoc_enter(xfer) for (i = ncur = 0; i < nframes; i++, ncur++) { if (ncur == OHCI_ITD_NOFFSET || /* all offsets used */ ncross > 1) { /* too many page crossings */ - + nsitd = ohci_alloc_sitd(sc); if (nsitd == NULL) { /* XXX what now? */ @@ -2951,7 +2846,7 @@ ohci_device_isoc_enter(xfer) sitd->nextitd = nsitd; sitd->itd.itd_nextitd = htole32(nsitd->physaddr); sitd->itd.itd_flags = htole32( - OHCI_ITD_NOCC | + OHCI_ITD_NOCC | OHCI_ITD_SET_SF(iso->next) | OHCI_ITD_NOINTR | OHCI_ITD_SET_FC(OHCI_ITD_NOFFSET)); @@ -2960,12 +2855,12 @@ ohci_device_isoc_enter(xfer) nsitd->itd.itd_bp0 = htole32( (buf + offs) & OHCI_ITD_PAGE_MASK); sitd = nsitd; - iso->next = iso->next + ncur; + iso->next = iso->next + ncur; ncur = 0; ncross = 0; } /* XXX byte order */ - sitd->itd.itd_offset[i] = + sitd->itd.itd_offset[i] = offs | (ncross == 1 ? OHCI_ITD_PAGE_SELECT : 0); offs += xfer->frlengths[i]; /* XXX update ncross */ @@ -2979,7 +2874,7 @@ ohci_device_isoc_enter(xfer) sitd->nextitd = nsitd; sitd->itd.itd_nextitd = htole32(nsitd->physaddr); sitd->itd.itd_flags = le32toh( - OHCI_ITD_NOCC | + OHCI_ITD_NOCC | OHCI_ITD_SET_SF(iso->next) | OHCI_ITD_SET_DI(0) | OHCI_ITD_SET_FC(ncur)); @@ -2993,29 +2888,25 @@ ohci_device_isoc_enter(xfer) } usbd_status -ohci_device_isoc_start(xfer) - usbd_xfer_handle xfer; +ohci_device_isoc_start(usbd_xfer_handle xfer) { printf("ohci_device_isoc_start: not implemented\n"); return (USBD_INVAL); } void -ohci_device_isoc_abort(xfer) - usbd_xfer_handle xfer; +ohci_device_isoc_abort(usbd_xfer_handle xfer) { } void -ohci_device_isoc_done(xfer) - usbd_xfer_handle xfer; +ohci_device_isoc_done(usbd_xfer_handle xfer) { printf("ohci_device_isoc_done: not implemented\n"); } usbd_status -ohci_setup_isoc(pipe) - usbd_pipe_handle pipe; +ohci_setup_isoc(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; struct iso *iso = &opipe->u.iso; @@ -3027,8 +2918,7 @@ ohci_setup_isoc(pipe) } void -ohci_device_isoc_close(pipe) - usbd_pipe_handle pipe; +ohci_device_isoc_close(usbd_pipe_handle pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; ohci_softc_t *sc = (ohci_softc_t *)pipe->device->bus; diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index afe28a6..4c3e77d 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -154,7 +154,7 @@ struct uhci_pipe { } u; }; -/* +/* * The uhci_intr_info free list can be global since they contain * no dma specific data. The other free lists do. */ @@ -170,10 +170,10 @@ Static void uhci_free_sqh(uhci_softc_t *, uhci_soft_qh_t *); Static uhci_intr_info_t *uhci_alloc_intr_info(uhci_softc_t *); Static void uhci_free_intr_info(uhci_intr_info_t *ii); -Static void uhci_free_std_chain(uhci_softc_t *, +Static void uhci_free_std_chain(uhci_softc_t *, uhci_soft_td_t *, uhci_soft_td_t *); Static usbd_status uhci_alloc_std_chain(struct uhci_pipe *, - uhci_softc_t *, int, int, u_int16_t, usb_dma_t *, + uhci_softc_t *, int, int, u_int16_t, usb_dma_t *, uhci_soft_td_t **, uhci_soft_td_t **); Static void uhci_timo(void *); Static void uhci_waitintr(uhci_softc_t *, usbd_xfer_handle); @@ -243,13 +243,13 @@ Static void uhci_root_intr_done(usbd_xfer_handle); Static usbd_status uhci_open(usbd_pipe_handle); Static void uhci_poll(struct usbd_bus *); -Static void uhci_softintr __P((struct usbd_bus *)); +Static void uhci_softintr(struct usbd_bus *); Static usbd_status uhci_device_request(usbd_xfer_handle xfer); Static void uhci_add_intr(uhci_softc_t *, int, uhci_soft_qh_t *); Static void uhci_remove_intr(uhci_softc_t *, int, uhci_soft_qh_t *); -Static usbd_status uhci_device_setintr(uhci_softc_t *sc, +Static usbd_status uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *pipe, int ival); Static void uhci_device_clear_toggle(usbd_pipe_handle pipe); @@ -296,7 +296,7 @@ struct usbd_bus_methods uhci_bus_methods = { uhci_freex, }; -struct usbd_pipe_methods uhci_root_ctrl_methods = { +struct usbd_pipe_methods uhci_root_ctrl_methods = { uhci_root_ctrl_transfer, uhci_root_ctrl_start, uhci_root_ctrl_abort, @@ -305,7 +305,7 @@ struct usbd_pipe_methods uhci_root_ctrl_methods = { uhci_root_ctrl_done, }; -struct usbd_pipe_methods uhci_root_intr_methods = { +struct usbd_pipe_methods uhci_root_intr_methods = { uhci_root_intr_transfer, uhci_root_intr_start, uhci_root_intr_abort, @@ -356,7 +356,7 @@ uhci_find_prev_qh(uhci_soft_qh_t *pqh, uhci_soft_qh_t *sqh) DPRINTFN(15,("uhci_find_prev_qh: pqh=%p sqh=%p\n", pqh, sqh)); for (; pqh->hlink != sqh; pqh = pqh->hlink) { -#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG) +#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG) if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) { printf("uhci_find_prev_qh: QH not found\n"); return (NULL); @@ -397,7 +397,7 @@ uhci_init(uhci_softc_t *sc) uhci_busreset(sc); /* Allocate and initialize real frame array. */ - err = usb_allocmem(&sc->sc_bus, + err = usb_allocmem(&sc->sc_bus, UHCI_FRAMELIST_COUNT * sizeof(uhci_physaddr_t), UHCI_FRAMELIST_ALIGN, &sc->sc_dma); if (err) @@ -406,7 +406,7 @@ uhci_init(uhci_softc_t *sc) UWRITE2(sc, UHCI_FRNUM, 0); /* set frame number to 0 */ UWRITE4(sc, UHCI_FLBASEADDR, DMAADDR(&sc->sc_dma, 0)); /* set frame list*/ - /* + /* * Allocate a TD, inactive, that hangs from the last QH. * This is to avoid a bug in the PIIX that makes it run berserk * otherwise. @@ -419,7 +419,7 @@ uhci_init(uhci_softc_t *sc) std->td.td_status = htole32(0); /* inactive */ std->td.td_token = htole32(0); std->td.td_buffer = htole32(0); - + /* Allocate the dummy QH marking the end and used for looping the QHs.*/ lsqh = uhci_alloc_sqh(sc); if (lsqh == NULL) @@ -449,7 +449,7 @@ uhci_init(uhci_softc_t *sc) chsqh->elink = NULL; chsqh->qh.qh_elink = htole32(UHCI_PTR_T); sc->sc_hctl_start = sc->sc_hctl_end = chsqh; - + /* Allocate dummy QH where control traffic will be queued. */ clsqh = uhci_alloc_sqh(sc); if (clsqh == NULL) @@ -460,7 +460,7 @@ uhci_init(uhci_softc_t *sc) clsqh->qh.qh_elink = htole32(UHCI_PTR_T); sc->sc_lctl_start = sc->sc_lctl_end = clsqh; - /* + /* * Make all (virtual) frame list pointers point to the interrupt * queue heads and the interrupt queue heads at the control * queue head and point the physical frame list to the virtual. @@ -483,8 +483,8 @@ uhci_init(uhci_softc_t *sc) sc->sc_vframes[i].etd = std; sc->sc_vframes[i].hqh = sqh; sc->sc_vframes[i].eqh = sqh; - for (j = i; - j < UHCI_FRAMELIST_COUNT; + for (j = i; + j < UHCI_FRAMELIST_COUNT; j += UHCI_VFRAMELIST_COUNT) sc->sc_pframes[j] = htole32(std->physaddr); } @@ -504,7 +504,7 @@ uhci_init(uhci_softc_t *sc) #endif DPRINTFN(1,("uhci_init: enabling\n")); - UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE | + UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE | UHCI_INTR_IOCE | UHCI_INTR_SPIE); /* enable interrupts */ UHCICMD(sc, UHCI_CMD_MAXP); /* Assume 64 byte packets at frame end */ @@ -540,7 +540,7 @@ uhci_detach(struct uhci_softc *sc, int flags) if (sc->sc_child != NULL) rv = config_detach(sc->sc_child, flags); - + if (rv != 0) return (rv); @@ -556,7 +556,7 @@ uhci_detach(struct uhci_softc *sc, int flags) break; SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, xfer, next); free(xfer, M_USB); - } + } /* XXX free other data structures XXX */ @@ -630,7 +630,7 @@ uhci_power(int why, void *v) s = splusb(); cmd = UREAD2(sc, UHCI_CMD); - DPRINTF(("uhci_power: sc=%p, why=%d (was %d), cmd=0x%x\n", + DPRINTF(("uhci_power: sc=%p, why=%d (was %d), cmd=0x%x\n", sc, why, sc->sc_suspend, cmd)); if (why != PWR_RESUME) { @@ -639,7 +639,7 @@ uhci_power(int why, void *v) uhci_dumpregs(sc); #endif if (sc->sc_has_timo != NULL) - usb_untimeout(uhci_timo, sc->sc_has_timo, + usb_untimeout(uhci_timo, sc->sc_has_timo, sc->sc_has_timo->timo_handle); sc->sc_bus.use_polling++; uhci_run(sc, 0); /* stop the controller */ @@ -671,13 +671,13 @@ uhci_power(int why, void *v) UHCICMD(sc, cmd | UHCI_CMD_FGR); /* force global resume */ usb_delay_ms(&sc->sc_bus, USB_RESUME_DELAY); UHCICMD(sc, cmd & ~UHCI_CMD_EGSM); /* back to normal */ - UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE | + UWRITE2(sc, UHCI_INTR, UHCI_INTR_TOCRCIE | UHCI_INTR_RIE | UHCI_INTR_IOCE | UHCI_INTR_SPIE); /* re-enable intrs */ uhci_run(sc, 1); /* and start traffic again */ usb_delay_ms(&sc->sc_bus, USB_RESUME_RECOVERY); sc->sc_bus.use_polling--; if (sc->sc_has_timo != NULL) - usb_timeout(uhci_timo, sc->sc_has_timo, + usb_timeout(uhci_timo, sc->sc_has_timo, sc->sc_ival, sc->sc_has_timo->timo_handle); #ifdef UHCI_DEBUG if (uhcidebug > 2) @@ -923,7 +923,7 @@ uhci_add_loop(uhci_softc_t *sc) { if (++sc->sc_loops == 1) { DPRINTFN(5,("uhci_start_loop: add\n")); /* Note, we don't loop back the soft pointer. */ - sc->sc_last_qh->qh.qh_hlink = + sc->sc_last_qh->qh.qh_hlink = htole32(sc->sc_hctl_start->physaddr | UHCI_PTR_QH); } } @@ -998,9 +998,9 @@ void uhci_add_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh) { uhci_soft_qh_t *eqh; - + SPLUSBCHECK; - + DPRINTFN(10, ("uhci_add_ls_ctrl: sqh=%p\n", sqh)); eqh = sc->sc_lctl_end; sqh->hlink = eqh->hlink; @@ -1015,9 +1015,9 @@ void uhci_remove_ls_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh) { uhci_soft_qh_t *pqh; - + SPLUSBCHECK; - + DPRINTFN(10, ("uhci_remove_ls_ctrl: sqh=%p\n", sqh)); /* See comment in uhci_remove_hs_ctrl() */ if (!(sqh->qh.qh_elink & htole32(UHCI_PTR_T))) { @@ -1129,12 +1129,12 @@ uhci_intr(void *arg) } if (status & UHCI_STS_HCPE) { ack |= UHCI_STS_HCPE; - printf("%s: host controller process error\n", + printf("%s: host controller process error\n", USBDEVNAME(sc->sc_bus.bdev)); } if (status & UHCI_STS_HCH) { /* no acknowledge needed */ - printf("%s: host controller halted\n", + printf("%s: host controller halted\n", USBDEVNAME(sc->sc_bus.bdev)); sc->sc_dying = 1; } @@ -1156,8 +1156,7 @@ uhci_intr(void *arg) } void -uhci_softintr(bus) - struct usbd_bus *bus; +uhci_softintr(struct usbd_bus *bus) { uhci_softc_t *sc = (uhci_softc_t *)bus; uhci_intr_info_t *ii; @@ -1206,7 +1205,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii) return; } #endif - /* + /* * If the last TD is still active we need to check whether there * is a an error somewhere in the middle, or whether there was a * short packet (SPD and not ACTIVE). @@ -1223,7 +1222,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii) goto done; /* We want short packets, and it is short: it's done */ if ((status & UHCI_TD_SPD) && - UHCI_TD_GET_ACTLEN(status) < + UHCI_TD_GET_ACTLEN(status) < UHCI_TD_GET_MAXLEN(le32toh(std->td.td_token))) goto done; } @@ -1327,7 +1326,7 @@ uhci_idone(uhci_intr_info_t *ii) upipe->nexttoggle = UHCI_TD_GET_DT(le32toh(std->td.td_token)); status &= UHCI_TD_ERROR; - DPRINTFN(10, ("uhci_check_intr: actlen=%d, status=0x%x\n", + DPRINTFN(10, ("uhci_check_intr: actlen=%d, status=0x%x\n", actlen, status)); xfer->actlen = actlen; if (status != 0) { @@ -1408,7 +1407,7 @@ uhci_waitintr(uhci_softc_t *sc, usbd_xfer_handle xfer) /* Timeout */ DPRINTF(("uhci_waitintr: timeout\n")); for (ii = LIST_FIRST(&sc->sc_intrhead); - ii != NULL && ii->xfer != xfer; + ii != NULL && ii->xfer != xfer; ii = LIST_NEXT(ii, list)) ; #ifdef DIAGNOSTIC @@ -1434,11 +1433,11 @@ uhci_reset(uhci_softc_t *sc) UHCICMD(sc, UHCI_CMD_HCRESET); /* The reset bit goes low when the controller is done. */ - for (n = 0; n < UHCI_RESET_TIMEOUT && + for (n = 0; n < UHCI_RESET_TIMEOUT && (UREAD2(sc, UHCI_CMD) & UHCI_CMD_HCRESET); n++) usb_delay_ms(&sc->sc_bus, 1); if (n >= UHCI_RESET_TIMEOUT) - printf("%s: controller did not reset\n", + printf("%s: controller did not reset\n", USBDEVNAME(sc->sc_bus.bdev)); } @@ -1587,7 +1586,7 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len, int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress; DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%d ls=%d " - "flags=0x%x\n", addr, UE_GET_ADDR(endpt), len, + "flags=0x%x\n", addr, UE_GET_ADDR(endpt), len, upipe->pipe.device->lowspeed, flags)); maxp = UGETW(upipe->pipe.endpoint->edesc->wMaxPacketSize); if (maxp == 0) { @@ -1634,14 +1633,14 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len, *ep = p; } else l = maxp; - p->td.td_token = + p->td.td_token = htole32(rd ? UHCI_TD_IN (l, endpt, addr, tog) : UHCI_TD_OUT(l, endpt, addr, tog)); p->td.td_buffer = htole32(DMAADDR(dma, i * maxp)); tog ^= 1; } *sp = lastp; - DPRINTFN(10, ("uhci_alloc_std_chain: nexttog=%d\n", + DPRINTFN(10, ("uhci_alloc_std_chain: nexttog=%d\n", upipe->nexttoggle)); return (USBD_NORMAL_COMPLETION); } @@ -1668,7 +1667,7 @@ uhci_device_bulk_transfer(usbd_xfer_handle xfer) if (err) return (err); - /* + /* * Pipe isn't running (otherwise err would be USBD_INPROG), * so start it first. */ @@ -1843,7 +1842,7 @@ uhci_device_ctrl_transfer(usbd_xfer_handle xfer) if (err) return (err); - /* + /* * Pipe isn't running (otherwise err would be USBD_INPROG), * so start it first. */ @@ -1883,7 +1882,7 @@ uhci_device_intr_transfer(usbd_xfer_handle xfer) if (err) return (err); - /* + /* * Pipe isn't running (otherwise err would be USBD_INPROG), * so start it first. */ @@ -1942,7 +1941,7 @@ uhci_device_intr_start(usbd_xfer_handle xfer) ii->isdone = 0; #endif - DPRINTFN(10,("uhci_device_intr_transfer: qhs[0]=%p\n", + DPRINTFN(10,("uhci_device_intr_transfer: qhs[0]=%p\n", upipe->u.intr.qhs[0])); for (i = 0; i < upipe->u.intr.npoll; i++) { sqh = upipe->u.intr.qhs[i]; @@ -2006,11 +2005,11 @@ uhci_device_intr_close(usbd_pipe_handle pipe) npoll = upipe->u.intr.npoll; uhci_lock_frames(sc); for (i = 0; i < npoll; i++) - uhci_remove_intr(sc, upipe->u.intr.qhs[i]->pos, + uhci_remove_intr(sc, upipe->u.intr.qhs[i]->pos, upipe->u.intr.qhs[i]); uhci_unlock_frames(sc); - /* + /* * We now have to wait for any activity on the physical * descriptors to stop. */ @@ -2086,9 +2085,9 @@ uhci_device_request(usbd_xfer_handle xfer) stat->link.std = NULL; stat->td.td_link = htole32(UHCI_PTR_T); - stat->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls | + stat->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls | UHCI_TD_ACTIVE | UHCI_TD_IOC); - stat->td.td_token = + stat->td.td_token = htole32(isread ? UHCI_TD_OUT(0, endpt, addr, 1) : UHCI_TD_IN (0, endpt, addr, 1)); stat->td.td_buffer = htole32(0); @@ -2142,7 +2141,7 @@ uhci_device_request(usbd_xfer_handle xfer) uhci_dump_qh(sxqh); for (xqh = sxqh; xqh != NULL; - xqh = (maxqh++ == 5 || xqh->hlink == sxqh || + xqh = (maxqh++ == 5 || xqh->hlink == sxqh || xqh->hlink == xqh ? NULL : xqh->hlink)) { uhci_dump_qh(xqh); } @@ -2193,7 +2192,7 @@ uhci_device_isoc_enter(usbd_xfer_handle xfer) usbd_device_handle dev = upipe->pipe.device; uhci_softc_t *sc = (uhci_softc_t *)dev->bus; struct iso *iso = &upipe->u.iso; - uhci_soft_td_t *std; + uhci_soft_td_t *std; u_int32_t buf, len, status; int s, i, next, nframes; @@ -2289,7 +2288,7 @@ uhci_device_isoc_start(usbd_xfer_handle xfer) #endif s = splusb(); - + /* Set up interrupt info. */ ii->xfer = xfer; ii->stdstart = end; @@ -2303,7 +2302,7 @@ uhci_device_isoc_start(usbd_xfer_handle xfer) ii->isdone = 0; #endif LIST_INSERT_HEAD(&sc->sc_intrhead, ii, list); - + splx(s); return (USBD_IN_PROGRESS); @@ -2603,7 +2602,7 @@ uhci_remove_intr(uhci_softc_t *sc, int n, uhci_soft_qh_t *sqh) } for (pqh = vf->hqh; pqh->hlink != sqh; pqh = pqh->hlink) -#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG) +#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG) if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) { DPRINTF(("uhci_remove_intr: QH not found\n")); return; @@ -2638,10 +2637,10 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival) DPRINTFN(2, ("uhci_setintr: ival=%d npoll=%d\n", ival, npoll)); upipe->u.intr.npoll = npoll; - upipe->u.intr.qhs = + upipe->u.intr.qhs = malloc(npoll * sizeof(uhci_soft_qh_t *), M_USBHC, M_WAITOK); - /* + /* * Figure out which offset in the schedule that has most * bandwidth left over. */ @@ -2673,7 +2672,7 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival) uhci_lock_frames(sc); /* Enter QHs into the controller data structures. */ for(i = 0; i < npoll; i++) - uhci_add_intr(sc, upipe->u.intr.qhs[i]->pos, + uhci_add_intr(sc, upipe->u.intr.qhs[i]->pos, upipe->u.intr.qhs[i]); uhci_unlock_frames(sc); @@ -2692,7 +2691,7 @@ uhci_open(usbd_pipe_handle pipe) int ival; DPRINTFN(1, ("uhci_open: pipe=%p, addr=%d, endpt=%d (%d)\n", - pipe, pipe->device->address, + pipe, pipe->device->address, ed->bEndpointAddress, sc->sc_addr)); if (pipe->device->address == sc->sc_addr) { switch (ed->bEndpointAddress) { @@ -2726,8 +2725,8 @@ uhci_open(usbd_pipe_handle pipe) uhci_free_std(sc, upipe->u.ctl.setup); goto bad; } - err = usb_allocmem(&sc->sc_bus, - sizeof(usb_device_request_t), + err = usb_allocmem(&sc->sc_bus, + sizeof(usb_device_request_t), 0, &upipe->u.ctl.reqdma); if (err) { uhci_free_sqh(sc, upipe->u.ctl.sqh); @@ -2850,7 +2849,7 @@ uhci_root_ctrl_transfer(usbd_xfer_handle xfer) if (err) return (err); - /* + /* * Pipe isn't running (otherwise err would be USBD_INPROG), * so start it first. */ @@ -2877,7 +2876,7 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) #endif req = &xfer->request; - DPRINTFN(2,("uhci_root_ctrl_control type=0x%02x request=%02x\n", + DPRINTFN(2,("uhci_root_ctrl_control type=0x%02x request=%02x\n", req->bmRequestType, req->bRequest)); len = UGETW(req->wLength); @@ -2892,7 +2891,7 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) case C(UR_CLEAR_FEATURE, UT_WRITE_DEVICE): case C(UR_CLEAR_FEATURE, UT_WRITE_INTERFACE): case C(UR_CLEAR_FEATURE, UT_WRITE_ENDPOINT): - /* + /* * DEVICE_REMOTE_WAKEUP and ENDPOINT_HALT are no-ops * for the integrated root hub. */ @@ -3060,7 +3059,7 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) goto ret; } if (len > 0) { - *(u_int8_t *)buf = + *(u_int8_t *)buf = (UREAD2(sc, port) & UHCI_PORTSC_LS) >> UHCI_PORTSC_LS_SHIFT; totlen = 1; @@ -3100,19 +3099,19 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) status = change = 0; if (x & UHCI_PORTSC_CCS) status |= UPS_CURRENT_CONNECT_STATUS; - if (x & UHCI_PORTSC_CSC) + if (x & UHCI_PORTSC_CSC) change |= UPS_C_CONNECT_STATUS; - if (x & UHCI_PORTSC_PE) + if (x & UHCI_PORTSC_PE) status |= UPS_PORT_ENABLED; - if (x & UHCI_PORTSC_POEDC) + if (x & UHCI_PORTSC_POEDC) change |= UPS_C_PORT_ENABLED; - if (x & UHCI_PORTSC_OCI) + if (x & UHCI_PORTSC_OCI) status |= UPS_OVERCURRENT_INDICATOR; - if (x & UHCI_PORTSC_OCIC) + if (x & UHCI_PORTSC_OCIC) change |= UPS_C_OVERCURRENT_INDICATOR; - if (x & UHCI_PORTSC_SUSP) + if (x & UHCI_PORTSC_SUSP) status |= UPS_SUSPEND; - if (x & UHCI_PORTSC_LSDA) + if (x & UHCI_PORTSC_LSDA) status |= UPS_LOW_SPEED; status |= UPS_PORT_POWER; if (sc->sc_isreset) diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c index 0798248..778c429 100644 --- a/sys/dev/usb/usb.c +++ b/sys/dev/usb/usb.c @@ -101,7 +101,7 @@ extern int uhcidebug; #ifdef OHCI_DEBUG extern int ohcidebug; #endif -/* +/* * 0 - do usual exploration * 1 - do not use timeout exploration * >1 - do no exploration @@ -125,7 +125,7 @@ struct usb_softc { #if defined(__NetBSD__) || defined(__OpenBSD__) cdev_decl(usb); #elif defined(__FreeBSD__) -d_open_t usbopen; +d_open_t usbopen; d_close_t usbclose; d_read_t usbread; d_ioctl_t usbioctl; @@ -237,13 +237,13 @@ USB_ATTACH(usb) dev = sc->sc_port.device; if (dev->hub == NULL) { sc->sc_dying = 1; - printf("%s: root device is not a hub\n", + printf("%s: root device is not a hub\n", USBDEVNAME(sc->sc_dev)); USB_ATTACH_ERROR_RETURN; } sc->sc_bus->root_hub = dev; #if 1 - /* + /* * Turning this code off will delay attachment of USB devices * until the USB event thread is running, which means that * the keyboard will not work until after cold boot. @@ -256,8 +256,8 @@ USB_ATTACH(usb) dev->hub->explore(sc->sc_bus->root_hub); #endif } else { - printf("%s: root hub problem, error=%d\n", - USBDEVNAME(sc->sc_dev), err); + printf("%s: root hub problem, error=%d\n", + USBDEVNAME(sc->sc_dev), err); sc->sc_dying = 1; } if (cold) @@ -429,7 +429,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) case FIONBIO: /* All handled in the upper FS layer. */ return (0); - + case FIOASYNC: if (*(int *)data) usb_async_proc = p->td_proc; @@ -448,7 +448,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) return (EIO); switch (cmd) { -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) /* This part should be deleted */ case USB_DISCOVER: break; @@ -478,7 +478,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%d\n", addr, len)); if (len < 0 || len > 32768) return (EINVAL); - if (addr < 0 || addr >= USB_MAX_DEVICES || + if (addr < 0 || addr >= USB_MAX_DEVICES || sc->sc_bus->devices[addr] == 0) return (EINVAL); if (len != 0) { @@ -490,7 +490,7 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, usb_proc_ptr p) uio.uio_offset = 0; uio.uio_segflg = UIO_USERSPACE; uio.uio_rw = - ur->request.bmRequestType & UT_READ ? + ur->request.bmRequestType & UT_READ ? UIO_READ : UIO_WRITE; uio.uio_procp = p; ptr = malloc(len, M_TEMP, M_WAITOK); @@ -553,14 +553,14 @@ usbpoll(dev_t dev, int events, usb_proc_ptr p) if (unit == USB_DEV_MINOR) { revents = 0; mask = POLLIN | POLLRDNORM; - + s = splusb(); if (events & mask && usb_nevents > 0) revents |= events & mask; if (revents == 0 && events & mask) selrecord(p, &usb_selevent); splx(s); - + return (revents); } else { #if defined(__FreeBSD__) @@ -582,7 +582,7 @@ usb_discover(void *v) int s; #endif - /* + /* * We need mutual exclusion while traversing the device tree, * but this is guaranteed since this function is only called * from the event thread for the controller. @@ -650,7 +650,7 @@ usbd_add_drv_event(int type, usbd_device_handle udev, device_ptr_t dev) struct usb_event ue; ue.u.ue_driver.ue_cookie = udev->cookie; - strncpy(ue.u.ue_driver.ue_devname, USBDEVPTRNAME(dev), + strncpy(ue.u.ue_driver.ue_devname, USBDEVPTRNAME(dev), sizeof ue.u.ue_driver.ue_devname); usb_add_event(type, &ue); } -- cgit v1.1