diff options
111 files changed, 52 insertions, 837 deletions
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 67c83f6086d6..1f91948c4ccd 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -116,7 +116,6 @@ static void atmegadci_root_intr(struct atmegadci_softc *sc); */ static const struct usb_hw_ep_profile atmegadci_ep_profile[2] = { - [0] = { .max_in_frame_size = 64, .max_out_frame_size = 64, @@ -152,7 +151,6 @@ atmegadci_clocks_on(struct atmegadci_softc *sc) { if (sc->sc_flags.clocks_off && sc->sc_flags.port_powered) { - DPRINTFN(5, "\n"); /* turn on clocks */ @@ -173,7 +171,6 @@ static void atmegadci_clocks_off(struct atmegadci_softc *sc) { if (!sc->sc_flags.clocks_off) { - DPRINTFN(5, "\n"); /* disable Transceiver ? */ @@ -488,7 +485,6 @@ repeat: count = td->remainder; } while (count > 0) { - usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ @@ -674,7 +670,6 @@ atmegadci_interrupt(struct atmegadci_softc *sc) /* check for any bus state change interrupts */ if (status & ATMEGA_UDINT_EORSTI) { - DPRINTFN(5, "end of reset\n"); /* set correct state */ @@ -697,7 +692,6 @@ atmegadci_interrupt(struct atmegadci_softc *sc) * milliseconds of inactivity on the USB BUS. */ if (status & ATMEGA_UDINT_WAKEUPI) { - DPRINTFN(5, "resume interrupt\n"); if (sc->sc_flags.status_suspend) { @@ -714,7 +708,6 @@ atmegadci_interrupt(struct atmegadci_softc *sc) atmegadci_root_intr(sc); } } else if (status & ATMEGA_UDINT_SUSPI) { - DPRINTFN(5, "suspend interrupt\n"); if (!sc->sc_flags.status_suspend) { @@ -749,7 +742,6 @@ atmegadci_interrupt(struct atmegadci_softc *sc) status = ATMEGA_READ_1(sc, ATMEGA_UEINT); /* the hardware will clear the UEINT bits automatically */ if (status) { - DPRINTFN(5, "real endpoint interrupt UEINT=0x%02x\n", status); atmegadci_interrupt_poll(sc); @@ -817,7 +809,6 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - temp.func = &atmegadci_setup_rx; temp.len = xfer->frlengths[0]; temp.pc = xfer->frbuffers + 0; @@ -851,7 +842,6 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer) need_sync = 0; } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -868,13 +858,11 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - /* regular data transfer */ temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -891,7 +879,6 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer) } if (xfer->flags_int.control_xfr) { - /* always setup a valid "pc" pointer for status and sync */ temp.pc = xfer->frbuffers + 0; temp.len = 0; @@ -907,7 +894,6 @@ atmegadci_setup_standard_chain(struct usb_xfer *xfer) /* check if we should append a status stage */ if (!xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -953,7 +939,6 @@ atmegadci_start_standard_chain(struct usb_xfer *xfer) /* poll one time - will turn on interrupts */ if (atmegadci_xfer_do_fifo(xfer)) { - /* put transfer on interrupt queue */ usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); @@ -1057,9 +1042,7 @@ atmegadci_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = atmegadci_standard_done_sub(xfer); } xfer->aframes = 1; @@ -1069,7 +1052,6 @@ atmegadci_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = atmegadci_standard_done_sub(xfer); xfer->aframes++; @@ -1080,7 +1062,6 @@ atmegadci_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = atmegadci_standard_done_sub(xfer); } done: @@ -1298,7 +1279,6 @@ atmegadci_init(struct atmegadci_softc *sc) /* disable all endpoints */ for (n = 0; n != ATMEGA_EP_MAX; n++) { - /* select endpoint */ ATMEGA_WRITE_1(sc, ATMEGA_UENUM, n); @@ -1556,7 +1536,6 @@ static const struct atmegadci_config_desc atmegadci_confd = { .bInterval = 255, }, }; - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_hub_descriptor_min atmegadci_hubd = { @@ -2036,11 +2015,9 @@ atmegadci_xfer_setup(struct usb_setup_params *parm) * compute maximum number of TDs */ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; } else { - ntd = xfer->nframes + 1 /* SYNC */ ; } @@ -2071,11 +2048,9 @@ atmegadci_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct atmegadci_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ @@ -2112,7 +2087,6 @@ atmegadci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc sc->sc_rt_addr, udev->device_index); if (udev->device_index != sc->sc_rt_addr) { - if (udev->speed != USB_SPEED_FULL) { /* not supported */ return; diff --git a/sys/dev/usb/controller/avr32dci.c b/sys/dev/usb/controller/avr32dci.c index 4ddd617f06a7..eaf0f8261b92 100644 --- a/sys/dev/usb/controller/avr32dci.c +++ b/sys/dev/usb/controller/avr32dci.c @@ -116,7 +116,6 @@ static void avr32dci_root_intr(struct avr32dci_softc *sc); */ static const struct usb_hw_ep_profile avr32dci_ep_profile[4] = { - [0] = { .max_in_frame_size = 64, .max_out_frame_size = 64, @@ -200,7 +199,6 @@ avr32dci_clocks_on(struct avr32dci_softc *sc) { if (sc->sc_flags.clocks_off && sc->sc_flags.port_powered) { - DPRINTFN(5, "\n"); /* turn on clocks */ @@ -216,7 +214,6 @@ static void avr32dci_clocks_off(struct avr32dci_softc *sc) { if (!sc->sc_flags.clocks_off) { - DPRINTFN(5, "\n"); avr32dci_mod_ctrl(sc, 0, AVR32_CTRL_DEV_EN_USBA); @@ -488,7 +485,6 @@ repeat: count = td->remainder; } while (count > 0) { - usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ @@ -662,7 +658,6 @@ avr32dci_interrupt(struct avr32dci_softc *sc) /* check for any bus state change interrupts */ if (status & AVR32_INT_ENDRESET) { - DPRINTFN(5, "end of reset\n"); /* set correct state */ @@ -684,7 +679,6 @@ avr32dci_interrupt(struct avr32dci_softc *sc) * milliseconds of inactivity on the USB BUS. */ if (status & AVR32_INT_WAKE_UP) { - DPRINTFN(5, "resume interrupt\n"); if (sc->sc_flags.status_suspend) { @@ -700,7 +694,6 @@ avr32dci_interrupt(struct avr32dci_softc *sc) avr32dci_root_intr(sc); } } else if (status & AVR32_INT_DET_SUSPD) { - DPRINTFN(5, "suspend interrupt\n"); if (!sc->sc_flags.status_suspend) { @@ -718,7 +711,6 @@ avr32dci_interrupt(struct avr32dci_softc *sc) } /* check for any endpoint interrupts */ if (status & -AVR32_INT_EPT_INT(0)) { - DPRINTFN(5, "real endpoint interrupt\n"); avr32dci_interrupt_poll(sc); @@ -786,7 +778,6 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - temp.func = &avr32dci_setup_rx; temp.len = xfer->frlengths[0]; temp.pc = xfer->frbuffers + 0; @@ -819,7 +810,6 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer) need_sync = 0; } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -836,13 +826,11 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - /* regular data transfer */ temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -859,7 +847,6 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer) } if (xfer->flags_int.control_xfr) { - /* always setup a valid "pc" pointer for status and sync */ temp.pc = xfer->frbuffers + 0; temp.len = 0; @@ -874,7 +861,6 @@ avr32dci_setup_standard_chain(struct usb_xfer *xfer) } /* check if we should append a status stage */ if (!xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -1028,9 +1014,7 @@ avr32dci_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = avr32dci_standard_done_sub(xfer); } xfer->aframes = 1; @@ -1040,7 +1024,6 @@ avr32dci_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = avr32dci_standard_done_sub(xfer); xfer->aframes++; @@ -1051,7 +1034,6 @@ avr32dci_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = avr32dci_standard_done_sub(xfer); } done: @@ -1498,7 +1480,6 @@ static const struct avr32dci_config_desc avr32dci_confd = { .bInterval = 255, }, }; - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_hub_descriptor_min avr32dci_hubd = { @@ -1977,11 +1958,9 @@ avr32dci_xfer_setup(struct usb_setup_params *parm) * compute maximum number of TDs */ if ((xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) == UE_CONTROL) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ ; } else { - ntd = xfer->nframes + 1 /* SYNC */ ; } @@ -2011,7 +1990,6 @@ avr32dci_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct avr32dci_td *td; if (parm->buf) { @@ -2057,7 +2035,6 @@ avr32dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, sc->sc_rt_addr, udev->device_index); if (udev->device_index != sc->sc_rt_addr) { - if ((udev->speed != USB_SPEED_FULL) && (udev->speed != USB_SPEED_HIGH)) { /* not supported */ diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 4ef1785f8fbf..421b95593b3a 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -146,7 +146,6 @@ static void dwc_otg_interrupt_poll_locked(struct dwc_otg_softc *); * Here is a configuration that the chip supports. */ static const struct usb_hw_ep_profile dwc_otg_ep_profile[1] = { - [0] = { .max_in_frame_size = 64,/* fixed */ .max_out_frame_size = 64, /* fixed */ @@ -331,7 +330,6 @@ dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode) } if (mode == DWC_MODE_HOST) { - /* reset active endpoints */ sc->sc_active_rx_ep = 0; @@ -373,7 +371,6 @@ dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode) } if (mode == DWC_MODE_DEVICE) { - DWC_OTG_WRITE_4(sc, DOTG_GNPTXFSIZ, (0x10 << 16) | (tx_start / 4)); fifo_size -= 0x40; @@ -386,7 +383,6 @@ dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode) sc->sc_active_rx_ep = 1; for (x = 1; x != sc->sc_dev_ep_max; x++) { - pf = sc->sc_hw_ep_profile + x; pf->usb.max_out_frame_size = 1024 * 3; @@ -509,7 +505,6 @@ dwc_otg_clocks_on(struct dwc_otg_softc *sc) { if (sc->sc_flags.clocks_off && sc->sc_flags.port_powered) { - DPRINTFN(5, "\n"); /* TODO - platform specific */ @@ -522,7 +517,6 @@ static void dwc_otg_clocks_off(struct dwc_otg_softc *sc) { if (!sc->sc_flags.clocks_off) { - DPRINTFN(5, "\n"); /* TODO - platform specific */ @@ -1835,7 +1829,6 @@ dwc_otg_host_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) if (hcint & (HCINT_ERRORS | HCINT_RETRY | HCINT_ACK | HCINT_NYET)) { - if (!(hcint & HCINT_ERRORS)) td->errcnt = 0; } @@ -1989,7 +1982,7 @@ send_pkt: } td->tx_bytes = 0; - + for (x = 0; x != td->max_packet_count; x++) { uint32_t rem_bytes; @@ -2153,12 +2146,10 @@ repeat: if ((td->ep_no == 0) && (temp != 0) && (GRXSTSRD_CHNUM_GET(temp) == 0)) { - if ((temp & GRXSTSRD_PKTSTS_MASK) != GRXSTSRD_STP_DATA && (temp & GRXSTSRD_PKTSTS_MASK) != GRXSTSRD_STP_COMPLETE) { - /* dump data - wrong direction */ dwc_otg_common_rx_ack(sc); } else { @@ -2173,7 +2164,6 @@ repeat: /* fill in more TX data, if possible */ if (td->tx_bytes != 0) { - uint16_t cpkt; /* check if packets have been transferred */ @@ -2229,7 +2219,6 @@ repeat: temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no)); if (DXEPTSIZ_GET_NPKT(temp) != 0) { - DPRINTFN(5, "busy ep=%d npkt=%d DIEPTSIZ=0x%08x " "DIEPCTL=0x%08x\n", td->ep_no, DXEPTSIZ_GET_NPKT(temp), @@ -2242,7 +2231,6 @@ repeat: /* try to optimise by sending more data */ if ((max_buffer != 0) && ((td->max_packet_size & 3) == 0)) { - /* send multiple packets at the same time */ mpkt = max_buffer / td->max_packet_size; @@ -2351,7 +2339,6 @@ not_complete: if ((td->ep_no == 0) && (temp != 0) && (GRXSTSRD_CHNUM_GET(temp) == 0)) { - if ((temp & GRXSTSRD_PKTSTS_MASK) == GRXSTSRD_STP_DATA || (temp & GRXSTSRD_PKTSTS_MASK) == @@ -2519,7 +2506,6 @@ dwc_otg_update_host_transfer_schedule_locked(struct dwc_otg_softc *sc) TAILQ_INIT(&head); if ((temp & 7) == 0) { - /* reset the schedule */ memset(sc->sc_tt_info, 0, sizeof(sc->sc_tt_info)); @@ -2667,7 +2653,6 @@ dwc_otg_update_host_transfer_schedule_locked(struct dwc_otg_softc *sc) TAILQ_CONCAT(&sc->sc_bus.intr_q.head, &head, wait_entry); if ((temp & 7) == 0) { - DPRINTFN(12, "SOF interrupt #%d, needsof=%d\n", (int)temp, (int)sc->sc_needsof); @@ -2729,7 +2714,6 @@ repeat: } if (sc->sc_last_rx_status == 0) { - temp = DWC_OTG_READ_4(sc, DOTG_GINTSTS); if (temp & GINTSTS_RXFLVL) { /* pop current status */ @@ -2738,7 +2722,6 @@ repeat: } if (sc->sc_last_rx_status != 0) { - uint8_t ep_no; temp = sc->sc_last_rx_status & @@ -2842,7 +2825,6 @@ dwc_otg_vbus_interrupt(struct dwc_otg_softc *sc, uint8_t is_on) * present else rely on the input to this function: */ if ((is_on != 0) || (sc->sc_mode == DWC_MODE_HOST)) { - if (!sc->sc_flags.status_vbus) { sc->sc_flags.status_vbus = 1; @@ -2938,7 +2920,6 @@ dwc_otg_interrupt(void *arg) DWC_OTG_READ_4(sc, DOTG_HFNUM)); if (status & GINTSTS_USBRST) { - /* set correct state */ sc->sc_flags.status_device_mode = 1; sc->sc_flags.status_bus_reset = 0; @@ -2956,7 +2937,6 @@ dwc_otg_interrupt(void *arg) /* check for any bus state change interrupts */ if (status & GINTSTS_ENUMDONE) { - uint32_t temp; DPRINTFN(5, "end of reset\n"); @@ -3070,13 +3050,11 @@ dwc_otg_interrupt(void *arg) * milliseconds of inactivity on the USB BUS. */ if (status & GINTSTS_WKUPINT) { - DPRINTFN(5, "resume interrupt\n"); dwc_otg_resume_irq(sc); } else if (status & GINTSTS_USBSUSP) { - DPRINTFN(5, "suspend interrupt\n"); dwc_otg_suspend_irq(sc); @@ -3177,7 +3155,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - if (is_host) temp.func = &dwc_otg_host_setup_tx; else @@ -3226,7 +3203,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) need_sync = 0; } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -3243,13 +3219,11 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - /* regular data transfer */ temp.short_pkt = (xfer->flags.force_short_xfer ? 0 : 1); @@ -3266,7 +3240,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) } if (xfer->flags_int.control_xfr) { - /* always setup a valid "pc" pointer for status and sync */ temp.pc = xfer->frbuffers + 0; temp.len = 0; @@ -3282,7 +3255,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) /* check if we should append a status stage */ if (!xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -3320,7 +3292,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) } else { /* check if we need to sync */ if (need_sync) { - temp.pc = xfer->frbuffers + 0; temp.len = 0; temp.short_pkt = 0; @@ -3337,7 +3308,6 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) xfer->td_transfer_last = td; if (is_host) { - struct dwc_otg_softc *sc; uint32_t hcchar; uint32_t hcsplt; @@ -3614,9 +3584,7 @@ dwc_otg_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = dwc_otg_standard_done_sub(xfer); } xfer->aframes = 1; @@ -3626,7 +3594,6 @@ dwc_otg_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = dwc_otg_standard_done_sub(xfer); xfer->aframes++; @@ -3637,7 +3604,6 @@ dwc_otg_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = dwc_otg_standard_done_sub(xfer); } done: @@ -3721,7 +3687,6 @@ dwc_otg_set_stall(struct usb_device *udev, /* clear active OUT ep */ if (!(ep_no & UE_DIR_IN)) { - sc->sc_active_rx_ep &= ~(1U << (ep_no & UE_ADDR)); if (sc->sc_last_rx_status != 0 && @@ -3851,11 +3816,9 @@ dwc_otg_device_state_change(struct usb_device *udev) /* deactivate all other endpoint but the control endpoint */ if (udev->state == USB_STATE_CONFIGURED || udev->state == USB_STATE_ADDRESSED) { - USB_BUS_LOCK(&sc->sc_bus); for (x = 1; x != sc->sc_dev_ep_max; x++) { - if (x < sc->sc_dev_in_ep_max) { DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(x), DIEPCTL_EPDIS); @@ -4057,7 +4020,6 @@ dwc_otg_init(struct dwc_otg_softc *sc) DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); if (sc->sc_mode == DWC_MODE_OTG || sc->sc_mode == DWC_MODE_DEVICE) { - /* enable all endpoint interrupts */ temp = DWC_OTG_READ_4(sc, DOTG_GHWCFG2); if (temp & GHWCFG2_MPI) { @@ -4358,7 +4320,6 @@ static const struct dwc_otg_config_desc dwc_otg_confd = { .bInterval = 255, }, }; - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_hub_descriptor_min dwc_otg_hubd = { @@ -4728,7 +4689,6 @@ tr_handle_set_port_feature: case UHF_PORT_RESET: if (sc->sc_flags.status_device_mode == 0) { - DPRINTF("PORT RESET\n"); /* enable PORT reset */ @@ -4880,11 +4840,9 @@ dwc_otg_xfer_setup(struct usb_setup_params *parm) ep_type = (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE); if (ep_type == UE_CONTROL) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC 1 */ + 1 /* SYNC 2 */ + 1 /* SYNC 3 */; } else { - ntd = xfer->nframes + 1 /* SYNC */ ; } @@ -4920,11 +4878,9 @@ dwc_otg_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct dwc_otg_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* compute shared bandwidth resource index for TT */ @@ -4973,7 +4929,6 @@ dwc_otg_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, sc->sc_rt_addr, udev->device_index); if (udev->device_index != sc->sc_rt_addr) { - if (udev->flags.usb_mode == USB_MODE_DEVICE) { if (udev->speed != USB_SPEED_FULL && udev->speed != USB_SPEED_HIGH) { diff --git a/sys/dev/usb/controller/dwc_otg_fdt.c b/sys/dev/usb/controller/dwc_otg_fdt.c index 22e4585a92b1..de47a543680b 100644 --- a/sys/dev/usb/controller/dwc_otg_fdt.c +++ b/sys/dev/usb/controller/dwc_otg_fdt.c @@ -107,7 +107,6 @@ dwc_otg_attach(device_t dev) /* get USB mode, if any */ if (OF_getprop(ofw_bus_get_node(dev), "dr_mode", &usb_mode, sizeof(usb_mode)) > 0) { - /* ensure proper zero termination */ usb_mode[sizeof(usb_mode) - 1] = 0; diff --git a/sys/dev/usb/controller/ehci.c b/sys/dev/usb/controller/ehci.c index 8aa96c035388..9e56cc51a8fb 100644 --- a/sys/dev/usb/controller/ehci.c +++ b/sys/dev/usb/controller/ehci.c @@ -455,7 +455,6 @@ ehci_init(ehci_softc_t *sc) sitd->sitd_next = sc->sc_intr_p_last[i | (EHCI_VIRTUAL_FRAMELIST_COUNT / 2)]->qh_self; - usbd_get_page(sc->sc_hw.isoc_hs_start_pc + i, 0, &buf_res); itd = buf_res.buffer; @@ -498,7 +497,6 @@ ehci_init(ehci_softc_t *sc) usbd_get_page(&sc->sc_hw.async_start_pc, 0, &buf_res); if (1) { - ehci_qh_t *qh; qh = buf_res.buffer; @@ -1053,7 +1051,6 @@ _ehci_remove_qh(ehci_qh_t *sqh, ehci_qh_t *last) /* only remove if not removed from a queue */ if (sqh->prev) { - sqh->prev->next = sqh->next; sqh->prev->qh_link = sqh->qh_link; @@ -1110,7 +1107,6 @@ ehci_non_isoc_done_sub(struct usb_xfer *xfer) usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); } while (1) { - usb_pc_cpu_invalidate(td->page_cache); status = hc32toh(sc, td->qtd_status); @@ -1220,9 +1216,7 @@ ehci_non_isoc_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = ehci_non_isoc_done_sub(xfer); } xfer->aframes = 1; @@ -1232,7 +1226,6 @@ ehci_non_isoc_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = ehci_non_isoc_done_sub(xfer); xfer->aframes++; @@ -1243,7 +1236,6 @@ ehci_non_isoc_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = ehci_non_isoc_done_sub(xfer); } done: @@ -1580,9 +1572,7 @@ restart: td_next = temp->td_next; while (1) { - if (temp->len == 0) { - if (temp->shortpkt) { break; } @@ -1592,7 +1582,6 @@ restart: average = 0; } else { - average = temp->average; if (temp->len < average) { @@ -1614,7 +1603,6 @@ restart: /* check if we are pre-computing */ if (precompute) { - /* update remaining length */ temp->len -= average; @@ -1629,9 +1617,7 @@ restart: EHCI_QTD_SET_BYTES(average)); if (average == 0) { - if (temp->auto_data_toggle == 0) { - /* update data toggle, ZLP case */ temp->qtd_status ^= @@ -1651,11 +1637,9 @@ restart: td->qtd_buffer_hi[3] = 0; td->qtd_buffer_hi[4] = 0; } else { - uint8_t x; if (temp->auto_data_toggle == 0) { - /* update data toggle */ if (howmany(average, temp->max_frame_size) & 1) { @@ -1802,7 +1786,6 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - xfer->endpoint->toggle_next = 0; temp.qtd_status &= @@ -1831,7 +1814,6 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -1858,13 +1840,11 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) EHCI_QTD_SET_TOGGLE(1)); if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.shortpkt = 0; } else { - /* regular data transfer */ temp.shortpkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -1886,7 +1866,6 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current endpoint * direction. @@ -1948,7 +1927,6 @@ ehci_setup_standard_chain(struct usb_xfer *xfer, ehci_qh_t **qh_last) if (methods != &ehci_device_intr_methods) qh_endp |= EHCI_QH_SET_NRL(8); } else { - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_FULL) { qh_endp |= EHCI_QH_SET_EPS(EHCI_QH_SPEED_FULL); } else { @@ -2132,7 +2110,6 @@ ehci_isoc_hs_done(ehci_softc_t *sc, struct usb_xfer *xfer) DPRINTFN(2, "status=0x%08x, len=%u\n", status, len); if (xfer->endpoint->usb_smask & (1 << td_no)) { - if (*plen >= len) { /* * The length is valid. NOTE: The @@ -2430,9 +2407,7 @@ ehci_device_isoc_fs_open(struct usb_xfer *xfer) /* initialize all TD's */ for (ds = 0; ds != 2; ds++) { - for (td = xfer->td_start[ds]; td; td = td->obj_next) { - td->sitd_portaddr = sitd_portaddr; /* @@ -2713,9 +2688,7 @@ ehci_device_isoc_hs_open(struct usb_xfer *xfer) /* initialize all TD's */ for (ds = 0; ds != 2; ds++) { - for (td = xfer->td_start[ds]; td; td = td->obj_next) { - /* set TD inactive */ td->itd_status[0] = 0; td->itd_status[1] = 0; @@ -2883,7 +2856,6 @@ ehci_device_isoc_hs_enter(struct usb_xfer *xfer) td_no++; if ((td_no == 8) || (nframes == 0)) { - /* the rest of the transfers are not active, if any */ for (x = td_no; x != 8; x++) { td->itd_status[x] = 0; /* not active */ @@ -3254,7 +3226,6 @@ ehci_roothub_exec(struct usb_device *udev, break; case UHF_PORT_SUSPEND: if ((v & EHCI_PS_SUSP) && (!(v & EHCI_PS_FPR))) { - /* * waking up a High Speed device is rather * complicated if @@ -3514,7 +3485,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) * compute maximum number of some structures */ if (parm->methods == &ehci_device_ctrl_methods) { - /* * The proof for the "nqtd" formula is illustrated like * this: @@ -3556,7 +3526,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_bulk_methods) { - parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 1; parm->hc_max_frame_size = EHCI_QTD_PAYLOAD_MAX; @@ -3569,7 +3538,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_intr_methods) { - if (parm->speed == USB_SPEED_HIGH) { parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 3; @@ -3591,7 +3559,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) + (xfer->max_data_length / xfer->max_hc_frame_size)); } else if (parm->methods == &ehci_device_isoc_fs_methods) { - parm->hc_max_packet_size = 0x3FF; parm->hc_max_packet_count = 1; parm->hc_max_frame_size = 0x3FF; @@ -3602,7 +3569,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) nsitd = xfer->nframes; } else if (parm->methods == &ehci_device_isoc_hs_methods) { - parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 3; parm->hc_max_frame_size = 0xC00; @@ -3614,7 +3580,6 @@ ehci_xfer_setup(struct usb_setup_params *parm) usbd_xfer_get_fps_shift(xfer); } else { - parm->hc_max_packet_size = 0x400; parm->hc_max_packet_count = 1; parm->hc_max_frame_size = 0x400; @@ -3758,7 +3723,6 @@ ehci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc, sc->sc_addr); if (udev->device_index != sc->sc_addr) { - if ((udev->speed != USB_SPEED_HIGH) && ((udev->hs_hub_addr == 0) || (udev->hs_port_no == 0) || @@ -3815,9 +3779,7 @@ ehci_device_resume(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; if ((methods == &ehci_device_bulk_methods) || @@ -3849,9 +3811,7 @@ ehci_device_suspend(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; if ((methods == &ehci_device_bulk_methods) || diff --git a/sys/dev/usb/controller/ehci.h b/sys/dev/usb/controller/ehci.h index 9d460e6f9f74..e64bdf1d68ce 100644 --- a/sys/dev/usb/controller/ehci.h +++ b/sys/dev/usb/controller/ehci.h @@ -77,7 +77,6 @@ #error "Invalid USB page size!" #endif - /* * Isochronous Transfer Descriptor. This descriptor is used for high speed * transfers only. diff --git a/sys/dev/usb/controller/ehci_fsl.c b/sys/dev/usb/controller/ehci_fsl.c index 726c40a4b31f..01f758837d75 100644 --- a/sys/dev/usb/controller/ehci_fsl.c +++ b/sys/dev/usb/controller/ehci_fsl.c @@ -83,7 +83,6 @@ static device_method_t ehci_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, bus_generic_print_child), - { 0, 0 } }; @@ -426,4 +425,3 @@ fsl_ehci_detach(device_t self) return (0); } - diff --git a/sys/dev/usb/controller/ehci_msm.c b/sys/dev/usb/controller/ehci_msm.c index 192843506dd9..1920f9c3854b 100644 --- a/sys/dev/usb/controller/ehci_msm.c +++ b/sys/dev/usb/controller/ehci_msm.c @@ -207,7 +207,6 @@ ehci_msm_detach(device_t dev) return (0); } - static device_method_t ehci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ehci_msm_probe), diff --git a/sys/dev/usb/controller/generic_ehci_fdt.c b/sys/dev/usb/controller/generic_ehci_fdt.c index 888d4d5da31d..a76bec12aab5 100644 --- a/sys/dev/usb/controller/generic_ehci_fdt.c +++ b/sys/dev/usb/controller/generic_ehci_fdt.c @@ -71,7 +71,6 @@ struct clk_list { clk_t clk; }; - struct hwrst_list { TAILQ_ENTRY(hwrst_list) next; hwreset_t rst; diff --git a/sys/dev/usb/controller/generic_xhci_fdt.c b/sys/dev/usb/controller/generic_xhci_fdt.c index 7f020a979e9e..1d0fca2ce92b 100644 --- a/sys/dev/usb/controller/generic_xhci_fdt.c +++ b/sys/dev/usb/controller/generic_xhci_fdt.c @@ -120,7 +120,6 @@ generic_xhci_fdt_detach(device_t dev) return (0); } - static device_method_t xhci_fdt_methods[] = { /* Device interface */ DEVMETHOD(device_probe, generic_xhci_fdt_probe), diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 46f572b838c7..24eba2a9a552 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -141,7 +141,6 @@ static void musbotg_ep_int_set(struct musbotg_softc *sc, int channel, int on); * Here is a configuration that the chip supports. */ static const struct usb_hw_ep_profile musbotg_ep_profile[1] = { - [0] = { .max_in_frame_size = 64,/* fixed */ .max_out_frame_size = 64, /* fixed */ @@ -264,7 +263,6 @@ musbotg_clocks_on(struct musbotg_softc *sc) { if (sc->sc_flags.clocks_off && sc->sc_flags.port_powered) { - DPRINTFN(4, "\n"); if (sc->sc_clocks_on) { @@ -280,7 +278,6 @@ static void musbotg_clocks_off(struct musbotg_softc *sc) { if (!sc->sc_flags.clocks_off) { - DPRINTFN(4, "\n"); /* XXX disable Transceiver */ @@ -615,7 +612,6 @@ musbotg_host_ctrl_setup_tx(struct musbotg_td *td) td->offset += sizeof(req); td->remainder -= sizeof(req); - MUSB2_WRITE_1(sc, MUSB2_REG_TXNAKLIMIT, MAX_NAK_TO); MUSB2_WRITE_1(sc, MUSB2_REG_TXFADDR(0), td->dev_addr); MUSB2_WRITE_1(sc, MUSB2_REG_TXHADDR(0), td->haddr); @@ -713,7 +709,6 @@ musbotg_dev_ctrl_data_rx(struct musbotg_td *td) } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - temp = count & ~3; if (temp) { @@ -739,7 +734,6 @@ musbotg_dev_ctrl_data_rx(struct musbotg_td *td) } /* check if we can optimise */ if (buf_res.length >= 4) { - /* receive data 4 bytes at a time */ bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, @@ -831,7 +825,6 @@ musbotg_dev_ctrl_data_tx(struct musbotg_td *td) } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - usbd_copy_out(td->pc, td->offset, sc->sc_bounce_buf, count); @@ -857,7 +850,6 @@ musbotg_dev_ctrl_data_tx(struct musbotg_td *td) } /* check if we can optimise */ if (buf_res.length >= 4) { - /* transmit data 4 bytes at a time */ bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, @@ -1005,7 +997,6 @@ musbotg_host_ctrl_data_rx(struct musbotg_td *td) } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - temp = count & ~3; if (temp) { @@ -1031,7 +1022,6 @@ musbotg_host_ctrl_data_rx(struct musbotg_td *td) } /* check if we can optimise */ if (buf_res.length >= 4) { - /* receive data 4 bytes at a time */ bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, @@ -1111,7 +1101,6 @@ musbotg_host_ctrl_data_tx(struct musbotg_td *td) } if (csr & MUSB2_MASK_CSR0L_NAKTIMO ) { - if (csr & MUSB2_MASK_CSR0L_TXFIFONEMPTY) { csrh = MUSB2_READ_1(sc, MUSB2_REG_TXCSRH); csrh |= MUSB2_MASK_CSR0H_FFLUSH; @@ -1131,7 +1120,6 @@ musbotg_host_ctrl_data_tx(struct musbotg_td *td) td->error = 1; } - if (td->error) { musbotg_channel_free(sc, td); return (0); /* complete */ @@ -1183,7 +1171,6 @@ musbotg_host_ctrl_data_tx(struct musbotg_td *td) } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - usbd_copy_out(td->pc, td->offset, sc->sc_bounce_buf, count); @@ -1209,7 +1196,6 @@ musbotg_host_ctrl_data_tx(struct musbotg_td *td) } /* check if we can optimise */ if (buf_res.length >= 4) { - /* transmit data 4 bytes at a time */ bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), buf_res.buffer, @@ -1333,7 +1319,6 @@ musbotg_host_ctrl_status_rx(struct musbotg_td *td) MUSB2_MASK_CSR0L_REQPKT); return (1); /* Just started */ - } csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); @@ -1522,7 +1507,6 @@ repeat: } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - temp = count & ~3; if (temp) { @@ -1548,7 +1532,6 @@ repeat: } /* check if we can optimise */ if (buf_res.length >= 4) { - /* receive data 4 bytes at a time */ bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->channel), buf_res.buffer, @@ -1648,7 +1631,6 @@ repeat: } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - usbd_copy_out(td->pc, td->offset, sc->sc_bounce_buf, count); @@ -1674,7 +1656,6 @@ repeat: } /* check if we can optimise */ if (buf_res.length >= 4) { - /* transmit data 4 bytes at a time */ bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->channel), buf_res.buffer, @@ -1871,7 +1852,6 @@ repeat: } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - temp = count & ~3; if (temp) { @@ -1897,7 +1877,6 @@ repeat: } /* check if we can optimise */ if (buf_res.length >= 4) { - /* receive data 4 bytes at a time */ bus_space_read_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->channel), buf_res.buffer, @@ -2049,7 +2028,6 @@ musbotg_host_data_tx(struct musbotg_td *td) } /* check for unaligned memory address */ if (USB_P2U(buf_res.buffer) & 3) { - usbd_copy_out(td->pc, td->offset, sc->sc_bounce_buf, count); @@ -2075,7 +2053,6 @@ musbotg_host_data_tx(struct musbotg_td *td) } /* check if we can optimise */ if (buf_res.length >= 4) { - /* transmit data 4 bytes at a time */ bus_space_write_multi_4(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(td->channel), buf_res.buffer, @@ -2158,7 +2135,6 @@ musbotg_xfer_do_fifo(struct usb_xfer *xfer) td = xfer->td_transfer_cache; while (1) { - if ((td->func) (td)) { /* operation in progress */ break; @@ -2283,11 +2259,9 @@ repeat: MUSB2_MASK_IRESUME | MUSB2_MASK_ISUSP | MUSB2_MASK_ICONN | MUSB2_MASK_IDISC | MUSB2_MASK_IVBUSERR)) { - DPRINTFN(4, "real bus interrupt 0x%08x\n", usb_status); if (usb_status & MUSB2_MASK_IRESET) { - /* set correct state */ sc->sc_flags.status_bus_reset = 1; sc->sc_flags.status_suspend = 0; @@ -2503,7 +2477,6 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) temp.func = &musbotg_dev_ctrl_setup_rx; else @@ -2559,7 +2532,6 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer) temp.pc = xfer->frbuffers + x; } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -2576,13 +2548,11 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - if (xfer->flags_int.isochronous_xfr) { /* isochronous data transfer */ /* don't force short */ @@ -2605,7 +2575,6 @@ musbotg_setup_standard_chain(struct usb_xfer *xfer) /* check for control transfer */ if (xfer->flags_int.control_xfr) { - /* always setup a valid "pc" pointer for status and sync */ temp.pc = xfer->frbuffers + 0; temp.len = 0; @@ -2697,7 +2666,6 @@ musbotg_start_standard_chain(struct usb_xfer *xfer) /* poll one time */ if (musbotg_xfer_do_fifo(xfer)) { - DPRINTFN(14, "enabled interrupts on endpoint\n"); /* put transfer on interrupt queue */ @@ -2805,9 +2773,7 @@ musbotg_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = musbotg_standard_done_sub(xfer); } xfer->aframes = 1; @@ -2817,7 +2783,6 @@ musbotg_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = musbotg_standard_done_sub(xfer); xfer->aframes++; @@ -2828,7 +2793,6 @@ musbotg_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = musbotg_standard_done_sub(xfer); } done: @@ -2927,7 +2891,6 @@ musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket, } if (ep_dir == UE_DIR_IN) { - temp = 0; /* Configure endpoint */ @@ -2988,7 +2951,6 @@ musbotg_clear_stall_sub(struct musbotg_softc *sc, uint16_t wMaxPacket, csr = MUSB2_READ_1(sc, MUSB2_REG_TXCSRL); } } else { - temp = 0; /* Configure endpoint */ @@ -3130,7 +3092,6 @@ musbotg_init(struct musbotg_softc *sc) /* wait a little bit (10ms) */ usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100); - /* disable double packet buffering */ MUSB2_WRITE_2(sc, MUSB2_REG_RXDBDIS, 0xFFFF); MUSB2_WRITE_2(sc, MUSB2_REG_TXDBDIS, 0xFFFF); @@ -3604,7 +3565,6 @@ static const struct musbotg_config_desc musbotg_confd = { .bInterval = 255, }, }; - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_hub_descriptor_min musbotg_hubd = { @@ -4121,23 +4081,18 @@ musbotg_xfer_setup(struct usb_setup_params *parm) * compute maximum number of TDs */ if (parm->methods == &musbotg_device_ctrl_methods) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; } else if (parm->methods == &musbotg_device_bulk_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else if (parm->methods == &musbotg_device_intr_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else if (parm->methods == &musbotg_device_isoc_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else { - ntd = 0; } @@ -4173,11 +4128,9 @@ musbotg_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct musbotg_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ diff --git a/sys/dev/usb/controller/ohci.c b/sys/dev/usb/controller/ohci.c index c6e82da80afc..ac3e46fb7fde 100644 --- a/sys/dev/usb/controller/ohci.c +++ b/sys/dev/usb/controller/ohci.c @@ -379,7 +379,6 @@ ohci_init(ohci_softc_t *sc) } if (1) { - ohci_ed_t *ed_int; ohci_ed_t *ed_isc; @@ -698,7 +697,6 @@ _ohci_remove_qh(ohci_ed_t *sed, ohci_ed_t *last) /* only remove if not removed from a queue */ if (sed->prev) { - sed->prev->next = sed->next; sed->prev->ed_next = sed->ed_next; @@ -818,7 +816,6 @@ ohci_non_isoc_done_sub(struct usb_xfer *xfer) usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); } while (1) { - usb_pc_cpu_invalidate(td->page_cache); phy_start = le32toh(td->td_cbp); td_flags = le32toh(td->td_flags); @@ -911,9 +908,7 @@ ohci_non_isoc_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = ohci_non_isoc_done_sub(xfer); } xfer->aframes = 1; @@ -923,7 +918,6 @@ ohci_non_isoc_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = ohci_non_isoc_done_sub(xfer); xfer->aframes++; @@ -934,7 +928,6 @@ ohci_non_isoc_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = ohci_non_isoc_done_sub(xfer); } done: @@ -957,7 +950,6 @@ ohci_check_transfer_sub(struct usb_xfer *xfer) td = xfer->td_transfer_cache; while (1) { - usb_pc_cpu_invalidate(td->page_cache); phy_start = le32toh(td->td_cbp); td_flags = le32toh(td->td_flags); @@ -994,7 +986,6 @@ ohci_check_transfer_sub(struct usb_xfer *xfer) xfer->td_transfer_cache = td; if (td) { - ed = xfer->qh_start[xfer->flags_int.curr_dma_set]; ed->ed_headp = td->td_self; @@ -1280,9 +1271,7 @@ restart: td_next = temp->td_next; while (1) { - if (temp->len == 0) { - if (temp->shortpkt) { break; } @@ -1292,7 +1281,6 @@ restart: average = 0; } else { - average = temp->average; if (temp->len < average) { @@ -1314,7 +1302,6 @@ restart: /* check if we are pre-computing */ if (precompute) { - /* update remaining length */ temp->len -= average; @@ -1337,7 +1324,6 @@ restart: td->len = 0; } else { - usbd_get_page(temp->pc, buf_offset, &buf_res); td->td_cbp = htole32(buf_res.physaddr); buf_offset += (average - 1); @@ -1428,7 +1414,6 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - temp.td_flags = htole32(OHCI_TD_SETUP | OHCI_TD_NOCC | OHCI_TD_TOGGLE_0 | OHCI_TD_NOINTR); @@ -1474,7 +1459,6 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last) } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -1495,13 +1479,11 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.shortpkt = 0; } else { - /* regular data transfer */ temp.shortpkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -1514,7 +1496,6 @@ ohci_setup_standard_chain(struct usb_xfer *xfer, ohci_ed_t **ed_last) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current endpoint * direction. @@ -1640,7 +1621,6 @@ ohci_device_done(struct usb_xfer *xfer, usb_error_t error) USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); - DPRINTFN(2, "xfer=%p, endpoint=%p, error=%d\n", xfer, xfer->endpoint, error); @@ -1923,7 +1903,6 @@ ohci_device_isoc_enter(struct usb_xfer *xfer) (length & 0xF000) || /* check if it is the last frame */ (nframes == 0)) { - /* fill current ITD */ td->itd_flags = htole32( OHCI_ITD_NOCC | @@ -2444,7 +2423,6 @@ ohci_xfer_setup(struct usb_setup_params *parm) nqh = 1; } else { - usbd_transfer_setup_sub(parm); nitd = 0; @@ -2606,9 +2584,7 @@ ohci_device_resume(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; ed = xfer->qh_start[xfer->flags_int.curr_dma_set]; @@ -2644,9 +2620,7 @@ ohci_device_suspend(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; ed = xfer->qh_start[xfer->flags_int.curr_dma_set]; diff --git a/sys/dev/usb/controller/saf1761_otg.c b/sys/dev/usb/controller/saf1761_otg.c index 9767b0ca130b..df0162e51749 100644 --- a/sys/dev/usb/controller/saf1761_otg.c +++ b/sys/dev/usb/controller/saf1761_otg.c @@ -139,7 +139,6 @@ static void saf1761_otg_enable_psof(struct saf1761_otg_softc *, uint8_t); * 8192 bytes. */ static const struct usb_hw_ep_profile saf1761_otg_ep_profile[] = { - [0] = { .max_in_frame_size = 64, .max_out_frame_size = 64, @@ -1095,7 +1094,6 @@ saf1761_otg_set_address(struct saf1761_otg_softc *sc, uint8_t addr) SAF1761_WRITE_LE_4(sc, SOTG_ADDRESS, addr | SOTG_ADDRESS_ENABLE); } - static void saf1761_read_device_fifo(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td, uint32_t len) @@ -1266,7 +1264,6 @@ saf1761_device_data_rx(struct saf1761_otg_softc *sc, struct saf1761_otg_td *td) /* check buffer status */ if ((count & SOTG_BUF_LENGTH_FILLED_MASK) != 0) { - if (td->remainder == 0) { /* * We are actually complete and have @@ -1797,7 +1794,6 @@ saf1761_otg_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - if (is_host) temp.func = &saf1761_host_setup_tx; else @@ -1872,7 +1868,6 @@ saf1761_otg_setup_standard_chain(struct usb_xfer *xfer) } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -1889,13 +1884,11 @@ saf1761_otg_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - /* regular data transfer */ temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -1927,7 +1920,6 @@ saf1761_otg_setup_standard_chain(struct usb_xfer *xfer) /* check if we should append a status stage */ if (!xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -2155,9 +2147,7 @@ saf1761_otg_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = saf1761_otg_standard_done_sub(xfer); } xfer->aframes = 1; @@ -2167,7 +2157,6 @@ saf1761_otg_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = saf1761_otg_standard_done_sub(xfer); xfer->aframes++; @@ -2178,7 +2167,6 @@ saf1761_otg_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = saf1761_otg_standard_done_sub(xfer); } done: @@ -2416,7 +2404,6 @@ saf1761_otg_init(struct saf1761_otg_softc *sc) usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100); for (x = 1;; x++) { - saf1761_otg_get_hw_ep_profile(NULL, &pf, x); if (pf == NULL) break; @@ -2795,7 +2782,6 @@ static const struct usb_pipe_methods saf1761_otg_host_isoc_methods = *------------------------------------------------------------------------* * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_device_descriptor saf1761_otg_devd = { @@ -3443,7 +3429,6 @@ saf1761_otg_xfer_setup(struct usb_setup_params *parm) ep_type = (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE); if (ep_type == UE_CONTROL) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; } else { @@ -3500,11 +3485,9 @@ saf1761_otg_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct saf1761_otg_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ @@ -3631,7 +3614,6 @@ saf1761_otg_device_resume(struct usb_device *udev) USB_BUS_SPIN_LOCK(&sc->sc_bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev != udev) continue; @@ -3687,7 +3669,6 @@ saf1761_otg_device_suspend(struct usb_device *udev) USB_BUS_SPIN_LOCK(&sc->sc_bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev != udev) continue; diff --git a/sys/dev/usb/controller/uhci.c b/sys/dev/usb/controller/uhci.c index d49d629e2eb8..32a420abbfec 100644 --- a/sys/dev/usb/controller/uhci.c +++ b/sys/dev/usb/controller/uhci.c @@ -125,7 +125,6 @@ static void uhci_dump_tds(uhci_td_t *td); #define UHCI_INTR_ENDPT 1 struct uhci_mem_layout { - struct usb_page_search buf_res; struct usb_page_search fix_res; @@ -138,7 +137,6 @@ struct uhci_mem_layout { }; struct uhci_std_temp { - struct uhci_mem_layout ml; uhci_td_t *td; uhci_td_t *td_next; @@ -220,7 +218,6 @@ uhci_mem_layout_fixup(struct uhci_mem_layout *ml, struct uhci_td *td) usbd_get_page(ml->buf_pc, ml->buf_offset, &ml->buf_res); if (ml->buf_res.length < td->len) { - /* need to do a fixup */ usbd_get_page(ml->fix_pc, 0, &ml->fix_res); @@ -263,7 +260,6 @@ uhci_mem_layout_fixup(struct uhci_mem_layout *ml, struct uhci_td *td) ml->fix_pc++; } else { - td->td_buffer = htole32(ml->buf_res.physaddr); td->fix_pc = NULL; } @@ -545,7 +541,6 @@ uhci_init(uhci_softc_t *sc) qh_intr->qh_e_next = htole32(UHCI_PTR_T); } for (x = 0; x != UHCI_VFRAMELIST_COUNT; x++) { - uhci_td_t *td_x; uhci_qh_t *qh_intr; @@ -622,7 +617,6 @@ uhci_init(uhci_softc_t *sc) pframes = buf_res.buffer; - /* * Setup UHCI framelist * @@ -985,7 +979,6 @@ _uhci_remove_qh(uhci_qh_t *sqh, uhci_qh_t *last) /* only remove if not removed from a queue */ if (sqh->h_prev) { - sqh->h_prev->h_next = sqh->h_next; sqh->h_prev->qh_h_next = sqh->qh_h_next; @@ -1046,7 +1039,6 @@ uhci_isoc_done(uhci_softc_t *sc, struct usb_xfer *xfer) len = *plen; } if (td->fix_pc) { - usbd_get_page(td->fix_pc, 0, &res); /* copy data from fixup location to real location */ @@ -1088,7 +1080,6 @@ uhci_non_isoc_done_sub(struct usb_xfer *xfer) usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); } while (1) { - usb_pc_cpu_invalidate(td->page_cache); status = le32toh(td->td_status); token = le32toh(td->td_token); @@ -1106,9 +1097,7 @@ uhci_non_isoc_done_sub(struct usb_xfer *xfer) status |= UHCI_TD_STALLED; } else if ((xfer->aframes != xfer->nframes) && (len > 0)) { - if (td->fix_pc) { - usbd_get_page(td->fix_pc, 0, &res); /* @@ -1213,7 +1202,6 @@ uhci_non_isoc_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - err = uhci_non_isoc_done_sub(xfer); } xfer->aframes = 1; @@ -1223,7 +1211,6 @@ uhci_non_isoc_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = uhci_non_isoc_done_sub(xfer); xfer->aframes++; @@ -1234,7 +1221,6 @@ uhci_non_isoc_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = uhci_non_isoc_done_sub(xfer); } done: @@ -1276,7 +1262,6 @@ uhci_check_transfer_sub(struct usb_xfer *xfer) * The data toggle is wrong and we need to toggle it ! */ while (1) { - td->td_token ^= htole32(UHCI_TD_SET_DT(1)); usb_pc_cpu_flush(td->page_cache); @@ -1376,7 +1361,6 @@ uhci_check_transfer(struct usb_xfer *xfer) */ if ((td->td_next == htole32(UHCI_PTR_T)) || (UHCI_TD_GET_ACTLEN(status) < td->len)) { - if (xfer->flags_int.short_frames_ok) { /* follow alt next */ if (td->alt_next) { @@ -1448,7 +1432,6 @@ uhci_interrupt(uhci_softc_t *sc) } if (status & (UHCI_STS_RD | UHCI_STS_HSE | UHCI_STS_HCPE | UHCI_STS_HCH)) { - if (status & UHCI_STS_RD) { #ifdef USB_DEBUG printf("%s: resume detect\n", @@ -1557,9 +1540,7 @@ restart: td_next = temp->td_next; while (1) { - if (temp->len == 0) { - if (temp->shortpkt) { break; } @@ -1570,7 +1551,6 @@ restart: average = 0; } else { - average = temp->average; if (temp->len < average) { @@ -1592,7 +1572,6 @@ restart: /* check if we are pre-computing */ if (precompute) { - /* update remaining length */ temp->len -= average; @@ -1609,13 +1588,11 @@ restart: temp->td_token ^= htole32(UHCI_TD_SET_DT(1)); if (average == 0) { - td->len = 0; td->td_buffer = 0; td->fix_pc = NULL; } else { - /* update remaining length */ temp->len -= average; @@ -1710,9 +1687,7 @@ uhci_setup_standard_chain(struct usb_xfer *xfer) /* check if we should prepend a setup message */ if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - temp.td_token &= htole32(UHCI_TD_SET_DEVADDR(0x7F) | UHCI_TD_SET_ENDPT(0xF)); temp.td_token |= htole32(UHCI_TD_PID_SETUP | @@ -1737,7 +1712,6 @@ uhci_setup_standard_chain(struct usb_xfer *xfer) } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -1767,13 +1741,11 @@ uhci_setup_standard_chain(struct usb_xfer *xfer) UHCI_TD_SET_DT(1)); if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.shortpkt = 0; } else { - /* regular data transfer */ temp.shortpkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -1793,7 +1765,6 @@ uhci_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - /* * send a DATA1 message and reverse the current endpoint * direction @@ -2119,9 +2090,7 @@ uhci_device_isoc_open(struct usb_xfer *xfer) /* initialize all TD's */ for (ds = 0; ds != 2; ds++) { - for (td = xfer->td_start[ds]; td; td = td->obj_next) { - /* mark TD as inactive */ td->td_status = htole32(UHCI_TD_IOS); td->td_token = td_token; @@ -2245,11 +2214,9 @@ uhci_device_isoc_enter(struct usb_xfer *xfer) td->fix_pc = NULL; } else { - /* fill out buffer pointer and do fixup, if any */ uhci_mem_layout_fixup(&ml, td); - } /* update status */ @@ -2410,7 +2377,6 @@ uhci_portreset(uhci_softc_t *sc, uint16_t index) x = URWMASK(UREAD2(sc, port)); UWRITE2(sc, port, x & ~UHCI_PORTSC_PR); - mtx_unlock(&sc->sc_bus.bus_mtx); /* @@ -2428,7 +2394,6 @@ uhci_portreset(uhci_softc_t *sc, uint16_t index) UWRITE2(sc, port, x | UHCI_PORTSC_PE); for (lim = 0; lim < 12; lim++) { - usb_pause_mtx(&sc->sc_bus.bus_mtx, USB_MS_TO_TICKS(usb_port_reset_delay)); @@ -2898,7 +2863,6 @@ uhci_xfer_setup(struct usb_setup_params *parm) ntd = xfer->nframes; } else { - usbd_transfer_setup_sub(parm); nqh = 0; @@ -3091,9 +3055,7 @@ uhci_device_resume(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; @@ -3133,9 +3095,7 @@ uhci_device_suspend(struct usb_device *udev) USB_BUS_LOCK(udev->bus); TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - if (xfer->xroot->udev == udev) { - methods = xfer->endpoint->methods; qh = xfer->qh_start[xfer->flags_int.curr_dma_set]; @@ -3219,7 +3179,6 @@ uhci_set_hw_power(struct usb_bus *bus) return; } - static const struct usb_bus_methods uhci_bus_methods = { .endpoint_init = uhci_ep_init, diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c index 49909bed2091..fe8e48efa01c 100644 --- a/sys/dev/usb/controller/usb_controller.c +++ b/sys/dev/usb/controller/usb_controller.c @@ -381,7 +381,6 @@ usb_bus_explore(struct usb_proc_msg *pm) } if (udev != NULL && udev->hub != NULL) { - if (bus->do_probe) { bus->do_probe = 0; bus->driver_added_refcount++; @@ -656,7 +655,6 @@ usb_bus_cleanup(struct usb_proc_msg *pm) bus = ((struct usb_bus_msg *)pm)->bus; while ((pd = LIST_FIRST(&bus->pd_cleanup_list)) != NULL) { - LIST_REMOVE(pd, pd_next); USB_BUS_UNLOCK(bus); diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index e44a646a29a3..b2e112b07f6e 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -124,7 +124,6 @@ static void uss820dci_root_intr(struct uss820dci_softc *); */ static const struct usb_hw_ep_profile uss820dci_ep_profile[] = { - [0] = { .max_in_frame_size = 32, .max_out_frame_size = 32, @@ -427,7 +426,6 @@ repeat: /* check status */ if (!(rx_flag & (USS820_RXFLG_RXFIF0 | USS820_RXFLG_RXFIF1))) { - /* read out EPCON register */ /* enable RX input */ if (!td->did_enable) { @@ -559,7 +557,6 @@ repeat: } count_copy = count; while (count > 0) { - usbd_get_page(td->pc, td->offset, &buf_res); /* get correct length */ @@ -795,7 +792,6 @@ uss820dci_interrupt(void *arg) /* check for any bus state change interrupts */ if (ssr & USS820_DCI_THREAD_IRQ) { - event = 0; if (ssr & USS820_SSR_RESET) { @@ -833,7 +829,6 @@ uss820dci_interrupt(void *arg) } } if (event) { - DPRINTF("real bus interrupt 0x%02x\n", ssr); /* complete root HUB interrupt endpoint */ @@ -916,7 +911,6 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr) { if (xfer->flags_int.control_hdr) { - temp.func = &uss820dci_setup_rx; temp.len = xfer->frlengths[0]; temp.pc = xfer->frbuffers + 0; @@ -946,7 +940,6 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer) temp.pc = xfer->frbuffers + x; } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -963,13 +956,11 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.short_pkt = 0; } else { - /* regular data transfer */ temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1; @@ -997,7 +988,6 @@ uss820dci_setup_standard_chain(struct usb_xfer *xfer) /* check if we should append a status stage */ if (!xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -1201,9 +1191,7 @@ uss820dci_standard_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) { - err = uss820dci_standard_done_sub(xfer); } xfer->aframes = 1; @@ -1213,7 +1201,6 @@ uss820dci_standard_done(struct usb_xfer *xfer) } } while (xfer->aframes != xfer->nframes) { - err = uss820dci_standard_done_sub(xfer); xfer->aframes++; @@ -1224,7 +1211,6 @@ uss820dci_standard_done(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - err = uss820dci_standard_done_sub(xfer); } done: @@ -1337,7 +1323,6 @@ uss820dci_clear_stall_sub(struct uss820dci_softc *sc, temp &= ~USS820_TXCON_TXCLR; USS820_WRITE_1(sc, USS820_TXCON, temp); } else { - /* reset data toggle */ uss820dci_update_shared_1(sc, USS820_RXSTAT, 0, USS820_RXSTAT_RXSOVW); @@ -1406,7 +1391,6 @@ uss820dci_init(struct uss820dci_softc *sc) /* wait for reset to complete */ for (n = 0;; n++) { - temp = USS820_READ_1(sc, USS820_MCSR); if (temp & USS820_MCSR_INIT) { @@ -1460,7 +1444,6 @@ uss820dci_init(struct uss820dci_softc *sc) /* disable all endpoints */ for (n = 0; n != USS820_EP_MAX; n++) { - /* select endpoint */ USS820_WRITE_1(sc, USS820_EPINDEX, n); @@ -1473,7 +1456,6 @@ uss820dci_init(struct uss820dci_softc *sc) * changed during operation! */ for (n = 0; n != USS820_EP_MAX; n++) { - uss820dci_get_hw_ep_profile(NULL, &pf, n); /* the maximum frame sizes should be the same */ @@ -1847,7 +1829,6 @@ static const struct uss820dci_config_desc uss820dci_confd = { .bInterval = 255, }, }; - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const struct usb_hub_descriptor_min uss820dci_hubd = { @@ -2293,23 +2274,18 @@ uss820dci_xfer_setup(struct usb_setup_params *parm) * compute maximum number of TDs */ if (parm->methods == &uss820dci_device_ctrl_methods) { - ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; } else if (parm->methods == &uss820dci_device_bulk_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else if (parm->methods == &uss820dci_device_intr_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else if (parm->methods == &uss820dci_device_isoc_fs_methods) { - ntd = xfer->nframes + 1 /* SYNC */ ; } else { - ntd = 0; } @@ -2328,7 +2304,6 @@ uss820dci_xfer_setup(struct usb_setup_params *parm) * get profile stuff */ if (ntd) { - ep_no = xfer->endpointno & UE_ADDR; uss820dci_get_hw_ep_profile(parm->udev, &pf, ep_no); @@ -2346,11 +2321,9 @@ uss820dci_xfer_setup(struct usb_setup_params *parm) parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); for (n = 0; n != ntd; n++) { - struct uss820dci_td *td; if (parm->buf) { - td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ @@ -2388,7 +2361,6 @@ uss820dci_ep_init(struct usb_device *udev, struct usb_endpoint_descriptor *edesc sc->sc_rt_addr); if (udev->device_index != sc->sc_rt_addr) { - if (udev->speed != USB_SPEED_FULL) { /* not supported */ return; diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index e96f910b2cb7..c37506030599 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -731,7 +731,6 @@ xhci_generic_done_sub(struct usb_xfer *xfer) usbd_xfer_set_frame_len(xfer, xfer->aframes, 0); while (1) { - usb_pc_cpu_invalidate(td->page_cache); status = td->status; @@ -811,7 +810,6 @@ xhci_generic_done(struct usb_xfer *xfer) xfer->td_transfer_cache = xfer->td_transfer_first; if (xfer->flags_int.control_xfr) { - if (xfer->flags_int.control_hdr) err = xhci_generic_done_sub(xfer); @@ -822,7 +820,6 @@ xhci_generic_done(struct usb_xfer *xfer) } while (xfer->aframes != xfer->nframes) { - err = xhci_generic_done_sub(xfer); xfer->aframes++; @@ -848,7 +845,6 @@ xhci_activate_transfer(struct usb_xfer *xfer) usb_pc_cpu_invalidate(td->page_cache); if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { - /* activate the transfer */ td->td_trb[0].dwTrb3 |= htole32(XHCI_TRB_3_CYCLE_BIT); @@ -872,7 +868,6 @@ xhci_skip_transfer(struct usb_xfer *xfer) usb_pc_cpu_invalidate(td->page_cache); if (!(td->td_trb[0].dwTrb3 & htole32(XHCI_TRB_3_CYCLE_BIT))) { - usb_pc_cpu_invalidate(td_last->page_cache); /* copy LINK TRB to current waiting location */ @@ -975,7 +970,6 @@ xhci_check_transfer(struct xhci_softc *sc, struct xhci_trb *trb) if (offset >= 0 && offset < (int64_t)sizeof(td->td_trb)) { - usb_pc_cpu_invalidate(td->page_cache); /* compute rest of remainder, if any */ @@ -1097,7 +1091,6 @@ xhci_interrupt_poll(struct xhci_softc *sc) t = 2; while (1) { - temp = le32toh(phwr->hwr_events[i].dwTrb3); k = (temp & XHCI_TRB_3_CYCLE_BIT) ? 1 : 0; @@ -1218,7 +1211,6 @@ retry: i++; if (i == (XHCI_MAX_COMMANDS - 1)) { - if (j) { temp = htole32(XHCI_TRB_3_TC_BIT | XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK) | @@ -1660,13 +1652,12 @@ xhci_interrupt(struct xhci_softc *sc) /* force clearing of pending interrupts */ if (temp & XHCI_IMAN_INTR_PEND) XWRITE4(sc, runt, XHCI_IMAN(0), temp); - + /* check for event(s) */ xhci_interrupt_poll(sc); if (status & (XHCI_STS_PCD | XHCI_STS_HCH | XHCI_STS_HSE | XHCI_STS_HCE)) { - if (status & XHCI_STS_PCD) { xhci_root_intr(sc); } @@ -1745,9 +1736,7 @@ restart: td_next = td_first = temp->td_next; while (1) { - if (temp->len == 0) { - if (temp->shortpkt) break; @@ -1757,7 +1746,6 @@ restart: average = 0; } else { - average = temp->average; if (temp->len < average) { @@ -1779,7 +1767,6 @@ restart: /* check if we are pre-computing */ if (precompute) { - /* update remaining length */ temp->len -= average; @@ -1838,7 +1825,6 @@ restart: x++; } else do { - uint32_t npkt; /* fill out buffer pointers */ @@ -2130,11 +2116,9 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) xfer->endpoint->isoc_next += xfer->nframes << shift; } else if (xfer->flags_int.control_xfr) { - /* check if we should prepend a setup message */ if (xfer->flags_int.control_hdr) { - temp.len = xfer->frlengths[0]; temp.pc = xfer->frbuffers + 0; temp.shortpkt = temp.len ? 1 : 0; @@ -2172,7 +2156,6 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) } while (x != xfer->nframes) { - /* DATA0 / DATA1 message */ temp.len = xfer->frlengths[x]; @@ -2191,7 +2174,6 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) } } if (temp.len == 0) { - /* make sure that we send an USB packet */ temp.shortpkt = 0; @@ -2200,7 +2182,6 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) temp.tlbpc = mult - 1; } else if (xfer->flags_int.isochronous_xfr) { - uint8_t tdpc; /* @@ -2226,7 +2207,6 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) else temp.tlbpc--; } else { - /* regular data transfer */ temp.shortpkt = xfer->flags.force_short_xfer ? 0 : 1; @@ -2247,7 +2227,6 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) if (xfer->flags_int.control_xfr && !xfer->flags_int.control_act) { - /* * Send a DATA1 message and invert the current * endpoint direction. @@ -2588,7 +2567,6 @@ xhci_configure_device(struct usb_device *udev) /* figure out route string and root HUB port number */ for (hubdev = udev; hubdev != NULL; hubdev = hubdev->parent_hub) { - if (hubdev->parent_hub == NULL) break; @@ -2753,7 +2731,6 @@ xhci_alloc_device_ext(struct usb_device *udev) /* initialize all endpoint LINK TRBs */ for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) { - pc = &sc->sc_hw.devs[index].endpoint_pc[i]; pg = &sc->sc_hw.devs[index].endpoint_pg[i]; @@ -2932,7 +2909,6 @@ xhci_transfer_insert(struct usb_xfer *xfer) /* check if bMaxPacketSize changed */ if (xfer->flags_int.control_xfr != 0 && pepext->trb_ep_maxp != xfer->endpoint->edesc->wMaxPacketSize[0]) { - DPRINTFN(8, "Reconfigure control endpoint\n"); /* force driver to reconfigure endpoint */ @@ -3185,7 +3161,6 @@ static const struct usb_pipe_methods xhci_device_generic_methods = *------------------------------------------------------------------------* * Simulate a hardware HUB by handling all the necessary requests. *------------------------------------------------------------------------*/ - #define HSETW(ptr, val) ptr = { (uint8_t)(val), (uint8_t)((val) >> 8) } static const @@ -3521,7 +3496,6 @@ xhci_roothub_exec(struct usb_device *udev, sc->sc_hub_desc.hubd.bPwrOn2PwrGood = 10; for (j = 1; j <= sc->sc_noport; j++) { - v = XREAD4(sc, oper, XHCI_PORTSC(j)); if (v & XHCI_PS_DR) { sc->sc_hub_desc.hubd. @@ -3959,13 +3933,11 @@ xhci_configure_msg(struct usb_proc_msg *pm) restart: TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - pepext = xhci_get_endpoint_ext(xfer->xroot->udev, xfer->endpoint->edesc); if ((pepext->trb_halted != 0) || (pepext->trb_running == 0)) { - uint16_t i; /* clear halted and running */ @@ -4009,7 +3981,6 @@ restart: } if (xfer->flags_int.did_dma_delay) { - /* remove transfer from interrupt queue (again) */ usbd_transfer_dequeue(xfer); @@ -4022,7 +3993,6 @@ restart: } TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - /* try to insert xfer on HW queue */ xhci_transfer_insert(xfer); diff --git a/sys/dev/usb/gadget/g_audio.c b/sys/dev/usb/gadget/g_audio.c index 0d5de00edac8..2ab6642cb123 100644 --- a/sys/dev/usb/gadget/g_audio.c +++ b/sys/dev/usb/gadget/g_audio.c @@ -161,7 +161,6 @@ DRIVER_MODULE(g_audio, uhub, g_audio_driver, g_audio_devclass, 0, 0); MODULE_DEPEND(g_audio, usb, 1, 1, 1); static const struct usb_config g_audio_config[G_AUDIO_N_TRANSFER] = { - [G_AUDIO_ISOC0_RD] = { .type = UE_ISOCHRONOUS, .endpoint = UE_ADDR_ANY, @@ -382,7 +381,6 @@ g_audio_detach(device_t dev) return (0); } - static int32_t g_noise(struct g_audio_softc *sc) { @@ -412,7 +410,6 @@ g_audio_make_samples(struct g_audio_softc *sc, int16_t *ptr, int samples) int j; for (i = 0; i != samples; i++) { - j = g_noise(sc); if ((sc->sc_state < 0) || (sc->sc_state >= sc->sc_pattern_len)) @@ -456,9 +453,7 @@ tr_setup: ptr = sc->sc_data_buf[nr]; if (sc->sc_mode == G_AUDIO_MODE_PATTERN) { - for (i = 0; i != G_AUDIO_FRAMES; i++) { - usbd_xfer_set_frame_data(xfer, i, ptr, sc->sc_data_len[nr][i]); g_audio_make_samples(sc, ptr, (G_AUDIO_BUFSIZE / G_AUDIO_FRAMES) / 2); @@ -466,9 +461,7 @@ tr_setup: ptr += (G_AUDIO_BUFSIZE / G_AUDIO_FRAMES) / 2; } } else if (sc->sc_mode == G_AUDIO_MODE_LOOP) { - for (i = 0; i != G_AUDIO_FRAMES; i++) { - usbd_xfer_set_frame_data(xfer, i, ptr, sc->sc_data_len[nr][i] & ~3); g_audio_make_samples(sc, ptr, sc->sc_data_len[nr][i] / 4); @@ -524,7 +517,6 @@ tr_setup: ptr = sc->sc_data_buf[nr]; for (i = 0; i != G_AUDIO_FRAMES; i++) { - usbd_xfer_set_frame_data(xfer, i, ptr, G_AUDIO_BUFSIZE / G_AUDIO_FRAMES); @@ -546,7 +538,6 @@ tr_setup: } } - static int g_audio_handle_request(device_t dev, const void *preq, void **pptr, uint16_t *plen, @@ -559,7 +550,6 @@ g_audio_handle_request(device_t dev, if (!is_complete) { if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) && (req->bRequest == 0x82 /* get min */ )) { - if (offset == 0) { USETW(sc->sc_volume_limit, 0); *plen = 2; @@ -570,7 +560,6 @@ g_audio_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) && (req->bRequest == 0x83 /* get max */ )) { - if (offset == 0) { USETW(sc->sc_volume_limit, 0x2000); *plen = 2; @@ -581,7 +570,6 @@ g_audio_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) && (req->bRequest == 0x84 /* get residue */ )) { - if (offset == 0) { USETW(sc->sc_volume_limit, 1); *plen = 2; @@ -592,7 +580,6 @@ g_audio_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_READ_CLASS_INTERFACE) && (req->bRequest == 0x81 /* get value */ )) { - if (offset == 0) { USETW(sc->sc_volume_setting, 0x2000); *plen = sizeof(sc->sc_volume_setting); @@ -603,7 +590,6 @@ g_audio_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) && (req->bRequest == 0x01 /* set value */ )) { - if (offset == 0) { *plen = sizeof(sc->sc_volume_setting); *pptr = &sc->sc_volume_setting; @@ -613,7 +599,6 @@ g_audio_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_WRITE_CLASS_ENDPOINT) && (req->bRequest == 0x01 /* set value */ )) { - if (offset == 0) { *plen = sizeof(sc->sc_sample_rate); *pptr = &sc->sc_sample_rate; diff --git a/sys/dev/usb/gadget/g_keyboard.c b/sys/dev/usb/gadget/g_keyboard.c index 7cb62c2db66d..d88e0ea432ce 100644 --- a/sys/dev/usb/gadget/g_keyboard.c +++ b/sys/dev/usb/gadget/g_keyboard.c @@ -329,7 +329,6 @@ tr_setup: usbd_transfer_submit(xfer); } else if (sc->sc_mode == G_KEYBOARD_MODE_PATTERN) { - memset(&sc->sc_data, 0, sizeof(sc->sc_data)); if ((sc->sc_state < 0) || (sc->sc_state >= G_KEYBOARD_MAX_STRLEN)) @@ -391,7 +390,6 @@ g_keyboard_handle_request(device_t dev, (req->bRequest == UR_SET_REPORT) && (req->wValue[0] == 0x00) && (req->wValue[1] == 0x02)) { - if (offset == 0) { *plen = sizeof(sc->sc_led_state); *pptr = &sc->sc_led_state; diff --git a/sys/dev/usb/gadget/g_modem.c b/sys/dev/usb/gadget/g_modem.c index b3a67c4b023c..02593a9ce5fe 100644 --- a/sys/dev/usb/gadget/g_modem.c +++ b/sys/dev/usb/gadget/g_modem.c @@ -156,7 +156,6 @@ DRIVER_MODULE(g_modem, uhub, g_modem_driver, g_modem_devclass, 0, 0); MODULE_DEPEND(g_modem, usb, 1, 1, 1); static const struct usb_config g_modem_config[G_MODEM_N_TRANSFER] = { - [G_MODEM_INTR_DT] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -403,7 +402,6 @@ g_modem_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: tr_setup: if (sc->sc_mode == G_MODEM_MODE_PATTERN) { - mod = sc->sc_pattern_len; max = sc->sc_tx_interval ? mod : G_MODEM_BUFSIZE; @@ -421,7 +419,6 @@ tr_setup: usbd_transfer_submit(xfer); } else if (sc->sc_mode == G_MODEM_MODE_LOOP) { - if (sc->sc_tx_busy == 0) break; @@ -500,7 +497,6 @@ tr_setup: } } - static int g_modem_handle_request(device_t dev, const void *preq, void **pptr, uint16_t *plen, @@ -515,7 +511,6 @@ g_modem_handle_request(device_t dev, (req->bRequest == UCDC_SET_LINE_CODING) && (req->wValue[0] == 0x00) && (req->wValue[1] == 0x00)) { - if (offset == 0) { *plen = sizeof(sc->sc_line_coding); *pptr = &sc->sc_line_coding; @@ -525,7 +520,6 @@ g_modem_handle_request(device_t dev, return (0); } else if ((req->bmRequestType == UT_WRITE_CLASS_INTERFACE) && (req->bRequest == UCDC_SET_COMM_FEATURE)) { - if (offset == 0) { *plen = sizeof(sc->sc_abstract_state); *pptr = &sc->sc_abstract_state; diff --git a/sys/dev/usb/gadget/g_mouse.c b/sys/dev/usb/gadget/g_mouse.c index 76a4add4d730..ce78b5aaa737 100644 --- a/sys/dev/usb/gadget/g_mouse.c +++ b/sys/dev/usb/gadget/g_mouse.c @@ -155,7 +155,6 @@ DRIVER_MODULE(g_mouse, uhub, g_mouse_driver, g_mouse_devclass, 0, 0); MODULE_DEPEND(g_mouse, usb, 1, 1, 1); static const struct usb_config g_mouse_config[G_MOUSE_N_TRANSFER] = { - [G_MOUSE_INTR_DT] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, diff --git a/sys/dev/usb/input/atp.c b/sys/dev/usb/input/atp.c index bb32b6826eb4..4fbdb06dd167 100644 --- a/sys/dev/usb/input/atp.c +++ b/sys/dev/usb/input/atp.c @@ -511,7 +511,6 @@ static const struct wsp_dev_params wsp_dev_params[WELLSPRING_PRODUCT_MAX] = { .finger_data_offset = WSP_TYPE3_FINGER_DATA_OFFSET, }, }; - #define ATP_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } /* TODO: STRUCT_USB_HOST_ID */ @@ -735,7 +734,6 @@ typedef enum interface_mode { HID_MODE = (uint8_t)0x08 } interface_mode; - /* * function prototypes */ @@ -1416,7 +1414,6 @@ fg_match_strokes_against_pspans(struct atp_softc *sc, atp_axis axis, if (fg_match_stroke_component( &strokep->components[axis], &pspans[i], strokep->type)) { - /* There is a match. */ strokep->components[axis].matched = true; @@ -1553,7 +1550,6 @@ fg_update_strokes(struct atp_softc *sc, fg_pspan *pspans_x, /* Update the state of strokes based on the above pspan matches. */ TAILQ_FOREACH_SAFE(strokep, &sc->sc_stroke_used, entry, strokep_next) { - if (strokep->components[X].matched && strokep->components[Y].matched) { strokep->matched = true; @@ -2367,7 +2363,6 @@ atp_intr(struct usb_xfer *xfer, usb_error_t error) if (sc->sc_status.flags & (MOUSE_POSCHANGED | MOUSE_STDBUTTONSCHANGED)) { - atp_stroke_t *strokep; u_int8_t n_movements = 0; int dx = 0; diff --git a/sys/dev/usb/input/uep.c b/sys/dev/usb/input/uep.c index 01bc26e9149f..7a65f2875448 100644 --- a/sys/dev/usb/input/uep.c +++ b/sys/dev/usb/input/uep.c @@ -267,7 +267,7 @@ uep_intr_callback(struct usb_xfer *xfer, usb_error_t error) memcpy(sc->buf + sc->buf_len, buf, res); uep_process_pkt(sc, sc->buf); sc->buf_len = 0; - + p = buf + res; len -= res; } else diff --git a/sys/dev/usb/input/uhid.c b/sys/dev/usb/input/uhid.c index 4ef19631b10f..08707fa30682 100644 --- a/sys/dev/usb/input/uhid.c +++ b/sys/dev/usb/input/uhid.c @@ -338,7 +338,6 @@ uhid_read_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: if (usb_fifo_put_bytes_max(sc->sc_fifo.fp[USB_FIFO_RX]) > 0) { - uhid_fill_get_report (&req, sc->sc_iface_no, UHID_INPUT_REPORT, sc->sc_iid, sc->sc_isize); @@ -360,7 +359,6 @@ uhid_read_callback(struct usb_xfer *xfer, usb_error_t error) } static const struct usb_config uhid_config[UHID_N_TRANSFER] = { - [UHID_INTR_DT_WR] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -569,7 +567,6 @@ uhid_ioctl(struct usb_fifo *fifo, u_long cmd, void *addr, break; } if (*(int *)addr) { - /* do a test read */ error = uhid_get_report(sc, UHID_INPUT_REPORT, @@ -746,17 +743,14 @@ uhid_attach(device_t dev) goto detach; } if (uaa->info.idVendor == USB_VENDOR_WACOM) { - /* the report descriptor for the Wacom Graphire is broken */ if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE) { - sc->sc_repdesc_size = sizeof(uhid_graphire_report_descr); sc->sc_repdesc_ptr = __DECONST(void *, &uhid_graphire_report_descr); sc->sc_flags |= UHID_FLAG_STATIC_DESC; } else if (uaa->info.idProduct == USB_PRODUCT_WACOM_GRAPHIRE3_4X5) { - static uint8_t reportbuf[] = {2, 2, 2}; /* @@ -797,7 +791,6 @@ uhid_attach(device_t dev) sc->sc_flags |= UHID_FLAG_STATIC_DESC; } if (sc->sc_repdesc_ptr == NULL) { - error = usbd_req_get_hid_desc(uaa->device, NULL, &sc->sc_repdesc_ptr, &sc->sc_repdesc_size, M_USBDEV, uaa->info.bIfaceIndex); diff --git a/sys/dev/usb/input/uhid_snes.c b/sys/dev/usb/input/uhid_snes.c index 79089782a464..5b68560a47e9 100644 --- a/sys/dev/usb/input/uhid_snes.c +++ b/sys/dev/usb/input/uhid_snes.c @@ -69,7 +69,6 @@ #define RIGHT_T 0x02 static const uint8_t uhid_snes_report_descr[] = { UHID_SNES_REPORT_DESCR() }; - #define SNES_DEV(v,p,i) { USB_VPI(v,p,i) } static const STRUCT_USB_HOST_ID snes_devs[] = { @@ -583,7 +582,6 @@ found: sc->sc_repdesc_size = sizeof(uhid_snes_report_descr); sc->sc_repdesc_ptr = __DECONST(void*, &uhid_snes_report_descr); - if (error) goto detach; diff --git a/sys/dev/usb/input/ukbd.c b/sys/dev/usb/input/ukbd.c index 33e137dbbfae..9fb3acbd7ba1 100644 --- a/sys/dev/usb/input/ukbd.c +++ b/sys/dev/usb/input/ukbd.c @@ -1,7 +1,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); - /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD * @@ -439,7 +438,6 @@ ukbd_do_poll(struct ukbd_softc *sc, uint8_t wait) } while (sc->sc_inputs == 0) { - usbd_transfer_poll(sc->sc_xfer, UKBD_N_TRANSFER); /* Delay-optimised support for repetition of keys */ @@ -549,7 +547,7 @@ ukbd_interrupt(struct ukbd_softc *sc) /* synchronize old data with new data */ sc->sc_odata = sc->sc_ndata; - + /* check if last key is still pressed */ if (sc->sc_repeat_key != 0) { const int32_t dtime = (sc->sc_repeat_time - now); @@ -886,7 +884,6 @@ ukbd_set_leds_callback(struct usb_xfer *xfer, usb_error_t error) } static const struct usb_config ukbd_config[UKBD_N_TRANSFER] = { - [UKBD_INTR_DT_0] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -1163,7 +1160,6 @@ ukbd_attach(device_t dev) /* check if we should use the boot protocol */ if (usb_test_quirk(uaa, UQ_KBD_BOOTPROTO) || (err != 0) || ukbd_any_key_valid(sc) == false) { - DPRINTF("Forcing boot protocol\n"); err = usbd_req_set_protocol(sc->sc_udev, NULL, @@ -1555,7 +1551,6 @@ next_code: if ((sc->sc_composed_char > 0) && (!(sc->sc_flags & UKBD_FLAG_COMPOSE))) { - action = sc->sc_composed_char; sc->sc_composed_char = 0; @@ -1903,7 +1898,6 @@ ukbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) } } - /* clear the internal state of the keyboard */ static void ukbd_clear_state(keyboard_t *kbd) diff --git a/sys/dev/usb/input/ums.c b/sys/dev/usb/input/ums.c index f9008a28c9e6..69d177d62bc4 100644 --- a/sys/dev/usb/input/ums.c +++ b/sys/dev/usb/input/ums.c @@ -327,7 +327,6 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error) if (dx || dy || dz || dt || dw || (buttons != sc->sc_status.button)) { - DPRINTFN(6, "x:%d y:%d z:%d t:%d w:%d buttons:0x%08x\n", dx, dy, dz, dt, dw, buttons); @@ -362,11 +361,9 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error) if ((sc->sc_info[0].sc_flags & UMS_FLAG_SBU) && (dx == 0) && (dy == 0) && (dz == 0) && (dt == 0) && (dw == 0) && (buttons == 0)) { - usb_callout_reset(&sc->sc_callout, hz / 20, &ums_put_queue_timeout, sc); } else { - usb_callout_stop(&sc->sc_callout); ums_put_queue(sc, dx, dy, dz, dt, buttons); @@ -374,7 +371,6 @@ ums_intr_callback(struct usb_xfer *xfer, usb_error_t error) ums_evdev_push(sc, dx, dy, dz, dt, buttons_reported); #endif - } } case USB_ST_SETUP: @@ -404,7 +400,6 @@ tr_setup: } static const struct usb_config ums_config[UMS_N_TRANSFER] = { - [UMS_INTR_DT] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -471,14 +466,12 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), hid_input, index, &info->sc_loc_x, &flags, &info->sc_iid_x)) { - if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { info->sc_flags |= UMS_FLAG_X_AXIS; } } if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), hid_input, index, &info->sc_loc_y, &flags, &info->sc_iid_y)) { - if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { info->sc_flags |= UMS_FLAG_Y_AXIS; } @@ -500,7 +493,6 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z), hid_input, index, &info->sc_loc_w, &flags, &info->sc_iid_w)) { - if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { info->sc_flags |= UMS_FLAG_W_AXIS; } @@ -508,7 +500,6 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, } else if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Z), hid_input, index, &info->sc_loc_z, &flags, &info->sc_iid_z)) { - if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { info->sc_flags |= UMS_FLAG_Z_AXIS; } @@ -523,7 +514,6 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, if (hid_locate(buf, len, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_TWHEEL), hid_input, index, &info->sc_loc_t, &flags, &info->sc_iid_t)) { - info->sc_loc_t.pos += 8; if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) { @@ -532,7 +522,6 @@ ums_hid_parse(struct ums_softc *sc, device_t dev, const uint8_t *buf, } else if (hid_locate(buf, len, HID_USAGE2(HUP_CONSUMER, HUC_AC_PAN), hid_input, index, &info->sc_loc_t, &flags, &info->sc_iid_t)) { - if ((flags & MOUSE_FLAGS_MASK) == MOUSE_FLAGS) info->sc_flags |= UMS_FLAG_T_AXIS; } @@ -634,7 +623,6 @@ ums_attach(device_t dev) * it has two additional buttons and a tilt wheel. */ if (usb_test_quirk(uaa, UQ_MS_BAD_CLASS)) { - sc->sc_iid = 0; info = &sc->sc_info[0]; @@ -871,7 +859,6 @@ ums_fifo_stop_read(struct usb_fifo *fifo) ums_stop_rx(sc); } - #if ((MOUSE_SYS_PACKETSIZE != 8) || \ (MOUSE_MSC_PACKETSIZE != 5)) #error "Software assumptions are not met. Please update code." @@ -884,7 +871,6 @@ ums_put_queue(struct ums_softc *sc, int32_t dx, int32_t dy, uint8_t buf[8]; if (1) { - if (dx > 254) dx = 254; if (dx < -256) diff --git a/sys/dev/usb/input/wmt.c b/sys/dev/usb/input/wmt.c index c9b10214d4e4..14733dc48209 100644 --- a/sys/dev/usb/input/wmt.c +++ b/sys/dev/usb/input/wmt.c @@ -105,7 +105,6 @@ struct wmt_hid_map_item { }; static const struct wmt_hid_map_item wmt_hid_map[WMT_N_USAGES] = { - [WMT_TIP_SWITCH] = { /* WMT_SLOT */ .name = "TIP", .usage = HID_USAGE2(HUP_DIGITIZERS, HUD_TIP_SWITCH), @@ -246,7 +245,6 @@ static const struct evdev_methods wmt_evdev_methods = { }; static const struct usb_config wmt_config[WMT_N_TRANSFER] = { - [WMT_INTR_DT] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -423,7 +421,6 @@ wmt_process_report(struct wmt_softc *sc, uint8_t *buf, int len) /* Use protocol Type B for reporting events */ for (cont = 0; cont < nconts; cont++) { - bzero(slot_data, sizeof(sc->slot_data)); WMT_FOREACH_USAGE(sc->caps, usage) { if (sc->locs[cont][usage].size > 0) diff --git a/sys/dev/usb/input/wsp.c b/sys/dev/usb/input/wsp.c index 38c3080e49ae..3b1cdf9ec811 100644 --- a/sys/dev/usb/input/wsp.c +++ b/sys/dev/usb/input/wsp.c @@ -457,7 +457,6 @@ static const struct wsp_dev_params wsp_dev_params[WSP_FLAG_MAX] = { .um_switch_off = 0x00, }, }; - #define WSP_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } static const STRUCT_USB_HOST_ID wsp_devs[] = { @@ -1004,7 +1003,6 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) } if ((sc->dt_sum / tun.scr_hor_threshold) != 0 && sc->ntaps == 2 && sc->scr_mode == WSP_SCR_HOR) { - /* * translate T-axis into button presses * until further @@ -1151,7 +1149,6 @@ wsp_intr_callback(struct usb_xfer *xfer, usb_error_t error) sc->dz_sum = 0; sc->rdz = 0; } - } sc->pre_pos_x = sc->pos_x[0]; sc->pre_pos_y = sc->pos_y[0]; @@ -1260,7 +1257,6 @@ wsp_stop_read(struct usb_fifo *fifo) usbd_transfer_stop(sc->sc_xfer[WSP_INTR_DT]); } - static int wsp_open(struct usb_fifo *fifo, int fflags) { diff --git a/sys/dev/usb/misc/cp2112.c b/sys/dev/usb/misc/cp2112.c index a2ead7d5371e..7c1fc14d56d0 100644 --- a/sys/dev/usb/misc/cp2112.c +++ b/sys/dev/usb/misc/cp2112.c @@ -1080,7 +1080,6 @@ out: return (err); } - static int cp2112iic_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) { diff --git a/sys/dev/usb/misc/udbp.c b/sys/dev/usb/misc/udbp.c index 4e47ed6eef2b..8d987dee00c8 100644 --- a/sys/dev/usb/misc/udbp.c +++ b/sys/dev/usb/misc/udbp.c @@ -43,7 +43,6 @@ __FBSDID("$FreeBSD$"); * streaming, and <5k to avoid overflowing the system with small TDs). */ - /* probe/attach/detach: * Connect the driver to the hardware and netgraph * @@ -116,7 +115,6 @@ SYSCTL_INT(_hw_usb_udbp, OID_AUTO, debug, CTLFLAG_RWTUN, #define UDBP_Q_MAXLEN 50 struct udbp_softc { - struct mtx sc_mtx; struct ng_bt_mbufq sc_xmitq_hipri; /* hi-priority transmit queue */ struct ng_bt_mbufq sc_xmitq; /* low-priority transmit queue */ @@ -203,7 +201,6 @@ static struct ng_type ng_udbp_typestruct = { /* USB config */ static const struct usb_config udbp_config[UDBP_T_MAX] = { - [UDBP_T_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -458,7 +455,6 @@ tr_setup: usbd_transfer_start(sc->sc_xfer[UDBP_T_RD_CS]); } return; - } } @@ -490,7 +486,6 @@ udbp_bulk_read_complete(node_p node, hook_p hook, void *arg1, int arg2) m = sc->sc_bulk_in_buffer; if (m) { - sc->sc_bulk_in_buffer = NULL; if ((sc->sc_hook == NULL) || @@ -567,7 +562,6 @@ udbp_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) usbd_transfer_start(sc->sc_xfer[UDBP_T_WR_CS]); } return; - } } @@ -828,13 +822,11 @@ ng_udbp_disconnect(hook_p hook) int error = 0; if (sc != NULL) { - mtx_lock(&sc->sc_mtx); if (hook != sc->sc_hook) { error = EINVAL; } else { - /* stop bulk-in transfer */ usbd_transfer_stop(sc->sc_xfer[UDBP_T_RD_CS]); usbd_transfer_stop(sc->sc_xfer[UDBP_T_RD]); diff --git a/sys/dev/usb/misc/udbp.h b/sys/dev/usb/misc/udbp.h index e6fd85326152..ec455f1426cc 100644 --- a/sys/dev/usb/misc/udbp.h +++ b/sys/dev/usb/misc/udbp.h @@ -49,7 +49,6 @@ date command: date -u +'%s' */ #define NGM_UDBP_COOKIE 944609300 - #define NG_UDBP_HOOK_NAME "data" /* Netgraph commands understood by this node type */ diff --git a/sys/dev/usb/misc/ugold.c b/sys/dev/usb/misc/ugold.c index abb0a0b7f159..2e042233cec5 100644 --- a/sys/dev/usb/misc/ugold.c +++ b/sys/dev/usb/misc/ugold.c @@ -146,7 +146,6 @@ MODULE_VERSION(ugold, 1); USB_PNP_HOST_INFO(ugold_devs); static const struct usb_config ugold_config[UGOLD_N_TRANSFER] = { - [UGOLD_INTR_DT] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -259,7 +258,7 @@ ugold_attach(device_t dev) SYSCTL_CHILDREN(sensor_tree), OID_AUTO, "inner_calib", CTLFLAG_RWTUN, &sc->sc_calib[UGOLD_INNER], 0, "Inner calibration temperature in microCelcius"); - + SYSCTL_ADD_INT(device_get_sysctl_ctx(dev), SYSCTL_CHILDREN(sensor_tree), OID_AUTO, "outer", CTLFLAG_RD, &sc->sc_sensor[UGOLD_OUTER], 0, @@ -316,7 +315,6 @@ ugold_ds75_temp(uint8_t msb, uint8_t lsb) return (((int64_t)temp * (int64_t)1000000LL) >> 24); } - static void ugold_intr_callback(struct usb_xfer *xfer, usb_error_t error) { diff --git a/sys/dev/usb/net/if_aue.c b/sys/dev/usb/net/if_aue.c index 7805ffe5d02a..36cd5f4b59ba 100644 --- a/sys/dev/usb/net/if_aue.c +++ b/sys/dev/usb/net/if_aue.c @@ -229,7 +229,6 @@ static int aue_ifmedia_upd(struct ifnet *); static void aue_ifmedia_sts(struct ifnet *, struct ifmediareq *); static const struct usb_config aue_config[AUE_N_TRANSFER] = { - [AUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -755,7 +754,6 @@ aue_intr_callback(struct usb_xfer *xfer, usb_error_t error) if ((ifp->if_drv_flags & IFF_DRV_RUNNING) && actlen >= (int)sizeof(pkt)) { - pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); @@ -800,13 +798,11 @@ aue_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTFN(11, "received %d bytes\n", actlen); if (sc->sc_flags & AUE_FLAG_VER_2) { - if (actlen == 0) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; } } else { - if (actlen <= (int)(sizeof(stat) + ETHER_CRC_LEN)) { if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); goto tr_setup; @@ -883,13 +879,11 @@ tr_setup: if (m->m_pkthdr.len > MCLBYTES) m->m_pkthdr.len = MCLBYTES; if (sc->sc_flags & AUE_FLAG_VER_2) { - usbd_xfer_set_frame_len(xfer, 0, m->m_pkthdr.len); usbd_m_copy_in(pc, 0, m, 0, m->m_pkthdr.len); } else { - usbd_xfer_set_frame_len(xfer, 0, (m->m_pkthdr.len + 2)); /* diff --git a/sys/dev/usb/net/if_axe.c b/sys/dev/usb/net/if_axe.c index e8ac65980a3c..6da8d7f9b971 100644 --- a/sys/dev/usb/net/if_axe.c +++ b/sys/dev/usb/net/if_axe.c @@ -221,7 +221,6 @@ static int axe_rxeof(struct usb_ether *, struct usb_page_cache *, static void axe_csum_cfg(struct usb_ether *); static const struct usb_config axe_config[AXE_N_TRANSFER] = { - [AXE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -1026,7 +1025,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -1270,7 +1268,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/net/if_axge.c b/sys/dev/usb/net/if_axge.c index ffb7d721e98e..bf023a57ff7e 100644 --- a/sys/dev/usb/net/if_axge.c +++ b/sys/dev/usb/net/if_axge.c @@ -594,7 +594,6 @@ axge_detach(device_t dev) sc = device_get_softc(dev); ue = &sc->sc_ue; if (device_is_attached(dev)) { - /* wait for any post attach or other command to complete */ usb_proc_drain(&ue->ue_tq); @@ -740,7 +739,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/net/if_cdce.c b/sys/dev/usb/net/if_cdce.c index b260836f6d00..7bdb81f97b38 100644 --- a/sys/dev/usb/net/if_cdce.c +++ b/sys/dev/usb/net/if_cdce.c @@ -127,7 +127,6 @@ SYSCTL_INT(_hw_usb_cdce, OID_AUTO, interval, CTLFLAG_RWTUN, &cdce_tx_interval, 0 #endif static const struct usb_config cdce_config[CDCE_N_TRANSFER] = { - [CDCE_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -181,7 +180,6 @@ static const struct usb_config cdce_config[CDCE_N_TRANSFER] = { #if CDCE_HAVE_NCM static const struct usb_config cdce_ncm_config[CDCE_N_TRANSFER] = { - [CDCE_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -601,11 +599,9 @@ cdce_attach(device_t dev) data_iface_no = ud->bSlaveInterface[0]; for (i = 0;; i++) { - iface = usbd_get_iface(uaa->device, i); if (iface) { - id = usbd_get_interface_descriptor(iface); if (id && (id->bInterfaceNumber == data_iface_no)) { @@ -648,7 +644,6 @@ alloc_transfers: pcfg = cdce_config; /* Default Configuration */ for (i = 0; i != 32; i++) { - error = usbd_set_alt_interface_index(uaa->device, sc->sc_ifaces_index[0], i); if (error) @@ -683,7 +678,6 @@ alloc_transfers: } if (error) { - /* fake MAC address */ device_printf(dev, "faking MAC address\n"); @@ -693,11 +687,9 @@ alloc_transfers: sc->sc_ue.ue_eaddr[5] = device_get_unit(dev); } else { - memset(sc->sc_ue.ue_eaddr, 0, sizeof(sc->sc_ue.ue_eaddr)); for (i = 0; i != (ETHER_ADDR_LEN * 2); i++) { - char c = eaddr_str[i]; if ('0' <= c && c <= '9') @@ -807,7 +799,6 @@ cdce_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: tr_setup: for (x = 0; x != CDCE_FRAMES_MAX; x++) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -988,7 +979,6 @@ cdce_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTF("received %u bytes in %u frames\n", actlen, aframes); for (x = 0; x != aframes; x++) { - m = sc->sc_rx_buf[x]; sc->sc_rx_buf[x] = NULL; len = usbd_xfer_frame_len(xfer, x); @@ -1149,7 +1139,7 @@ tr_setup: USETDW(req.data + 0, speed); /* Upstream bit rate */ USETDW(req.data + 4, speed); /* Downstream bit rate */ - + pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_in(pc, 0, &req, sizeof(req)); usbd_xfer_set_frame_len(xfer, 0, sizeof(req)); @@ -1185,7 +1175,6 @@ cdce_handle_request(device_t dev, */ if (req->bmRequestType == UT_WRITE_CLASS_INTERFACE && \ req->bRequest == UCDC_NCM_SET_ETHERNET_PACKET_FILTER) { - if (is_complete == 1) { mtx_lock(&sc->sc_mtx); sc->sc_notify_state = CDCE_NOTIFY_SPEED_CHANGE; @@ -1244,7 +1233,6 @@ cdce_ncm_fill_tx_frames(struct usb_xfer *xfer, uint8_t index) retval = 2; for (n = 0; n != sc->sc_ncm.tx_nframe; n++) { - /* check if end of transmit buffer is reached */ if (offset >= sc->sc_ncm.tx_max) @@ -1517,7 +1505,6 @@ cdce_ncm_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) sumdata = 0; for (x = 0; x != nframes; x++) { - offset = UGETW(sc->sc_ncm.dp[x].wFrameIndex); temp = UGETW(sc->sc_ncm.dp[x].wFrameLength); diff --git a/sys/dev/usb/net/if_cdceem.c b/sys/dev/usb/net/if_cdceem.c index 9a6cbf9afdfe..92441d8173ee 100644 --- a/sys/dev/usb/net/if_cdceem.c +++ b/sys/dev/usb/net/if_cdceem.c @@ -877,4 +877,3 @@ cdceem_resume(device_t dev) CDCEEM_DEBUG(sc, "go"); return (0); } - diff --git a/sys/dev/usb/net/if_cue.c b/sys/dev/usb/net/if_cue.c index 598daba412f2..2a1e4b88c19a 100644 --- a/sys/dev/usb/net/if_cue.c +++ b/sys/dev/usb/net/if_cue.c @@ -137,7 +137,6 @@ SYSCTL_INT(_hw_usb_cue, OID_AUTO, debug, CTLFLAG_RWTUN, &cue_debug, 0, #endif static const struct usb_config cue_config[CUE_N_TRANSFER] = { - [CUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -497,7 +496,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/net/if_ipheth.c b/sys/dev/usb/net/if_ipheth.c index 6eee9aededcd..f43c39154662 100644 --- a/sys/dev/usb/net/if_ipheth.c +++ b/sys/dev/usb/net/if_ipheth.c @@ -93,7 +93,6 @@ SYSCTL_INT(_hw_usb_ipheth, OID_AUTO, debug, CTLFLAG_RWTUN, &ipheth_debug, 0, "De #endif static const struct usb_config ipheth_config[IPHETH_N_TRANSFER] = { - [IPHETH_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -413,7 +412,6 @@ ipheth_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: tr_setup: for (x = 0; x != IPHETH_TX_FRAMES_MAX; x++) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) @@ -488,7 +486,6 @@ ipheth_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTF("received %u bytes in %u frames\n", actlen, aframes); for (x = 0; x != aframes; x++) { - m = sc->sc_rx_buf[x]; sc->sc_rx_buf[x] = NULL; len = usbd_xfer_frame_len(xfer, x); diff --git a/sys/dev/usb/net/if_kue.c b/sys/dev/usb/net/if_kue.c index 1691db73266f..21719e486d14 100644 --- a/sys/dev/usb/net/if_kue.c +++ b/sys/dev/usb/net/if_kue.c @@ -178,7 +178,6 @@ SYSCTL_INT(_hw_usb_kue, OID_AUTO, debug, CTLFLAG_RWTUN, &kue_debug, 0, #endif static const struct usb_config kue_config[KUE_N_TRANSFER] = { - [KUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -276,7 +275,6 @@ kue_ctl(struct kue_softc *sc, uint8_t rw, uint8_t breq, else req.bmRequestType = UT_READ_VENDOR_DEVICE; - req.bRequest = breq; USETW(req.wValue, val); USETW(req.wIndex, 0); @@ -578,7 +576,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -646,7 +643,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/net/if_mos.c b/sys/dev/usb/net/if_mos.c index d42934ff28de..d8f9cefedee9 100644 --- a/sys/dev/usb/net/if_mos.c +++ b/sys/dev/usb/net/if_mos.c @@ -156,8 +156,6 @@ SYSCTL_INT(_hw_usb_mos, OID_AUTO, debug, CTLFLAG_RWTUN, &mos_debug, 0, #define USB_PRODUCT_MOSCHIP_MCS7730 0x7730 #define USB_PRODUCT_SITECOMEU_LN030 0x0021 - - /* Various supported device vendors/products. */ static const STRUCT_USB_HOST_ID mos_devs[] = { {USB_VPI(USB_VENDOR_MOSCHIP, USB_PRODUCT_MOSCHIP_MCS7730, MCS7730)}, @@ -198,7 +196,6 @@ static void mos_setmulti(struct usb_ether *); static void mos_setpromisc(struct usb_ether *); static const struct usb_config mos_config[MOS_ENDPT_MAX] = { - [MOS_ENDPT_TX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -270,7 +267,6 @@ static const struct usb_ether_methods mos_ue_methods = { .ue_mii_sts = mos_ifmedia_sts, }; - static int mos_reg_read_1(struct mos_softc *sc, int reg) { @@ -721,7 +717,6 @@ mos_attach(device_t dev) ue->ue_mtx = &sc->sc_mtx; ue->ue_methods = &mos_ue_methods; - if (sc->mos_flags & MCS7730) { MOS_DPRINTFN("model: MCS7730"); } else if (sc->mos_flags & MCS7830) { @@ -736,13 +731,11 @@ mos_attach(device_t dev) } return (0); - detach: mos_detach(dev); return (ENXIO); } - static void mos_attach_post(struct usb_ether *ue) { @@ -773,9 +766,6 @@ mos_detach(device_t dev) return (0); } - - - /* * A frame has been uploaded: pass the resulting mbuf chain up to * the higher level protocols. @@ -861,8 +851,6 @@ mos_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) struct usb_page_cache *pc; struct mbuf *m; - - switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: MOS_DPRINTFN("transfer of complete"); @@ -882,7 +870,6 @@ tr_setup: usbd_xfer_set_frame_len(xfer, 0, m->m_pkthdr.len); - /* * if there's a BPF listener, bounce a copy * of this frame to him: @@ -923,7 +910,6 @@ mos_tick(struct usb_ether *ue) } } - static void mos_start(struct usb_ether *ue) { @@ -978,7 +964,6 @@ mos_init(struct usb_ether *ue) mos_start(ue); } - static void mos_intr_callback(struct usb_xfer *xfer, usb_error_t error) { @@ -1011,7 +996,6 @@ tr_setup: } } - /* * Stop the adapter and free any mbufs allocated to the * RX and TX lists. diff --git a/sys/dev/usb/net/if_muge.c b/sys/dev/usb/net/if_muge.c index d008bc36457e..3d008ea3c66a 100644 --- a/sys/dev/usb/net/if_muge.c +++ b/sys/dev/usb/net/if_muge.c @@ -224,7 +224,6 @@ static int lan78xx_chip_init(struct muge_softc *sc); static int muge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static const struct usb_config muge_config[MUGE_N_TRANSFER] = { - [MUGE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, diff --git a/sys/dev/usb/net/if_rue.c b/sys/dev/usb/net/if_rue.c index a9ccf15edd7e..58135332dacf 100644 --- a/sys/dev/usb/net/if_rue.c +++ b/sys/dev/usb/net/if_rue.c @@ -162,7 +162,6 @@ static int rue_ifmedia_upd(struct ifnet *); static void rue_ifmedia_sts(struct ifnet *, struct ifmediareq *); static const struct usb_config rue_config[RUE_N_TRANSFER] = { - [RUE_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -654,7 +653,6 @@ rue_intr_callback(struct usb_xfer *xfer, usb_error_t error) if (ifp && (ifp->if_drv_flags & IFF_DRV_RUNNING) && actlen >= (int)sizeof(pkt)) { - pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, &pkt, sizeof(pkt)); diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index 17480606ff3d..84610c894f4d 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -154,7 +154,6 @@ static const struct usb_device_id smsc_devs[] = { #undef SMSC_DEV }; - #ifdef USB_DEBUG #define smsc_dbg_printf(sc, fmt, args...) \ do { \ @@ -170,11 +169,10 @@ static const struct usb_device_id smsc_devs[] = { #define smsc_err_printf(sc, fmt, args...) \ device_printf((sc)->sc_ue.ue_dev, "error: " fmt, ##args) - #define ETHER_IS_VALID(addr) \ (!ETHER_IS_MULTICAST(addr) && !ETHER_IS_ZERO(addr)) - + static device_probe_t smsc_probe; static device_attach_t smsc_attach; static device_detach_t smsc_detach; @@ -202,7 +200,6 @@ static int smsc_chip_init(struct smsc_softc *sc); static int smsc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); static const struct usb_config smsc_config[SMSC_N_TRANSFER] = { - [SMSC_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -275,7 +272,7 @@ smsc_read_reg(struct smsc_softc *sc, uint32_t off, uint32_t *data) smsc_warn_printf(sc, "Failed to read register 0x%0x\n", off); *data = le32toh(buf); - + return (err); } @@ -299,7 +296,7 @@ smsc_write_reg(struct smsc_softc *sc, uint32_t off, uint32_t data) usb_error_t err; SMSC_LOCK_ASSERT(sc, MA_OWNED); - + buf = htole32(data); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -334,7 +331,7 @@ smsc_wait_for_bits(struct smsc_softc *sc, uint32_t reg, uint32_t bits) const usb_ticks_t max_ticks = USB_MS_TO_TICKS(1000); uint32_t val; int err; - + SMSC_LOCK_ASSERT(sc, MA_OWNED); start_ticks = (usb_ticks_t)ticks; @@ -387,7 +384,6 @@ smsc_eeprom_read(struct smsc_softc *sc, uint16_t off, uint8_t *buf, uint16_t buf /* start reading the bytes, one at a time */ for (i = 0; i < buflen; i++) { - val = SMSC_EEPROM_CMD_BUSY | (SMSC_EEPROM_CMD_ADDR_MASK & (off + i)); if ((err = smsc_write_reg(sc, SMSC_EEPROM_CMD, val)) != 0) goto done; @@ -413,7 +409,7 @@ smsc_eeprom_read(struct smsc_softc *sc, uint16_t off, uint8_t *buf, uint16_t buf buf[i] = (val & 0xff); } - + done: if (!locked) SMSC_UNLOCK(sc); @@ -461,7 +457,7 @@ smsc_miibus_readreg(device_t dev, int phy, int reg) smsc_read_reg(sc, SMSC_MII_DATA, &val); val = le32toh(val); - + done: if (!locked) SMSC_UNLOCK(sc); @@ -518,8 +514,6 @@ done: return (0); } - - /** * smsc_miibus_statchg - Called to detect phy status change * @dev: usb ether device @@ -572,13 +566,13 @@ smsc_miibus_statchg(device_t dev) smsc_dbg_printf(sc, "link flag not set\n"); goto done; } - + err = smsc_read_reg(sc, SMSC_AFC_CFG, &afc_cfg); if (err) { smsc_warn_printf(sc, "failed to read initial AFC_CFG, error %d\n", err); goto done; } - + /* Enable/disable full duplex operation and TX/RX pause */ if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { smsc_dbg_printf(sc, "full duplex operation\n"); @@ -609,7 +603,7 @@ smsc_miibus_statchg(device_t dev) err += smsc_write_reg(sc, SMSC_AFC_CFG, afc_cfg); if (err) smsc_warn_printf(sc, "media change failed, error %d\n", err); - + done: if (!locked) SMSC_UNLOCK(sc); @@ -696,7 +690,6 @@ smsc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) return (1); } - /** * smsc_setmulti - Setup multicast * @ue: usb ethernet device context @@ -749,7 +742,6 @@ smsc_setmulti(struct usb_ether *ue) smsc_write_reg(sc, SMSC_MAC_CSR, sc->sc_mac_csr); } - /** * smsc_setpromisc - Enables/disables promiscuous mode * @ue: usb ethernet device context @@ -776,7 +768,6 @@ smsc_setpromisc(struct usb_ether *ue) smsc_write_reg(sc, SMSC_MAC_CSR, sc->sc_mac_csr); } - /** * smsc_sethwcsum - Enable or disable H/W UDP and TCP checksumming * @sc: driver soft context @@ -856,7 +847,7 @@ smsc_setmacaddress(struct smsc_softc *sc, const uint8_t *addr) val = (addr[5] << 8) | addr[4]; err = smsc_write_reg(sc, SMSC_MAC_ADDRH, val); - + done: return (err); } @@ -888,7 +879,6 @@ smsc_reset(struct smsc_softc *sc) smsc_chip_init(sc); } - /** * smsc_init - Initialises the LAN95xx chip * @ue: USB ether interface @@ -964,7 +954,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - + /* There is always a zero length frame after bringing the IF up */ if (actlen < (sizeof(rxhdr) + ETHER_CRC_LEN)) goto tr_setup; @@ -1000,7 +990,6 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) if (rxhdr & SMSC_RX_STAT_COLLISION) if_inc_counter(ifp, IFCOUNTER_COLLISIONS, 1); } else { - /* Check if the ethernet frame is too big or too small */ if ((pktlen < ETHER_HDR_LEN) || (pktlen > (actlen - off))) goto tr_setup; @@ -1023,7 +1012,6 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) /* Check if RX TCP/UDP checksumming is being offloaded */ if ((ifp->if_capenable & IFCAP_RXCSUM) != 0) { - struct ether_header *eh; eh = mtod(m, struct ether_header *); @@ -1088,7 +1076,7 @@ smsc_bulk_read_callback(struct usb_xfer *xfer, usb_error_t error) /* Update the offset to move to the next potential packet */ off += pktlen; } - + /* FALLTHROUGH */ case USB_ST_SETUP: @@ -1315,16 +1303,15 @@ smsc_phy_init(struct smsc_softc *sc) smsc_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, SMSC_PHY_INTR_STAT); smsc_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, SMSC_PHY_INTR_MASK, (SMSC_PHY_INTR_ANEG_COMP | SMSC_PHY_INTR_LINK_DOWN)); - + /* Restart auto-negotation */ bmcr = smsc_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR); bmcr |= BMCR_STARTNEG; smsc_miibus_writereg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR, bmcr); - + return (0); } - /** * smsc_chip_init - Initialises the chip after power on * @sc: driver soft context @@ -1400,8 +1387,6 @@ smsc_chip_init(struct smsc_softc *sc) /* Set the default bulk in delay (magic value from Linux driver) */ smsc_write_reg(sc, SMSC_BULK_IN_DLY, 0x00002000); - - /* * Initialise the RX interface */ @@ -1415,7 +1400,7 @@ smsc_chip_init(struct smsc_softc *sc) */ reg_val &= ~SMSC_HW_CFG_RXDOFF; reg_val |= (ETHER_ALIGN << 9) & SMSC_HW_CFG_RXDOFF; - + /* The following setings are used for 'turbo mode', a.k.a multiple frames * per Rx transaction (again info taken form Linux driver). */ @@ -1453,7 +1438,7 @@ smsc_chip_init(struct smsc_softc *sc) smsc_warn_printf(sc, "failed to read MAC_CSR (err=%d)\n", err); goto init_failed; } - + /* Vlan */ smsc_write_reg(sc, SMSC_VLAN1, (uint32_t)ETHERTYPE_VLAN); @@ -1463,7 +1448,6 @@ smsc_chip_init(struct smsc_softc *sc) if ((err = smsc_phy_init(sc)) != 0) goto init_failed; - /* * Start TX */ @@ -1481,7 +1465,7 @@ smsc_chip_init(struct smsc_softc *sc) SMSC_UNLOCK(sc); return (0); - + init_failed: if (!locked) SMSC_UNLOCK(sc); @@ -1490,7 +1474,6 @@ init_failed: return (err); } - /** * smsc_ioctl - ioctl function for the device * @ifp: interface pointer @@ -1512,9 +1495,8 @@ smsc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) int rc; int mask; int reinit; - - if (cmd == SIOCSIFCAP) { + if (cmd == SIOCSIFCAP) { sc = uether_getsc(ue); ifr = (struct ifreq *)data; @@ -1569,13 +1551,12 @@ smsc_attach_post(struct usb_ether *ue) /* Setup some of the basics */ sc->sc_phyno = 1; - /* Attempt to get the mac address, if an EEPROM is not attached this * will just return FF:FF:FF:FF:FF:FF, so in such cases we invent a MAC * address based on urandom. */ memset(sc->sc_ue.ue_eaddr, 0xff, ETHER_ADDR_LEN); - + /* Check if there is already a MAC address in the register */ if ((smsc_read_reg(sc, SMSC_MAC_ADDRL, &mac_l) == 0) && (smsc_read_reg(sc, SMSC_MAC_ADDRH, &mac_h) == 0)) { @@ -1586,12 +1567,11 @@ smsc_attach_post(struct usb_ether *ue) sc->sc_ue.ue_eaddr[1] = (uint8_t)((mac_l >> 8) & 0xff); sc->sc_ue.ue_eaddr[0] = (uint8_t)((mac_l) & 0xff); } - + /* MAC address is not set so try to read from EEPROM, if that fails generate * a random MAC address. */ if (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr)) { - err = smsc_eeprom_read(sc, 0x01, sc->sc_ue.ue_eaddr, ETHER_ADDR_LEN); #ifdef FDT if ((err != 0) || (!ETHER_IS_VALID(sc->sc_ue.ue_eaddr))) @@ -1603,12 +1583,11 @@ smsc_attach_post(struct usb_ether *ue) sc->sc_ue.ue_eaddr[0] |= 0x02; /* locally administered */ } } - + /* Initialise the chip for the first time */ smsc_chip_init(sc); } - /** * smsc_attach_post_sub - Called after the driver attached to the USB interface * @ue: the USB ethernet device @@ -1642,7 +1621,7 @@ smsc_attach_post_sub(struct usb_ether *ue) */ ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_VLAN_MTU; ifp->if_hwassist = 0; - + /* TX checksuming is disabled (for now?) ifp->if_capabilities |= IFCAP_TXCSUM; ifp->if_capenable |= IFCAP_TXCSUM; @@ -1660,7 +1639,6 @@ smsc_attach_post_sub(struct usb_ether *ue) return (error); } - /** * smsc_probe - Probe the interface. * @dev: smsc device handle @@ -1685,7 +1663,6 @@ smsc_probe(device_t dev) return (usbd_lookup_id_by_uaa(smsc_devs, sizeof(smsc_devs), uaa)); } - /** * smsc_attach - Attach the interface. * @dev: smsc device handle diff --git a/sys/dev/usb/net/if_udav.c b/sys/dev/usb/net/if_udav.c index e29f41d6245b..6d6d020ac875 100644 --- a/sys/dev/usb/net/if_udav.c +++ b/sys/dev/usb/net/if_udav.c @@ -120,7 +120,6 @@ static miibus_writereg_t udav_miibus_writereg; static miibus_statchg_t udav_miibus_statchg; static const struct usb_config udav_config[UDAV_N_TRANSFER] = { - [UDAV_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, diff --git a/sys/dev/usb/net/if_urndisreg.h b/sys/dev/usb/net/if_urndisreg.h index c76807a53623..660624cf7e37 100644 --- a/sys/dev/usb/net/if_urndisreg.h +++ b/sys/dev/usb/net/if_urndisreg.h @@ -36,7 +36,6 @@ enum { }; struct urndis_softc { - struct usb_ether sc_ue; struct mtx sc_mtx; diff --git a/sys/dev/usb/net/if_usie.c b/sys/dev/usb/net/if_usie.c index a0430835a1d9..8c64ad71be4d 100644 --- a/sys/dev/usb/net/if_usie.c +++ b/sys/dev/usb/net/if_usie.c @@ -496,7 +496,6 @@ usie_detach(device_t self) for (x = 0; x != USIE_UCOM_MAX; x++) usbd_transfer_unsetup(sc->sc_uc_xfer[x], USIE_UC_N_XFER); - device_claim_softc(self); usie_free_softc(sc); @@ -634,14 +633,12 @@ usie_uc_rx_callback(struct usb_xfer *xfer, usb_error_t error) /* handle CnS response */ if (ucom == sc->sc_ucom && actlen >= USIE_HIPCNS_MIN) { - DPRINTF("transferred=%u\n", actlen); /* check if it is really CnS reply */ usbd_copy_out(pc, 0, sc->sc_resp_temp, 1); if (sc->sc_resp_temp[0] == USIE_HIP_FRM_CHR) { - /* verify actlen */ if (actlen > USIE_BUFSIZE) actlen = USIE_BUFSIZE; @@ -1522,7 +1519,6 @@ usie_hip_rsp(struct usie_softc *sc, uint8_t *rsp, uint32_t len) uint8_t tmp[USIE_HIPCNS_MAX] __aligned(4); for (off = 0; (off + USIE_HIPCNS_MIN) <= len; off++) { - uint8_t pad; while ((off < len) && (rsp[off] == USIE_HIP_FRM_CHR)) @@ -1531,7 +1527,6 @@ usie_hip_rsp(struct usie_softc *sc, uint8_t *rsp, uint32_t len) /* Unstuff the bytes */ for (i = j = 0; ((i + off) < len) && (j < USIE_HIPCNS_MAX); i++) { - if (rsp[i + off] == USIE_HIP_FRM_CHR) break; @@ -1619,4 +1614,3 @@ usie_driver_loaded(struct module *mod, int what, void *arg) } return (0); } - diff --git a/sys/dev/usb/net/uhso.c b/sys/dev/usb/net/uhso.c index 8d4b2609f516..c72fa8d7a36b 100644 --- a/sys/dev/usb/net/uhso.c +++ b/sys/dev/usb/net/uhso.c @@ -942,7 +942,6 @@ uhso_probe_iface(struct uhso_softc *sc, int index, } } else if ((UHSO_IFACE_USB_TYPE(type) & UHSO_IF_BULK) && UHSO_IFACE_PORT(type) & UHSO_PORT_SERIAL) { - error = uhso_attach_bulkserial(sc, iface, type); if (error) return (ENXIO); @@ -1234,7 +1233,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 1); if (ucom_get_data(&sc->sc_ucom[ht->ht_muxport], pc, 0, 32, &actlen)) { - usbd_get_page(pc, 0, &res); memset(&req, 0, sizeof(struct usb_device_request)); @@ -1532,7 +1530,6 @@ uhso_ucom_start_write(struct ucom_softc *ucom) &sc->sc_tty[ucom->sc_subunit]); usbd_transfer_start( sc->sc_tty[ucom->sc_subunit].ht_xfer[UHSO_CTRL_WRITE]); - } else if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_BULK) { usbd_transfer_start(sc->sc_xfer[UHSO_BULK_ENDPT_WRITE]); diff --git a/sys/dev/usb/net/usb_ethernet.c b/sys/dev/usb/net/usb_ethernet.c index cd29a9525eda..e1eb2c247b5a 100644 --- a/sys/dev/usb/net/usb_ethernet.c +++ b/sys/dev/usb/net/usb_ethernet.c @@ -311,7 +311,6 @@ uether_ifdetach(struct usb_ether *ue) ifp = ue->ue_ifp; if (ifp != NULL) { - /* we are not running any more */ UE_LOCK(ue); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index fc7081927aaa..4f714dfb3c39 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -1049,7 +1049,7 @@ usb_quirk_init(void *arg) /* parse environment variable */ usb_quirk_add_entry_from_str(envkey, kern_getenv(envkey)); } - + /* register our function */ usb_test_quirk_p = &usb_test_quirk_by_info; usb_quirk_ioctl_p = &usb_quirk_ioctl; diff --git a/sys/dev/usb/serial/u3g.c b/sys/dev/usb/serial/u3g.c index 3482014b2134..fcff316d8d3a 100644 --- a/sys/dev/usb/serial/u3g.c +++ b/sys/dev/usb/serial/u3g.c @@ -30,7 +30,6 @@ * */ - #include <sys/param.h> #include <sys/eventhandler.h> #include <sys/stdint.h> @@ -134,7 +133,6 @@ static void u3g_stop_write(struct ucom_softc *ucom); static void u3g_poll(struct ucom_softc *ucom); static void u3g_free(struct ucom_softc *ucom); - static void u3g_test_autoinst(void *, struct usb_device *, struct usb_attach_arg *); static int u3g_driver_loaded(struct module *mod, int what, void *arg); @@ -142,7 +140,6 @@ static int u3g_driver_loaded(struct module *mod, int what, void *arg); static eventhandler_tag u3g_etag; static const struct usb_config u3g_config[U3G_N_TRANSFER] = { - [U3G_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -724,7 +721,6 @@ u3g_sael_m460_init(struct usb_device *udev) } for (n = 0; n != nitems(setup); n++) { - memcpy(&req, setup[n], sizeof(req)); len = UGETW(req.wLength); diff --git a/sys/dev/usb/serial/uark.c b/sys/dev/usb/serial/uark.c index a1c8976494b4..904977e1ec14 100644 --- a/sys/dev/usb/serial/uark.c +++ b/sys/dev/usb/serial/uark.c @@ -23,7 +23,6 @@ * be called from within the config thread function ! */ - #include <sys/stdint.h> #include <sys/stddef.h> #include <sys/param.h> @@ -119,7 +118,6 @@ static void uark_poll(struct ucom_softc *ucom); static const struct usb_config uark_xfer_config[UARK_N_TRANSFER] = { - [UARK_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -298,7 +296,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/serial/ubsa.c b/sys/dev/usb/serial/ubsa.c index f14ba3785c2a..10b37984db2f 100644 --- a/sys/dev/usb/serial/ubsa.c +++ b/sys/dev/usb/serial/ubsa.c @@ -194,7 +194,6 @@ static void ubsa_cfg_get_status(struct ucom_softc *, uint8_t *, static void ubsa_poll(struct ucom_softc *ucom); static const struct usb_config ubsa_config[UBSA_N_TRANSFER] = { - [UBSA_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -587,7 +586,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UBSA_BSIZE, &actlen)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } @@ -600,7 +598,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -631,7 +628,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -688,7 +684,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/serial/ubser.c b/sys/dev/usb/serial/ubser.c index d455b4ccad34..2a35756b0a7e 100644 --- a/sys/dev/usb/serial/ubser.c +++ b/sys/dev/usb/serial/ubser.c @@ -161,7 +161,6 @@ static void ubser_stop_write(struct ucom_softc *); static void ubser_poll(struct ucom_softc *ucom); static const struct usb_config ubser_config[UBSER_N_TRANSFER] = { - [UBSER_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -416,7 +415,6 @@ tr_setup: if (ucom_get_data(sc->sc_ucom + sc->sc_curr_tx_unit, pc, 1, sc->sc_tx_size - 1, &actlen)) { - buf[0] = sc->sc_curr_tx_unit; usbd_copy_in(pc, 0, buf, 1); @@ -441,7 +439,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -483,7 +480,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -496,7 +492,6 @@ ubser_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) usb_error_t err; if (onoff) { - req.bmRequestType = UT_READ_VENDOR_INTERFACE; req.bRequest = VENDOR_SET_BREAK; req.wValue[0] = x; diff --git a/sys/dev/usb/serial/uchcom.c b/sys/dev/usb/serial/uchcom.c index 6dfc694e1670..6b17141c6ece 100644 --- a/sys/dev/usb/serial/uchcom.c +++ b/sys/dev/usb/serial/uchcom.c @@ -241,7 +241,6 @@ static usb_callback_t uchcom_write_callback; static usb_callback_t uchcom_read_callback; static const struct usb_config uchcom_config_data[UCHCOM_N_TRANSFER] = { - [UCHCOM_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -504,7 +503,6 @@ uchcom_set_dtr_rts_20(struct uchcom_softc *sc, uint8_t val) uchcom_ctrl_write(sc, UCHCOM_REQ_SET_DTRRTS, val, 0); } - /* ---------------------------------------------------------------------- * middle layer */ @@ -535,7 +533,6 @@ uchcom_update_status(struct uchcom_softc *sc) uchcom_convert_status(sc, cur); } - static void uchcom_set_dtr_rts(struct uchcom_softc *sc) { @@ -834,7 +831,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, usbd_xfer_max_len(xfer), &actlen)) { - DPRINTF("actlen = %d\n", actlen); usbd_xfer_set_frame_len(xfer, 0, actlen); diff --git a/sys/dev/usb/serial/ucycom.c b/sys/dev/usb/serial/ucycom.c index b8c3a0189b37..8ce1e0e313ac 100644 --- a/sys/dev/usb/serial/ucycom.c +++ b/sys/dev/usb/serial/ucycom.c @@ -129,7 +129,6 @@ static void ucycom_cfg_param(struct ucom_softc *, struct termios *); static void ucycom_poll(struct ucom_softc *ucom); static const struct usb_config ucycom_config[UCYCOM_N_TRANSFER] = { - [UCYCOM_CTRL_RD] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ @@ -398,7 +397,6 @@ tr_transferred: if (ucom_get_data(&sc->sc_ucom, pc1, offset, sc->sc_olen - offset, &actlen)) { - req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UR_SET_REPORT; USETW2(req.wValue, UHID_OUTPUT_REPORT, sc->sc_oid); @@ -602,7 +600,6 @@ tr_setup: goto tr_setup; } return; - } } diff --git a/sys/dev/usb/serial/ufoma.c b/sys/dev/usb/serial/ufoma.c index b9a1cc7375ca..bc3f00a7b473 100644 --- a/sys/dev/usb/serial/ufoma.c +++ b/sys/dev/usb/serial/ufoma.c @@ -233,7 +233,6 @@ static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS); static const struct usb_config ufoma_ctrl_config[UFOMA_CTRL_ENDPT_MAX] = { - [UFOMA_CTRL_ENDPT_INTR] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -265,7 +264,6 @@ static const struct usb_config static const struct usb_config ufoma_bulk_config[UFOMA_BULK_ENDPT_MAX] = { - [UFOMA_BULK_ENDPT_WRITE] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -523,7 +521,6 @@ ufoma_get_intconf(struct usb_config_descriptor *cd, struct usb_interface_descrip struct usb_descriptor *desc = (void *)id; while ((desc = usb_desc_foreach(cd, desc))) { - if (desc->bDescriptorType == UDESC_INTERFACE) { return (NULL); } @@ -645,7 +642,6 @@ tr_transferred: case USB_ST_SETUP: pc = usbd_xfer_get_frame(xfer, 1); if (ucom_get_data(&sc->sc_ucom, pc, 0, 1, &actlen)) { - req.bmRequestType = UT_WRITE_CLASS_INTERFACE; req.bRequest = UCDC_SEND_ENCAPSULATED_COMMAND; USETW(req.wIndex, sc->sc_ctrl_iface_no); @@ -1064,11 +1060,9 @@ ufoma_modem_setup(device_t dev, struct ufoma_softc *sc, /* get the data interface too */ for (i = 0;; i++) { - iface = usbd_get_iface(uaa->device, i); if (iface) { - id = usbd_get_interface_descriptor(iface); if (id && (id->bInterfaceNumber == sc->sc_data_iface_no)) { @@ -1208,7 +1202,7 @@ static int ufoma_sysctl_support(SYSCTL_HANDLER_ARGS) sbuf_finish(&sb); sysctl_handle_string(oidp, sbuf_data(&sb), sbuf_len(&sb), req); sbuf_delete(&sb); - + return 0; } static int ufoma_sysctl_current(SYSCTL_HANDLER_ARGS) @@ -1222,9 +1216,9 @@ static int ufoma_sysctl_current(SYSCTL_HANDLER_ARGS) snprintf(subbuf, sizeof(subbuf), "(%02x)", sc->sc_currentmode); } sysctl_handle_string(oidp, mode, strlen(mode), req); - + return 0; - + } static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS) { @@ -1245,18 +1239,18 @@ static int ufoma_sysctl_open(SYSCTL_HANDLER_ARGS) if(error != 0 || req->newptr == NULL){ return error; } - + if((newmode = ufoma_str_to_mode(subbuf)) == -1){ return EINVAL; } - + for(i = 1 ; i < sc->sc_modetable[0] ; i++){ if(sc->sc_modetable[i] == newmode){ sc->sc_modetoactivate = newmode; return 0; } } - + return EINVAL; } diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index 67c0530b75d4..c7b30eecfdac 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -214,7 +214,6 @@ static void uftdi_stop_write(struct ucom_softc *); static void uftdi_poll(struct ucom_softc *ucom); static const struct usb_config uftdi_config[UFTDI_N_TRANSFER] = { - [UFTDI_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -1102,7 +1101,6 @@ uftdi_attach(device_t dev) mtx_init(&sc->sc_mtx, "uftdi", NULL, MTX_DEF); ucom_ref(&sc->sc_super_ucom); - uftdi_devtype_setup(sc, uaa); error = usbd_transfer_setup(uaa->device, diff --git a/sys/dev/usb/serial/ugensa.c b/sys/dev/usb/serial/ugensa.c index be9178f127e8..fc5ddc979512 100644 --- a/sys/dev/usb/serial/ugensa.c +++ b/sys/dev/usb/serial/ugensa.c @@ -110,7 +110,6 @@ static void ugensa_stop_write(struct ucom_softc *); static void ugensa_poll(struct ucom_softc *ucom); static const struct usb_config ugensa_xfer_config[UGENSA_N_TRANSFER] = { - [UGENSA_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -205,7 +204,6 @@ ugensa_attach(device_t dev) ucom_ref(&sc->sc_super_ucom); for (iface_index = UGENSA_IFACE_INDEX; iface_index < UGENSA_IFACE_MAX; iface_index++) { - iface = usbd_get_iface(uaa->device, iface_index); if (iface == NULL || iface->idesc->bInterfaceClass != UICLASS_VENDOR) /* Not a serial port, most likely a SD reader */ @@ -213,7 +211,6 @@ ugensa_attach(device_t dev) /* Loop over all endpoints pairwise */ for (x = 0; x < maxports && sc->sc_nports < UGENSA_PORT_MAX; x++) { - ssc = sc->sc_sub + sc->sc_nports; ssc->sc_ucom_ptr = sc->sc_ucom + sc->sc_nports; diff --git a/sys/dev/usb/serial/uipaq.c b/sys/dev/usb/serial/uipaq.c index ba83ad7d2ac8..33f2ae4c0845 100644 --- a/sys/dev/usb/serial/uipaq.c +++ b/sys/dev/usb/serial/uipaq.c @@ -121,7 +121,6 @@ static void uipaq_cfg_set_break(struct ucom_softc *, uint8_t); static void uipaq_poll(struct ucom_softc *ucom); static const struct usb_config uipaq_config_data[UIPAQ_N_TRANSFER] = { - [UIPAQ_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, diff --git a/sys/dev/usb/serial/ulpt.c b/sys/dev/usb/serial/ulpt.c index 3848cd7cf545..c566da924374 100644 --- a/sys/dev/usb/serial/ulpt.c +++ b/sys/dev/usb/serial/ulpt.c @@ -257,7 +257,6 @@ ulpt_read_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: if (actlen == 0) { - if (sc->sc_zlps == 4) { /* enable BULK throttle */ usbd_xfer_set_interval(xfer, 500); /* ms */ @@ -421,7 +420,6 @@ ulpt_open(struct usb_fifo *fifo, int fflags) /* we assume that open is a serial process */ if (sc->sc_fflags == 0) { - /* reset USB parallel port */ ulpt_reset(sc); @@ -575,7 +573,6 @@ found: "config number: %d\n", alt_index); if (alt_index) { - error = usbd_set_alt_interface_index (uaa->device, iface_index, alt_index); @@ -690,7 +687,6 @@ static uint8_t ieee1284_compare(const char *a, const char *b) { while (1) { - if (*b == 0) { break; } diff --git a/sys/dev/usb/serial/umcs.c b/sys/dev/usb/serial/umcs.c index 675463253f55..e3c8f1a764fb 100644 --- a/sys/dev/usb/serial/umcs.c +++ b/sys/dev/usb/serial/umcs.c @@ -86,7 +86,6 @@ static SYSCTL_NODE(_hw_usb, OID_AUTO, umcs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, SYSCTL_INT(_hw_usb_umcs, OID_AUTO, debug, CTLFLAG_RWTUN, &umcs_debug, 0, "Debug level"); #endif /* USB_DEBUG */ - /* * Two-port devices (both with 7820 chip and 7840 chip configured as two-port) * have ports 0 and 2, with ports 1 and 3 omitted. @@ -520,7 +519,6 @@ umcs7840_cfg_open(struct ucom_softc *ucom) if (umcs7840_set_baudrate(sc, pn, 9600)) return; - /* Finally enable all interrupts -- documented */ /* * Copied from vendor driver, I don't know why we should read LCR @@ -609,7 +607,6 @@ umcs7840_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) DPRINTF("Port %d BREAK set to: %s\n", pn, onoff ? "on" : "off"); } - static void umcs7840_cfg_param(struct ucom_softc *ucom, struct termios *t) { @@ -685,7 +682,6 @@ umcs7840_cfg_param(struct ucom_softc *ucom, struct termios *t) umcs7840_set_baudrate(sc, pn, t->c_ospeed); } - static int umcs7840_pre_param(struct ucom_softc *ucom, struct termios *t) { diff --git a/sys/dev/usb/serial/umct.c b/sys/dev/usb/serial/umct.c index 5ec06ec76b3b..43f28c307f6d 100644 --- a/sys/dev/usb/serial/umct.c +++ b/sys/dev/usb/serial/umct.c @@ -159,7 +159,6 @@ static void umct_stop_write(struct ucom_softc *); static void umct_poll(struct ucom_softc *ucom); static const struct usb_config umct_config[UMCT_N_TRANSFER] = { - [UMCT_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -286,7 +285,6 @@ umct_attach(device_t dev) */ maxp = usbd_xfer_max_framelen(sc->sc_xfer[UMCT_BULK_DT_RD]); if (maxp == 0x2) { - /* guessed wrong - switch around endpoints */ struct usb_xfer *temp = sc->sc_xfer[UMCT_INTR_DT_RD]; @@ -629,7 +627,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, sc->sc_obufsize, &actlen)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } diff --git a/sys/dev/usb/serial/umodem.c b/sys/dev/usb/serial/umodem.c index ef72512ef4cb..02f40b236c2f 100644 --- a/sys/dev/usb/serial/umodem.c +++ b/sys/dev/usb/serial/umodem.c @@ -227,7 +227,6 @@ static void umodem_find_data_iface(struct usb_attach_arg *uaa, uint8_t, uint8_t *, uint8_t *); static const struct usb_config umodem_config[UMODEM_N_TRANSFER] = { - [UMODEM_BULK_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -359,7 +358,6 @@ umodem_attach(device_t dev) cmd = umodem_get_desc(uaa, UDESC_CS_INTERFACE, UDESCSUB_CDC_CM); if ((cmd == NULL) || (cmd->bLength < sizeof(*cmd))) { - cud = usbd_find_descriptor(uaa->device, NULL, uaa->info.bIfaceIndex, UDESC_CS_INTERFACE, 0xFF, UDESCSUB_CDC_UNION, 0xFF); @@ -411,7 +409,6 @@ umodem_attach(device_t dev) iface = usbd_get_iface(uaa->device, i); if (iface) { - id = usbd_get_interface_descriptor(iface); if (id && (id->bInterfaceNumber == sc->sc_data_iface_no)) { @@ -430,7 +427,6 @@ umodem_attach(device_t dev) } else { if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) { if (sc->sc_acm_cap & USB_CDC_ACM_HAS_FEATURE) { - error = umodem_set_comm_feature (uaa->device, sc->sc_ctrl_iface_no, UCDC_ABSTRACT_STATE, UCDC_DATA_MULTIPLEXED); @@ -480,7 +476,7 @@ umodem_find_data_iface(struct usb_attach_arg *uaa, { struct usb_interface_descriptor *id; struct usb_interface *iface; - + iface = usbd_get_iface(uaa->device, iface_index); /* check for end of interfaces */ @@ -722,7 +718,6 @@ umodem_cfg_set_break(struct ucom_softc *ucom, uint8_t onoff) DPRINTF("onoff=%d\n", onoff); if (sc->sc_acm_cap & USB_CDC_ACM_HAS_BREAK) { - temp = onoff ? UCDC_BREAK_ON : UCDC_BREAK_OFF; req.bmRequestType = UT_WRITE_CLASS_INTERFACE; @@ -852,7 +847,6 @@ tr_setup: goto tr_setup; } return; - } } @@ -870,7 +864,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMODEM_BUF_SIZE, &actlen)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } diff --git a/sys/dev/usb/serial/umoscom.c b/sys/dev/usb/serial/umoscom.c index e505f3923329..724ab7f94092 100644 --- a/sys/dev/usb/serial/umoscom.c +++ b/sys/dev/usb/serial/umoscom.c @@ -215,7 +215,6 @@ static void umoscom_stop_write(struct ucom_softc *); static void umoscom_poll(struct ucom_softc *ucom); static const struct usb_config umoscom_config_data[UMOSCOM_N_TRANSFER] = { - [UMOSCOM_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -643,7 +642,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UMOSCOM_BUFSIZE, &actlen)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } diff --git a/sys/dev/usb/serial/uplcom.c b/sys/dev/usb/serial/uplcom.c index 4cdbd461619a..89f518ddd818 100644 --- a/sys/dev/usb/serial/uplcom.c +++ b/sys/dev/usb/serial/uplcom.c @@ -204,7 +204,6 @@ static usb_callback_t uplcom_write_callback; static usb_callback_t uplcom_read_callback; static const struct usb_config uplcom_config_data[UPLCOM_N_TRANSFER] = { - [UPLCOM_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -601,7 +600,7 @@ uplcom_pl2303_init(struct usb_device *udev, uint8_t chiptype) err = uplcom_pl2303_do(udev, UT_WRITE_VENDOR_DEVICE, UPLCOM_SET_REQUEST, 2, 0x24, 0); if (err) return (EIO); - + return (0); } @@ -870,7 +869,6 @@ uplcom_cfg_param(struct ucom_softc *ucom, struct termios *t) &req, &ls, 0, 1000); if (t->c_cflag & CRTSCTS) { - DPRINTF("crtscts = on\n"); req.bmRequestType = UT_WRITE_VENDOR_DEVICE; @@ -962,7 +960,6 @@ uplcom_intr_callback(struct usb_xfer *xfer, usb_error_t error) DPRINTF("actlen = %u\n", actlen); if (actlen >= 9) { - pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); @@ -1027,7 +1024,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UPLCOM_BULK_BUF_SIZE, &actlen)) { - DPRINTF("actlen = %d\n", actlen); usbd_xfer_set_frame_len(xfer, 0, actlen); diff --git a/sys/dev/usb/serial/usb_serial.c b/sys/dev/usb/serial/usb_serial.c index 852a5b4ad822..cd3cede78124 100644 --- a/sys/dev/usb/serial/usb_serial.c +++ b/sys/dev/usb/serial/usb_serial.c @@ -354,7 +354,6 @@ ucom_detach(struct ucom_super_softc *ssc, struct ucom_softc *sc) for (subunit = 0; subunit < ssc->sc_subunits; subunit++) { if (sc[subunit].sc_flag & UCOM_FLAG_ATTACHED) { - ucom_detach_tty(ssc, &sc[subunit]); /* avoid duplicate detach */ @@ -456,7 +455,6 @@ ucom_attach_tty(struct ucom_super_softc *ssc, struct ucom_softc *sc) if ((ucom_cons_softc == NULL) && (ssc->sc_unit == ucom_cons_unit) && (sc->sc_subunit == ucom_cons_subunit)) { - DPRINTF("unit %d subunit %d is console", ssc->sc_unit, sc->sc_subunit); @@ -727,11 +725,9 @@ ucom_cfg_open(struct usb_proc_msg *_task) DPRINTF("\n"); if (sc->sc_flag & UCOM_FLAG_LL_READY) { - /* already opened */ } else { - sc->sc_flag |= UCOM_FLAG_LL_READY; if (sc->sc_callback->ucom_cfg_open) { @@ -957,7 +953,6 @@ ucom_modem(struct tty *tp, int sigon, int sigoff) return (0); } if ((sigon == 0) && (sigoff == 0)) { - if (sc->sc_mcr & SER_DTR) { sigon |= SER_DTR; } @@ -1201,7 +1196,6 @@ ucom_cfg_status_change(struct usb_proc_msg *_task) } if (msr_delta & SER_DCD) { - onoff = (sc->sc_msr & SER_DCD) ? 1 : 0; DPRINTF("DCD changed to %d\n", onoff); @@ -1210,7 +1204,6 @@ ucom_cfg_status_change(struct usb_proc_msg *_task) } if ((lsr_delta & ULSR_BI) && (sc->sc_lsr & ULSR_BI)) { - DPRINTF("BREAK detected\n"); ttydisc_rint(tp, 0, TRE_BREAK); @@ -1218,7 +1211,6 @@ ucom_cfg_status_change(struct usb_proc_msg *_task) } if ((lsr_delta & ULSR_FE) && (sc->sc_lsr & ULSR_FE)) { - DPRINTF("Frame error detected\n"); ttydisc_rint(tp, 0, TRE_FRAMING); @@ -1226,7 +1218,6 @@ ucom_cfg_status_change(struct usb_proc_msg *_task) } if ((lsr_delta & ULSR_PE) && (sc->sc_lsr & ULSR_PE)) { - DPRINTF("Parity error detected\n"); ttydisc_rint(tp, 0, TRE_PARITY); @@ -1285,7 +1276,6 @@ ucom_param(struct tty *tp, struct termios *t) error = 0; if (!(sc->sc_flag & UCOM_FLAG_HL_READY)) { - /* XXX the TTY layer should call "open()" first! */ /* * Not quite: Its ordering is partly backwards, but @@ -1441,7 +1431,6 @@ ucom_get_data(struct ucom_softc *sc, struct usb_page_cache *pc, offset_orig = offset; while (len != 0) { - usbd_get_page(pc, offset, &res); if (res.length > len) { @@ -1517,7 +1506,6 @@ ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, /* set a flag to prevent recursation ? */ while (len > 0) { - usbd_get_page(pc, offset, &res); if (res.length > len) { @@ -1534,7 +1522,6 @@ ucom_put_data(struct ucom_softc *sc, struct usb_page_cache *pc, /* first check if we can pass the buffer directly */ if (ttydisc_can_bypass(tp)) { - /* clear any jitter buffer */ sc->sc_jitterbuf_in = 0; sc->sc_jitterbuf_out = 0; diff --git a/sys/dev/usb/serial/uslcom.c b/sys/dev/usb/serial/uslcom.c index 10407ce2da18..fec18d2a5631 100644 --- a/sys/dev/usb/serial/uslcom.c +++ b/sys/dev/usb/serial/uslcom.c @@ -822,7 +822,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, USLCOM_BULK_BUF_SIZE, &actlen)) { - DPRINTF("actlen = %d\n", actlen); usbd_xfer_set_frame_len(xfer, 0, actlen); diff --git a/sys/dev/usb/serial/uvisor.c b/sys/dev/usb/serial/uvisor.c index 4eaf618f76ed..48a870d2df39 100644 --- a/sys/dev/usb/serial/uvisor.c +++ b/sys/dev/usb/serial/uvisor.c @@ -208,7 +208,6 @@ static void uvisor_start_write(struct ucom_softc *); static void uvisor_stop_write(struct ucom_softc *); static const struct usb_config uvisor_config[UVISOR_N_TRANSFER] = { - [UVISOR_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -620,7 +619,6 @@ uvisor_write_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_TRANSFERRED: tr_setup: for (x = 0; x != UVISOROFRAMES; x++) { - usbd_xfer_set_frame_offset(xfer, x * UVISOROBUFSIZE, x); diff --git a/sys/dev/usb/serial/uvscom.c b/sys/dev/usb/serial/uvscom.c index 457b18fe80e1..8bb69e4402cf 100644 --- a/sys/dev/usb/serial/uvscom.c +++ b/sys/dev/usb/serial/uvscom.c @@ -192,7 +192,6 @@ static uint16_t uvscom_cfg_read_status(struct uvscom_softc *); static void uvscom_poll(struct ucom_softc *ucom); static const struct usb_config uvscom_config[UVSCOM_N_TRANSFER] = { - [UVSCOM_BULK_DT_WR] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -395,7 +394,6 @@ tr_setup: pc = usbd_xfer_get_frame(xfer, 0); if (ucom_get_data(&sc->sc_ucom, pc, 0, UVSCOM_BULK_BUF_SIZE, &actlen)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } @@ -454,7 +452,6 @@ uvscom_intr_callback(struct usb_xfer *xfer, usb_error_t error) switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: if (actlen >= 2) { - pc = usbd_xfer_get_frame(xfer, 0); usbd_copy_out(pc, 0, buf, sizeof(buf)); diff --git a/sys/dev/usb/storage/cfumass.c b/sys/dev/usb/storage/cfumass.c index 48b0bf14b3ce..78896750b487 100644 --- a/sys/dev/usb/storage/cfumass.c +++ b/sys/dev/usb/storage/cfumass.c @@ -206,7 +206,6 @@ static usb_callback_t cfumass_t_data_callback; static usb_callback_t cfumass_t_status_callback; static device_method_t cfumass_methods[] = { - /* USB interface. */ DEVMETHOD(usb_handle_request, cfumass_handle_request), @@ -234,7 +233,6 @@ MODULE_DEPEND(cfumass, usb, 1, 1, 1); MODULE_DEPEND(cfumass, usb_template, 1, 1, 1); static struct usb_config cfumass_config[CFUMASS_T_MAX] = { - [CFUMASS_T_COMMAND] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index b3faa3d67f30..7e305ad4fdc3 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -370,7 +370,6 @@ typedef uint8_t (umass_transform_t)(struct umass_softc *sc, uint8_t *cmd_ptr, #define NO_PREVENT_ALLOW 0x8000 struct umass_softc { - struct scsi_sense cam_scsi_sense; struct scsi_test_unit_ready cam_scsi_test_unit_ready; struct mtx sc_mtx; @@ -493,7 +492,6 @@ static void umass_dump_buffer(struct umass_softc *, uint8_t *, uint32_t, #endif static struct usb_config umass_bbb_config[UMASS_T_BBB_MAX] = { - [UMASS_T_BBB_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ @@ -583,7 +581,6 @@ static struct usb_config umass_bbb_config[UMASS_T_BBB_MAX] = { }; static struct usb_config umass_cbi_config[UMASS_T_CBI_MAX] = { - [UMASS_T_CBI_RESET1] = { .type = UE_CONTROL, .endpoint = 0x00, /* Control pipe */ @@ -975,7 +972,6 @@ umass_attach(device_t dev) /* allocate all required USB transfers */ if (sc->sc_proto & UMASS_PROTO_BBB) { - err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, umass_bbb_config, UMASS_T_BBB_MAX, sc, &sc->sc_mtx); @@ -984,7 +980,6 @@ umass_attach(device_t dev) sc->sc_last_xfer_index = UMASS_T_BBB_COMMAND; } else if (sc->sc_proto & (UMASS_PROTO_CBI | UMASS_PROTO_CBI_I)) { - err = usbd_transfer_setup(uaa->device, &uaa->info.bIfaceIndex, sc->sc_xfer, umass_cbi_config, UMASS_T_CBI_MAX, sc, &sc->sc_mtx); @@ -1162,7 +1157,6 @@ umass_tr_error(struct usb_xfer *xfer, usb_error_t error) struct umass_softc *sc = usbd_xfer_softc(xfer); if (error != USB_ERR_CANCELLED) { - DPRINTF(sc, UDMASS_GEN, "transfer error, %s -> " "reset\n", usbd_errstr(error)); } @@ -1282,7 +1276,6 @@ umass_t_bbb_command_callback(struct usb_xfer *xfer, usb_error_t error) sc->sc_status_try = 0; if (ccb) { - /* * the initial value is not important, * as long as the values are unique: @@ -1500,7 +1493,6 @@ umass_t_bbb_status_callback(struct usb_xfer *xfer, usb_error_t error) } /* translate weird command-status signatures: */ if (sc->sc_quirks & WRONG_CSWSIG) { - uint32_t temp = UGETDW(sc->csw.dCSWSignature); if ((temp == CSWSIGNATURE_OLYMPUS_C1) || @@ -1803,7 +1795,6 @@ umass_t_cbi_command_callback(struct usb_xfer *xfer, usb_error_t error) case USB_ST_SETUP: if (ccb) { - /* * do a CBI transfer with cmd_len bytes from * cmd_data, possibly a data phase of data_len @@ -2000,7 +1991,6 @@ umass_t_cbi_status_callback(struct usb_xfer *xfer, usb_error_t error) /* dissect the information in the buffer */ if (sc->sc_proto & UMASS_PROTO_UFI) { - /* * Section 3.4.3.1.3 specifies that the UFI command * protocol returns an ASC and ASCQ in the interrupt @@ -2025,14 +2015,12 @@ umass_t_cbi_status_callback(struct usb_xfer *xfer, usb_error_t error) break; } else { - /* Command Interrupt Data Block */ DPRINTF(sc, UDMASS_CBI, "type=0x%02x, value=0x%02x\n", sc->sbl.common.type, sc->sbl.common.value); if (sc->sbl.common.type == IDB_TYPE_CCI) { - status = (sc->sbl.common.value & IDB_VALUE_STATUS_MASK); status = ((status == IDB_VALUE_PASS) ? STATUS_CMD_OK : @@ -2213,7 +2201,6 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb) * "sc->sc_transfer.cmd_data" */ if (umass_std_transform(sc, ccb, cmd, ccb->csio.cdb_len)) { - if (sc->sc_transfer.cmd_data[0] == INQUIRY) { const char *pserial; @@ -2245,7 +2232,6 @@ umass_cam_action(struct cam_sim *sim, union ccb *ccb) */ if ((sc->sc_quirks & (NO_INQUIRY_EVPD | NO_INQUIRY)) && (sc->sc_transfer.cmd_data[1] & SI_EVPD)) { - scsi_set_sense_data(&ccb->csio.sense_data, /*sense_format*/ SSD_TYPE_NONE, /*current_error*/ 1, @@ -2440,7 +2426,6 @@ umass_cam_poll(struct cam_sim *sim) usbd_transfer_poll(sc->sc_xfer, UMASS_T_MAX); } - /* umass_cam_cb * finalise a completed CAM command */ @@ -2501,7 +2486,6 @@ umass_cam_cb(struct umass_softc *sc, union ccb *ccb, uint32_t residue, if (umass_std_transform(sc, ccb, &sc->cam_scsi_sense.opcode, sizeof(sc->cam_scsi_sense))) { - if ((sc->sc_quirks & FORCE_SHORT_INQUIRY) && (sc->sc_transfer.cmd_data[0] == INQUIRY)) { ccb->csio.sense_len = SHORT_INQUIRY_LENGTH; diff --git a/sys/dev/usb/storage/urio.c b/sys/dev/usb/storage/urio.c index 153feab80ccf..25f1145f54e4 100644 --- a/sys/dev/usb/storage/urio.c +++ b/sys/dev/usb/storage/urio.c @@ -33,7 +33,6 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); - /* * 2000/3/24 added NetBSD/OpenBSD support (from Alex Nemirovsky) * 2000/3/07 use two bulk-pipe handles for read and write (Dirk) @@ -281,7 +280,6 @@ urio_write_callback(struct usb_xfer *xfer, usb_error_t error) pc = usbd_xfer_get_frame(xfer, 0); if (usb_fifo_get_data(f, pc, 0, usbd_xfer_max_len(xfer), &actlen, 0)) { - usbd_xfer_set_frame_len(xfer, 0, actlen); usbd_transfer_submit(xfer); } diff --git a/sys/dev/usb/storage/ustorage_fs.c b/sys/dev/usb/storage/ustorage_fs.c index 454dac07d3c0..8c9b35591018 100644 --- a/sys/dev/usb/storage/ustorage_fs.c +++ b/sys/dev/usb/storage/ustorage_fs.c @@ -165,7 +165,6 @@ typedef struct { #define USTORAGE_FS_BBB_CSW_SIZE 13 struct ustorage_fs_lun { - uint8_t *memory_image; uint32_t num_sectors; @@ -180,7 +179,6 @@ struct ustorage_fs_lun { }; struct ustorage_fs_softc { - ustorage_fs_bbb_cbw_t *sc_cbw; /* Command Wrapper Block */ ustorage_fs_bbb_csw_t *sc_csw; /* Command Status Block */ void *sc_dma_ptr; /* Main data buffer */ @@ -275,7 +273,6 @@ MODULE_VERSION(ustorage_fs, 0); MODULE_DEPEND(ustorage_fs, usb, 1, 1, 1); static struct usb_config ustorage_fs_bbb_config[USTORAGE_FS_T_BBB_MAX] = { - [USTORAGE_FS_T_BBB_COMMAND] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -1488,7 +1485,6 @@ static uint8_t ustorage_fs_min_len(struct ustorage_fs_softc *sc, uint32_t len, uint32_t mask) { if (len != sc->sc_transfer.data_rem) { - if (sc->sc_transfer.cbw_dir == DIR_READ) { /* * there must be something wrong about this SCSI @@ -1545,7 +1541,6 @@ ustorage_fs_check_cmd(struct ustorage_fs_softc *sc, uint8_t min_cmd_size, /* Check if LUN is correct */ if (lun != sc->sc_transfer.lun) { - } /* Check the LUN */ if (sc->sc_transfer.lun <= sc->sc_last_lun) { diff --git a/sys/dev/usb/template/usb_template.c b/sys/dev/usb/template/usb_template.c index a91cc59d57e0..3b629b13b32d 100644 --- a/sys/dev/usb/template/usb_template.c +++ b/sys/dev/usb/template/usb_template.c @@ -190,7 +190,6 @@ usb_temp_sysctl(SYSCTL_HANDLER_ARGS) return (0); } - /*------------------------------------------------------------------------* * usb_make_raw_desc * @@ -671,7 +670,6 @@ usb_hw_ep_find_match(struct usb_hw_ep_scratch *ues, } for (n = 1; n != (USB_EP_MAX / 2); n++) { - /* get HW endpoint profile */ (ues->methods->get_hw_ep_profile) (ues->udev, &pf, n); if (pf == NULL) { @@ -780,10 +778,8 @@ usb_hw_ep_get_needs(struct usb_hw_ep_scratch *ues, repeat: while ((desc = usb_desc_foreach(ues->cd, desc))) { - if ((desc->bDescriptorType == UDESC_INTERFACE) && (desc->bLength >= sizeof(*id))) { - id = (void *)desc; if (id->bAlternateSetting == 0) { @@ -796,7 +792,6 @@ repeat: } if ((desc->bDescriptorType == UDESC_ENDPOINT) && (desc->bLength >= sizeof(*ed))) { - ed = (void *)desc; goto handle_endpoint_desc; @@ -809,7 +804,6 @@ handle_endpoint_desc: temp = (ed->bmAttributes & UE_XFERTYPE); if (temp == ep_type) { - if (ep_curr == ep_end) { /* too many endpoints */ return (1); /* failure */ @@ -832,7 +826,6 @@ handle_endpoint_desc: */ ep_no = (ed->bEndpointAddress & UE_ADDR); if (ep_no != 0) { - /* get HW endpoint profile */ (ues->methods->get_hw_ep_profile) (ues->udev, &pf, ep_no); @@ -872,7 +865,6 @@ handle_endpoint_desc: } } } else if (is_complete) { - /* check if we have enough buffer space */ if (wMaxPacketSize > ep_curr->max_frame_size) { @@ -887,7 +879,6 @@ handle_endpoint_desc: } } else { - /* compute the maximum frame size */ if (ep_curr->max_frame_size < wMaxPacketSize) { ep_curr->max_frame_size = wMaxPacketSize; @@ -944,7 +935,6 @@ usb_hw_ep_resolve(struct usb_device *udev, return (USB_ERR_INVAL); if (desc->bDescriptorType == UDESC_DEVICE) { - if (desc->bLength < sizeof(*dd)) return (USB_ERR_INVAL); @@ -1018,9 +1008,7 @@ usb_hw_ep_resolve(struct usb_device *udev, return (USB_ERR_INVAL); } for (ep = ues->ep; ep != ues->ep_max; ep++) { - while (ep->needs_in || ep->needs_out) { - /* * First try to use a simplex endpoint. * Then try to use a duplex endpoint. @@ -1390,7 +1378,6 @@ usb_temp_setup(struct usb_device *udev, goto done; } for (n = 0;; n++) { - buf = usb_temp_get_config_desc(udev, NULL, n); if (buf == NULL) { break; diff --git a/sys/dev/usb/template/usb_template_kbd.c b/sys/dev/usb/template/usb_template_kbd.c index cf783b8bddf7..7213796c4440 100644 --- a/sys/dev/usb/template/usb_template_kbd.c +++ b/sys/dev/usb/template/usb_template_kbd.c @@ -198,7 +198,6 @@ keyboard_get_vendor_desc(const struct usb_device_request *req, uint16_t *plen) if ((req->bmRequestType == 0x81) && (req->bRequest == 0x06) && (req->wValue[0] == 0x00) && (req->wValue[1] == 0x22) && (req->wIndex[1] == 0) && (req->wIndex[0] == 0)) { - *plen = sizeof(keyboard_hid_descriptor); return (keyboard_hid_descriptor); } diff --git a/sys/dev/usb/template/usb_template_mouse.c b/sys/dev/usb/template/usb_template_mouse.c index 6d595d5900fa..05b688355d32 100644 --- a/sys/dev/usb/template/usb_template_mouse.c +++ b/sys/dev/usb/template/usb_template_mouse.c @@ -196,7 +196,6 @@ mouse_get_vendor_desc(const struct usb_device_request *req, uint16_t *plen) if ((req->bmRequestType == 0x81) && (req->bRequest == 0x06) && (req->wValue[0] == 0x00) && (req->wValue[1] == 0x22) && (req->wIndex[1] == 0) && (req->wIndex[0] == 0)) { - *plen = sizeof(mouse_hid_descriptor); return (mouse_hid_descriptor); } diff --git a/sys/dev/usb/template/usb_template_phone.c b/sys/dev/usb/template/usb_template_phone.c index 9b157245ee58..c5ee3d9316f6 100644 --- a/sys/dev/usb/template/usb_template_phone.c +++ b/sys/dev/usb/template/usb_template_phone.c @@ -388,7 +388,6 @@ phone_get_vendor_desc(const struct usb_device_request *req, uint16_t *plen) if ((req->bmRequestType == 0x81) && (req->bRequest == 0x06) && (req->wValue[0] == 0x00) && (req->wValue[1] == 0x22) && (req->wIndex[1] == 0) && (req->wIndex[0] == 3 /* iface */)) { - *plen = sizeof(phone_hid_descriptor); return (phone_hid_descriptor); } diff --git a/sys/dev/usb/usb_busdma.c b/sys/dev/usb/usb_busdma.c index f43926d04aac..26fddaef65b2 100644 --- a/sys/dev/usb/usb_busdma.c +++ b/sys/dev/usb/usb_busdma.c @@ -90,11 +90,9 @@ usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset, struct usb_page *page; if (pc->page_start) { - /* Case 1 - something has been loaded into DMA */ if (pc->buffer) { - /* Case 1a - Kernel Virtual Address */ res->buffer = USB_ADD_BYTES(pc->buffer, offset); @@ -106,7 +104,6 @@ usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset, page = pc->page_start; if (pc->ismultiseg) { - page += (offset / USB_PAGE_SIZE); offset %= USB_PAGE_SIZE; @@ -118,7 +115,6 @@ usbd_get_page(struct usb_page_cache *pc, usb_frlength_t offset, res->physaddr = page->physaddr + offset; } if (!pc->buffer) { - /* Case 1b - Non Kernel Virtual Address */ res->buffer = USB_ADD_BYTES(page->buffer, offset); @@ -148,7 +144,6 @@ usb_pc_buffer_is_aligned(struct usb_page_cache *pc, usb_frlength_t offset, struct usb_page_search buf_res; while (len != 0) { - usbd_get_page(pc, offset, &buf_res); if (buf_res.length > len) @@ -174,7 +169,6 @@ usbd_copy_in(struct usb_page_cache *cache, usb_frlength_t offset, struct usb_page_search buf_res; while (len != 0) { - usbd_get_page(cache, offset, &buf_res); if (buf_res.length > len) { @@ -204,7 +198,6 @@ usbd_copy_in_user(struct usb_page_cache *cache, usb_frlength_t offset, int error; while (len != 0) { - usbd_get_page(cache, offset, &buf_res); if (buf_res.length > len) { @@ -262,7 +255,6 @@ usb_uiomove(struct usb_page_cache *pc, struct uio *uio, int error = 0; while (len != 0) { - usbd_get_page(pc, pc_offset, &res); if (res.length > len) { @@ -294,7 +286,6 @@ usbd_copy_out(struct usb_page_cache *cache, usb_frlength_t offset, struct usb_page_search res; while (len != 0) { - usbd_get_page(cache, offset, &res); if (res.length > len) { @@ -324,7 +315,6 @@ usbd_copy_out_user(struct usb_page_cache *cache, usb_frlength_t offset, int error; while (len != 0) { - usbd_get_page(cache, offset, &res); if (res.length > len) { @@ -352,7 +342,6 @@ usbd_frame_zero(struct usb_page_cache *cache, usb_frlength_t offset, struct usb_page_search res; while (len != 0) { - usbd_get_page(cache, offset, &res); if (res.length > len) { @@ -637,7 +626,6 @@ void usb_pc_free_mem(struct usb_page_cache *pc) { if (pc && pc->buffer) { - bus_dmamap_unload(pc->tag, pc->map); bus_dmamem_free(pc->tag, pc->buffer, pc->map); @@ -690,7 +678,6 @@ usb_pc_load_mem(struct usb_page_cache *pc, usb_size_t size, uint8_t sync) return (1); } } else { - /* * We have to unload the previous loaded DMA * pages before trying to load a new one! @@ -821,7 +808,6 @@ usb_dma_tag_find(struct usb_dma_parent_tag *udpt, nudt = udpt->utag_max; while (nudt--) { - if (udt->align == 0) { usb_dma_tag_create(udt, size, align); if (udt->tag == NULL) { @@ -888,7 +874,6 @@ usb_dma_tag_unsetup(struct usb_dma_parent_tag *udpt) nudt = udpt->utag_max; while (nudt--) { - if (udt->align) { /* destroy the USB DMA tag */ usb_dma_tag_destroy(udt); @@ -994,7 +979,6 @@ usb_bdma_work_loop(struct usb_xfer_queue *pq) pg += (xfer->frlengths[nframes] / USB_PAGE_SIZE); pg += 2; } - } if (info->dma_error) { USB_BUS_LOCK(info->bus); @@ -1003,7 +987,6 @@ usb_bdma_work_loop(struct usb_xfer_queue *pq) return; } if (info->dma_currframe != info->dma_nframes) { - if (info->dma_currframe == 0) { /* special case */ usb_pc_load_mem(xfer->frbuffers, @@ -1076,7 +1059,6 @@ usb_bdma_pre_sync(struct usb_xfer *xfer) pc = xfer->frbuffers; while (nframes--) { - if (pc->isread) { usb_pc_cpu_invalidate(pc); } else { diff --git a/sys/dev/usb/usb_busdma.h b/sys/dev/usb/usb_busdma.h index d75e67eee8fe..ca0631e2ce53 100644 --- a/sys/dev/usb/usb_busdma.h +++ b/sys/dev/usb/usb_busdma.h @@ -87,7 +87,6 @@ struct usb_page_search { * memory allocation. */ struct usb_page_cache { - #if USB_HAVE_BUSDMA bus_dma_tag_t tag; bus_dmamap_t map; diff --git a/sys/dev/usb/usb_controller.h b/sys/dev/usb/usb_controller.h index 59139e64bd99..81cb69016fd4 100644 --- a/sys/dev/usb/usb_controller.h +++ b/sys/dev/usb/usb_controller.h @@ -54,7 +54,6 @@ typedef void (usb_bus_mem_cb_t)(struct usb_bus *bus, usb_bus_mem_sub_cb_t *scb); * callbacks. */ struct usb_bus_methods { - /* USB Device and Host mode - Mandatory */ usb_handle_req_t *roothub_exec; @@ -156,7 +155,6 @@ struct usb_bus_methods { * callbacks. */ struct usb_pipe_methods { - /* Mandatory USB Device and Host mode callbacks: */ void (*open)(struct usb_xfer *); diff --git a/sys/dev/usb/usb_core.h b/sys/dev/usb/usb_core.h index 01018ca92217..c0f070a4df79 100644 --- a/sys/dev/usb/usb_core.h +++ b/sys/dev/usb/usb_core.h @@ -88,7 +88,6 @@ struct usb_string_lang; * flags. */ struct usb_xfer_flags_int { - enum usb_hc_mode usb_mode; /* shadow copy of "udev->usb_mode" */ uint16_t control_rem; /* remainder in bytes */ diff --git a/sys/dev/usb/usb_dev.c b/sys/dev/usb/usb_dev.c index 9e17dfdc09bf..88b36e68976b 100644 --- a/sys/dev/usb/usb_dev.c +++ b/sys/dev/usb/usb_dev.c @@ -439,7 +439,6 @@ usb_fifo_create(struct usb_cdev_privdata *cpd, /* search for a free FIFO slot */ DPRINTFN(5, "Endpoint device, searching for 0x%02x\n", e); for (n = 0;; n += 2) { - if (n == USB_FIFO_MAX) { if (no_null) { no_null = 0; @@ -532,7 +531,6 @@ usb_fifo_create(struct usb_cdev_privdata *cpd, /* Check RX FIFO */ if (is_rx && (udev->fifo[n + USB_FIFO_RX] == NULL)) { - ep = usb_dev_get_ep(udev, e, USB_FIFO_RX); DPRINTFN(5, "dev_get_endpoint(%d, 0x%x)\n", e, USB_FIFO_RX); if (ep == NULL) { @@ -813,9 +811,7 @@ usb_fifo_close(struct usb_fifo *f, int fflags) /* flush written data, if any */ if ((f->fifo_index & 1) == USB_FIFO_TX) { - if (!f->flag_iserror) { - /* set flushing flag */ f->flag_flushing = 1; @@ -1121,7 +1117,6 @@ usb_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int fflag, struct thread* /* Wait for re-enumeration, if any */ while (f->udev->re_enumerate_wait != USB_RE_ENUM_DONE) { - usb_unref_device(cpd, &refs); usb_pause_mtx(NULL, hz / 128); @@ -1246,7 +1241,6 @@ static struct filterops usb_filtops_read = { .f_event = usb_filter_read, }; - /* ARGSUSED */ static int usb_kqfilter(struct cdev* dev, struct knote *kn) @@ -1318,7 +1312,6 @@ usb_poll(struct cdev* dev, int events, struct thread* td) revents = 0; if ((events & (POLLOUT | POLLWRNORM)) && (fflags & FWRITE)) { - f = refs.txfifo; mtx_lock(f->priv_mtx); @@ -1357,7 +1350,6 @@ usb_poll(struct cdev* dev, int events, struct thread* td) } if ((events & (POLLIN | POLLRDNORM)) && (fflags & FREAD)) { - f = refs.rxfifo; mtx_lock(f->priv_mtx); @@ -1446,11 +1438,9 @@ usb_read(struct cdev *dev, struct uio *uio, int ioflag) goto done; } while (uio->uio_resid > 0) { - USB_IF_DEQUEUE(&f->used_q, m); if (m == NULL) { - /* start read transfer, if not already started */ (f->methods->f_start_read) (f); @@ -1493,7 +1483,6 @@ usb_read(struct cdev *dev, struct uio *uio, int ioflag) m->cur_data_ptr += io_len; if (m->cur_data_len == 0) { - uint8_t last_packet; last_packet = m->last_packet; @@ -1574,7 +1563,6 @@ usb_write(struct cdev *dev, struct uio *uio, int ioflag) USB_IF_DEQUEUE(&f->free_q, m); if (m == NULL) { - if (ioflag & IO_NDELAY) { if (tr_data) { /* return length before error */ @@ -1851,7 +1839,6 @@ usb_fifo_attach(struct usb_device *udev, void *priv_sc, /* search for a free FIFO slot */ for (n = 0;; n += 2) { - if (n == USB_FIFO_MAX) { /* end of FIFOs reached */ return (ENOMEM); @@ -1900,7 +1887,6 @@ usb_fifo_attach(struct usb_device *udev, void *priv_sc, mtx_unlock(&usb_ref_lock); for (n = 0; n != 4; n++) { - if (pm->basename[n] == NULL) { continue; } @@ -2037,7 +2023,6 @@ usb_fifo_put_data(struct usb_fifo *f, struct usb_page_cache *pc, usb_frlength_t io_len; while (len || (what == 1)) { - USB_IF_DEQUEUE(&f->free_q, m); if (m) { @@ -2075,7 +2060,6 @@ usb_fifo_put_data_linear(struct usb_fifo *f, void *ptr, usb_size_t io_len; while (len || (what == 1)) { - USB_IF_DEQUEUE(&f->free_q, m); if (m) { @@ -2152,11 +2136,9 @@ usb_fifo_get_data(struct usb_fifo *f, struct usb_page_cache *pc, actlen[0] = 0; while (1) { - USB_IF_DEQUEUE(&f->used_q, m); if (m) { - tr_data = 1; io_len = MIN(len, m->cur_data_len); @@ -2181,7 +2163,6 @@ usb_fifo_get_data(struct usb_fifo *f, struct usb_page_cache *pc, USB_IF_PREPEND(&f->used_q, m); } } else { - if (tr_data) { /* wait for data to be written out */ break; @@ -2217,11 +2198,9 @@ usb_fifo_get_data_linear(struct usb_fifo *f, void *ptr, actlen[0] = 0; while (1) { - USB_IF_DEQUEUE(&f->used_q, m); if (m) { - tr_data = 1; io_len = MIN(len, m->cur_data_len); @@ -2246,7 +2225,6 @@ usb_fifo_get_data_linear(struct usb_fifo *f, void *ptr, USB_IF_PREPEND(&f->used_q, m); } } else { - if (tr_data) { /* wait for data to be written out */ break; @@ -2354,7 +2332,6 @@ usb_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len) sx_xlock(&usb_sym_lock); TAILQ_FOREACH(ps, &usb_sym_head, sym_entry) { - /* * Compute total length of source and destination symlink * strings pluss one length byte and two NUL bytes: @@ -2426,7 +2403,6 @@ usb_read_symlink(uint8_t *user_ptr, uint32_t startentry, uint32_t user_len) /* a zero length entry indicates the end */ if ((user_len != 0) && (error == 0)) { - len = 0; error = copyout(&len, diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c index 5560c0ae0acf..3499516c91e6 100644 --- a/sys/dev/usb/usb_device.c +++ b/sys/dev/usb/usb_device.c @@ -325,7 +325,6 @@ usbd_get_ep_by_addr(struct usb_device *udev, uint8_t ea_val) * based on the endpoint address: */ for (; ep != ep_end; ep++) { - if (ep->edesc == NULL) { continue; } @@ -436,7 +435,6 @@ usbd_get_endpoint(struct usb_device *udev, uint8_t iface_index, * the endpoints from the beginning of the "udev->endpoints" array. */ for (; ep != ep_end; ep++) { - if ((ep->edesc == NULL) || (ep->iface_index != iface_index)) { continue; @@ -883,7 +881,6 @@ usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd) ep_max = 0; while ((id = usb_idesc_foreach(udev->cdesc, &ips))) { - iface = udev->ifaces + ips.iface_index; /* check for specific interface match */ @@ -929,7 +926,6 @@ usb_config_parse(struct usb_device *udev, uint8_t iface_index, uint8_t cmd) /* iterate all the endpoint descriptors */ while ((ed = usb_edesc_foreach(udev->cdesc, ed))) { - /* check if endpoint limit has been reached */ if (temp >= USB_MAX_EP_UNITS) { DPRINTF("Endpoint limit reached\n"); @@ -1184,7 +1180,6 @@ usb_reset_iface_endpoints(struct usb_device *udev, uint8_t iface_index) ep_end = udev->endpoints + udev->endpoints_max; for (; ep != ep_end; ep++) { - if ((ep->edesc == NULL) || (ep->iface_index != iface_index)) { continue; @@ -1293,7 +1288,6 @@ usb_detach_device(struct usb_device *udev, uint8_t iface_index, /* do the detach */ for (; i != iface_index; i++) { - iface = usbd_get_iface(udev, i); if (iface == NULL) { /* looks like the end of the USB interfaces */ @@ -1326,7 +1320,6 @@ usb_probe_and_attach_sub(struct usb_device *udev, } dev = iface->subdev; if (dev) { - /* clean up after module unload */ if (device_is_attached(dev)) { @@ -1338,7 +1331,6 @@ usb_probe_and_attach_sub(struct usb_device *udev, iface->subdev = NULL; if (device_delete_child(udev->parent_dev, dev)) { - /* * Panic here, else one can get a double call * to device_detach(). USB devices should @@ -1348,7 +1340,6 @@ usb_probe_and_attach_sub(struct usb_device *udev, } } if (uaa->temp_dev == NULL) { - /* create a new child */ uaa->temp_dev = device_add_child(udev->parent_dev, NULL, -1); if (uaa->temp_dev == NULL) { @@ -1471,7 +1462,6 @@ usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index) * handler(s): */ if (iface_index == USB_IFACE_INDEX_ANY) { - if (usb_test_quirk(&uaa, UQ_MSC_DYMO_EJECT) != 0 && usb_dymo_eject(udev, 0) == 0) { /* success, mark the udev as disappearing */ @@ -1498,7 +1488,6 @@ usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index) /* Do the probe and attach */ for (; i != j; i++) { - iface = usbd_get_iface(udev, i); if (iface == NULL) { /* @@ -1616,7 +1605,6 @@ usb_suspend_resume(struct usb_device *udev, uint8_t do_suspend) /* do the suspend or resume */ for (i = 0; i != USB_IFACE_MAX; i++) { - iface = usbd_get_iface(udev, i); if (iface == NULL) { /* looks like the end of the USB interfaces */ @@ -1898,7 +1886,6 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus, usb_set_device_state(udev, USB_STATE_POWERED); if (udev->flags.usb_mode == USB_MODE_HOST) { - err = usbd_req_set_address(udev, NULL, device_index); /* @@ -2058,7 +2045,6 @@ repeat_set_config: if (set_config_failed == 0 && config_index == 0 && usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0 && usb_test_quirk(&uaa, UQ_MSC_NO_GETMAXLUN) == 0) { - /* * Try to figure out if there are any MSC quirks we * should apply automatically: @@ -2339,7 +2325,7 @@ usb_free_device(struct usb_device *udev, uint8_t flag) /* wait for all references to go away */ usb_wait_pending_refs(udev); - + sx_destroy(&udev->enum_sx); sx_destroy(&udev->sr_sx); sx_destroy(&udev->ctrl_sx); @@ -2424,7 +2410,6 @@ usbd_find_descriptor(struct usb_device *udev, void *id, uint8_t iface_index, desc = (void *)id; while ((desc = usb_desc_foreach(cd, desc))) { - if (desc->bDescriptorType == UDESC_INTERFACE) { break; } diff --git a/sys/dev/usb/usb_generic.c b/sys/dev/usb/usb_generic.c index 940b3dc145b4..c2f8e0c171e8 100644 --- a/sys/dev/usb/usb_generic.c +++ b/sys/dev/usb/usb_generic.c @@ -138,7 +138,6 @@ SYSCTL_INT(_hw_usb_ugen, OID_AUTO, debug, CTLFLAG_RWTUN, &ugen_debug, 0, "Debug level"); #endif - /* prototypes */ static int @@ -159,7 +158,6 @@ ugen_transfer_setup(struct usb_fifo *f, error = usbd_transfer_setup(udev, &iface_index, f->xfer, setup, n_setup, f, f->priv_mtx); if (error == 0) { - if (f->xfer[0]->nframes == 1) { error = usb_fifo_alloc_buffer(f, f->xfer[0]->max_data_length, 2); @@ -738,7 +736,6 @@ ugen_get_sdesc(struct usb_fifo *f, struct usb_gen_descriptor *ugd) size, ugd->ugd_lang_id, ugd->ugd_string_index)) { error = EINVAL; } else { - if (size > ((uint8_t *)ptr)[0]) { size = ((uint8_t *)ptr)[0]; } @@ -795,7 +792,6 @@ ugen_get_iface_driver(struct usb_fifo *f, struct usb_gen_descriptor *ugd) device_is_attached(iface->subdev) && (ptr = device_get_nameunit(iface->subdev)) && (desc = device_get_desc(iface->subdev))) { - /* print description */ snprintf(buf, sizeof(buf), "%s: <%s>", ptr, desc); @@ -902,7 +898,6 @@ ugen_check_request(struct usb_device *udev, struct usb_device_request *req) * Special case - handle clearing of stall */ if (req->bmRequestType == UT_WRITE_ENDPOINT) { - ep = usbd_get_ep_by_addr(udev, req->wIndex[0]); if (ep == NULL) { return (EINVAL); @@ -1012,7 +1007,6 @@ ugen_fs_get_complete(struct usb_fifo *f, uint8_t *pindex) return (0); /* success */ } else { - *pindex = 0; /* fix compiler warning */ f->flag_iscomplete = 0; @@ -1096,7 +1090,6 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index) usbd_xfer_set_frame_offset(xfer, 0, 0); if (xfer->flags_int.control_xfr) { - req = xfer->frbuffers[0].buffer; error = copyin(fs_ep.pLength, @@ -1168,7 +1161,6 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index) xfer->flags.stall_pipe = 0; for (; n != xfer->nframes; n++) { - error = copyin(fs_ep.pLength + n, &length, sizeof(length)); if (error) { @@ -1183,7 +1175,6 @@ ugen_fs_copy_in(struct usb_fifo *f, uint8_t ep_index) rem -= length; if (!isread) { - /* we need to know the source buffer */ error = copyin(fs_ep.ppBuffer + n, &uaddr, sizeof(uaddr)); @@ -1329,7 +1320,6 @@ ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index) offset = 0; for (; n != xfer->nframes; n++) { - /* get initial length into "temp" */ error = copyin(fs_ep.pLength + n, &temp, sizeof(temp)); @@ -1355,7 +1345,6 @@ ugen_fs_copy_out(struct usb_fifo *f, uint8_t ep_index) goto complete; } if (isread) { - /* we need to know the destination buffer */ error = copyin(fs_ep.ppBuffer + n, &uaddr, sizeof(uaddr)); @@ -1571,7 +1560,6 @@ ugen_ioctl(struct usb_fifo *f, u_long cmd, void *addr, int fflags) break; } } else { - isread = ((usb_config[0].endpoint & (UE_DIR_IN | UE_DIR_OUT)) == UE_DIR_IN); @@ -2222,7 +2210,6 @@ ugen_ioctl_post(struct usb_fifo *f, u_long cmd, void *addr, int fflags) case USB_DEVICESTATS: for (n = 0; n != 4; n++) { - u.stat->uds_requests_fail[n] = f->udev->stats_err.uds_requests[n]; u.stat->uds_requests_ok[n] = diff --git a/sys/dev/usb/usb_handle_request.c b/sys/dev/usb/usb_handle_request.c index 58088644f090..69606d4f124a 100644 --- a/sys/dev/usb/usb_handle_request.c +++ b/sys/dev/usb/usb_handle_request.c @@ -101,7 +101,6 @@ usb_handle_request_callback(struct usb_xfer *xfer, usb_error_t error) err = usb_handle_request(xfer); if (err) { - if (err == USB_ERR_BAD_CONTEXT) { /* we need to re-setup the control transfer */ usb_needs_explore(xfer->xroot->bus, 0); diff --git a/sys/dev/usb/usb_hid.c b/sys/dev/usb/usb_hid.c index 1a042d2957f2..adba8e812417 100644 --- a/sys/dev/usb/usb_hid.c +++ b/sys/dev/usb/usb_hid.c @@ -298,7 +298,6 @@ hid_get_item(struct hid_data *s, struct hid_item *h) /* get next item */ while (s->p != s->end) { - bSize = hid_get_byte(s, 1); if (bSize == 0xfe) { /* long item */ diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 4fbcd6f9e360..f2180e8fc174 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -75,10 +75,8 @@ #include <dev/usb/usb_bus.h> #endif /* USB_GLOBAL_INCLUDE_FILE */ - #include <dev/usb/usb_hub_private.h> - #ifdef USB_DEBUG static int uhub_debug = 0; @@ -107,7 +105,6 @@ SYSCTL_INT(_hw_usb, OID_AUTO, disable_port_power, CTLFLAG_RWTUN, &usb_disable_port_power, 0, "Set to disable all USB port power."); #endif - #define UHUB_PROTO(sc) ((sc)->sc_udev->ddesc.bDeviceProtocol) #define UHUB_IS_HIGH_SPEED(sc) (UHUB_PROTO(sc) != UDPROTO_FSHUB) #define UHUB_IS_SINGLE_TT(sc) (UHUB_PROTO(sc) == UDPROTO_HSHUBSTT) @@ -132,7 +129,6 @@ static void usb_dev_suspend_peer(struct usb_device *udev); static uint8_t usb_peer_should_wakeup(struct usb_device *udev); static const struct usb_config uhub_config[UHUB_N_TRANSFER] = { - [UHUB_INTR_TRANSFER] = { .type = UE_INTERRUPT, .endpoint = UE_ADDR_ANY, @@ -682,7 +678,6 @@ repeat: /* check if the device is in Host Mode */ if (!(sc->sc_st.port_status & UPS_PORT_MODE_DEVICE)) { - DPRINTF("Port %d is in Host Mode\n", portno); if (sc->sc_st.port_status & UPS_SUSPEND) { @@ -1067,7 +1062,6 @@ uhub_explore(struct usb_device *udev) DPRINTFN(0, "illegal enable change, " "port %d\n", portno); } else { - if (up->restartcnt == USB_RESTART_MAX) { /* XXX could try another speed ? */ DPRINTFN(0, "port error, giving up " @@ -1556,7 +1550,6 @@ uhub_detach(device_t dev) /* Detach all ports */ for (x = 0; x != hub->nports; x++) { - child = usb_bus_port_get_device(bus, hub->ports + x); if (child == NULL) { @@ -1807,7 +1800,6 @@ usb_intr_find_best_slot(usb_size_t *ptr, uint8_t start, /* find the last slot with lesser used bandwidth */ for (x = start; x < end; x++) { - sum = 0; /* compute sum of bandwidth */ @@ -2080,7 +2072,6 @@ usbd_fs_isoc_schedule_alloc_slot(struct usb_xfer *isoc_xfer, uint16_t isoc_time) bus = isoc_xfer->xroot->bus; TAILQ_FOREACH(xfer, &bus->intr_q.head, wait_entry) { - /* skip self, if any */ if (xfer == isoc_xfer) @@ -2121,7 +2112,6 @@ usbd_fs_isoc_schedule_alloc_slot(struct usb_xfer *isoc_xfer, uint16_t isoc_time) */ TAILQ_FOREACH(pipe_xfer, &xfer->endpoint->endpoint_q[0].head, wait_entry) { - /* skip self, if any */ if (pipe_xfer == isoc_xfer) @@ -2495,7 +2485,6 @@ usb_bus_powerd(struct usb_bus *bus) */ for (x = USB_ROOT_HUB_ADDR + 1; x != bus->devices_max; x++) { - udev = bus->devices[x]; if (udev == NULL) continue; @@ -2533,7 +2522,6 @@ usb_bus_powerd(struct usb_bus *bus) for (x = USB_ROOT_HUB_ADDR + 1; x != bus->devices_max; x++) { - udev = bus->devices[x]; if (udev == NULL) continue; @@ -2864,7 +2852,6 @@ repeat: temp = usbd_get_dma_delay(udev); if (temp != 0) usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); - } if (usb_device_20_compatible(udev)) { diff --git a/sys/dev/usb/usb_hub_acpi.c b/sys/dev/usb/usb_hub_acpi.c index 45a986eb11ce..2de28f592ca1 100644 --- a/sys/dev/usb/usb_hub_acpi.c +++ b/sys/dev/usb/usb_hub_acpi.c @@ -230,8 +230,6 @@ acpi_uhub_port_sysctl(SYSCTL_HANDLER_ARGS) posstr[(port->pld[8] >> 6) & 3]); sbuf_printf(&sb, "\tHorizPosition: %s\n", posstr[(port->pld[9]) & 3]); - - } sbuf_printf(&sb, "\tShape: %s\n", shapestr[(port->pld[9] >> 2) & 0xf]); @@ -492,7 +490,7 @@ acpi_uhub_root_attach(device_t dev) if ((ret = uhub_attach(dev)) != 0) { return (ret); } - + if ((ret = acpi_uhub_attach_common(dev)) != 0) { acpi_uhub_detach(dev); } @@ -558,7 +556,6 @@ acpi_uhub_child_location_string(device_t parent, device_t child, return (0); } - static device_method_t acpi_uhub_methods[] = { DEVMETHOD(device_probe, acpi_uhub_probe), DEVMETHOD(device_attach, acpi_uhub_attach), diff --git a/sys/dev/usb/usb_hub_private.h b/sys/dev/usb/usb_hub_private.h index 1151ed7d1931..ddb401082061 100644 --- a/sys/dev/usb/usb_hub_private.h +++ b/sys/dev/usb/usb_hub_private.h @@ -44,7 +44,6 @@ enum { UHUB_N_TRANSFER, }; - struct uhub_current_state { uint16_t port_change; uint16_t port_status; diff --git a/sys/dev/usb/usb_lookup.c b/sys/dev/usb/usb_lookup.c index 09605f54ba6a..2d0e9b1b370a 100644 --- a/sys/dev/usb/usb_lookup.c +++ b/sys/dev/usb/usb_lookup.c @@ -84,7 +84,6 @@ usbd_lookup_id_by_info(const struct usb_device_id *id, usb_size_t sizeof_id, * until we reach the end of the matching array: */ for (; id != id_end; id++) { - if ((id->match_flag_vendor) && (id->idVendor != info->idVendor)) { continue; @@ -152,4 +151,3 @@ usbd_lookup_id_by_uaa(const struct usb_device_id *id, usb_size_t sizeof_id, } return (ENXIO); } - diff --git a/sys/dev/usb/usb_mbuf.c b/sys/dev/usb/usb_mbuf.c index 4eb27cf6977e..8da2f514cd65 100644 --- a/sys/dev/usb/usb_mbuf.c +++ b/sys/dev/usb/usb_mbuf.c @@ -74,7 +74,6 @@ usb_alloc_mbufs(struct malloc_type *type, struct usb_ifqueue *ifq, block_size += ((-block_size) & (USB_HOST_ALIGN - 1)); if (nblocks && block_size) { - alloc_size = (block_size + sizeof(struct usb_mbuf)) * nblocks; free_ptr = malloc(alloc_size, type, M_WAITOK | M_ZERO); diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c index b8b39596b05e..0fffd99a73c4 100644 --- a/sys/dev/usb/usb_msctest.c +++ b/sys/dev/usb/usb_msctest.c @@ -195,7 +195,6 @@ static struct bbb_transfer *bbb_attach(struct usb_device *, uint8_t, uint8_t); static void bbb_detach(struct bbb_transfer *); static const struct usb_config bbb_config[ST_MAX] = { - [ST_COMMAND] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -255,7 +254,6 @@ static const struct usb_config bbb_config[ST_MAX] = { }; static const struct usb_config bbb_raw_config[1] = { - [0] = { .type = UE_BULK_INTR, .endpoint = UE_ADDR_ANY, @@ -746,7 +744,6 @@ usb_msc_get_max_lun(struct usb_device *udev, uint8_t iface_index) usb_error_t err; uint8_t buf = 0; - /* The Get Max Lun command is a class-specific request. */ req.bmRequestType = UT_READ_CLASS_INTERFACE; req.bRequest = 0xFE; /* GET_MAX_LUN */ @@ -845,7 +842,6 @@ retry_sync_cache: USB_MS_HZ); if (err != 0) { - if (err != ERR_CSW_FAILED) goto error; @@ -853,7 +849,6 @@ retry_sync_cache: usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE); } else { - /* * Certain Kingston memory sticks fail the first * read capacity after a synchronize cache command @@ -898,7 +893,6 @@ retry_sync_cache: DPRINTF("Inquiry = %d\n", err); if (err != 0) { - if (err != ERR_CSW_FAILED) goto error; } @@ -910,7 +904,6 @@ retry_sync_cache: DPRINTF("Request sense = %d\n", err); if (err != 0) { - if (err != ERR_CSW_FAILED) goto error; } diff --git a/sys/dev/usb/usb_pf.c b/sys/dev/usb/usb_pf.c index eff9a7a65400..6ccb5ebbc62b 100644 --- a/sys/dev/usb/usb_pf.c +++ b/sys/dev/usb/usb_pf.c @@ -101,7 +101,7 @@ usbpf_uninit(void *arg) struct usb_bus *ubus; int error; int i; - + if_clone_detach(usbpf_cloner); dc = devclass_find(usbusname); @@ -121,7 +121,7 @@ usbpf_uninit(void *arg) static int usbpf_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { - + /* No configuration allowed. */ return (EINVAL); } @@ -234,7 +234,7 @@ usbpf_clone_destroy(struct if_clone *ifc, struct ifnet *ifp) if_detach(ifp); if_free(ifp); ifc_free_unit(ifc, unit); - + return (0); } diff --git a/sys/dev/usb/usb_process.c b/sys/dev/usb/usb_process.c index f1511fc1edcb..37495608a30d 100644 --- a/sys/dev/usb/usb_process.c +++ b/sys/dev/usb/usb_process.c @@ -123,7 +123,6 @@ usb_process(void *arg) up->up_curtd = td; while (1) { - if (up->up_gone) break; @@ -450,7 +449,6 @@ usb_proc_drain(struct usb_process *up) up->up_gone = 1; while (up->up_ptr) { - /* Check if we need to wakeup the USB process */ if (up->up_msleep || up->up_csleep) { diff --git a/sys/dev/usb/usb_request.c b/sys/dev/usb/usb_request.c index 32bf0a9435ef..fbbab17544b4 100644 --- a/sys/dev/usb/usb_request.c +++ b/sys/dev/usb/usb_request.c @@ -274,7 +274,6 @@ tr_setup: ep = ep_first; /* endpoint wrapped around */ if (ep->edesc && ep->is_stalled) { - /* setup a clear-stall packet */ req.bmRequestType = UT_WRITE_ENDPOINT; @@ -1003,7 +1002,6 @@ usbd_req_get_desc(struct usb_device *udev, USETW(req.wIndex, id); while (1) { - if ((min_len < 2) || (max_len < 2)) { err = USB_ERR_INVAL; goto done; @@ -1051,7 +1049,6 @@ usbd_req_get_desc(struct usb_device *udev, } if (min_len == max_len) { - /* enforce correct length */ if ((buf[0] > min_len) && (actlen == NULL)) buf[0] = min_len; @@ -2312,4 +2309,3 @@ usbd_req_set_lpm_info(struct usb_device *udev, struct mtx *mtx, } return (err); } - diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index ab70da8afd4c..871f8d729658 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -79,7 +79,6 @@ struct usb_std_packet_size { static usb_callback_t usb_request_callback; static const struct usb_config usb_control_ep_cfg[USB_CTRL_XFER_MAX] = { - /* This transfer is used for generic control endpoint transfers */ [0] = { @@ -107,7 +106,6 @@ static const struct usb_config usb_control_ep_cfg[USB_CTRL_XFER_MAX] = { }; static const struct usb_config usb_control_ep_quirk_cfg[USB_CTRL_XFER_MAX] = { - /* This transfer is used for generic control endpoint transfers */ [0] = { @@ -332,7 +330,6 @@ usbd_transfer_setup_sub_malloc(struct usb_setup_params *parm, } } else { for (x = 0; x != n_dma_pc; x++) { - if (r < n_obj) { /* compute last remainder */ z = r * size; @@ -349,7 +346,6 @@ usbd_transfer_setup_sub_malloc(struct usb_setup_params *parm, pg += n_dma_pg; for (y = 0; (y != n_obj); y++, r--, pc++, pg += n_dma_pg) { - /* Load sub-chunk into DMA */ if (usb_pc_dmamap_create(pc, size)) { return (1); /* failure */ @@ -576,7 +572,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) usbd_get_std_packet_size(&std_size, type, parm->speed); if (std_size.range.min || std_size.range.max) { - if (xfer->max_packet_size < std_size.range.min) { xfer->max_packet_size = std_size.range.min; } @@ -584,7 +579,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) xfer->max_packet_size = std_size.range.max; } } else { - if (xfer->max_packet_size >= std_size.fixed[3]) { xfer->max_packet_size = std_size.fixed[3]; } else if (xfer->max_packet_size >= std_size.fixed[2]) { @@ -603,7 +597,7 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) */ if (maxp_old != xfer->max_packet_size) xfer->flags_int.maxp_was_clamped = 1; - + /* compute "max_frame_size" */ usbd_update_max_frame_size(xfer); @@ -611,7 +605,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) /* check interrupt interval and transfer pre-delay */ if (type == UE_ISOCHRONOUS) { - uint16_t frame_limit; xfer->interval = 0; /* not used, must be zero */ @@ -658,17 +651,14 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) goto done; } } else { - /* * If a value is specified use that else check the * endpoint descriptor! */ if (type == UE_INTERRUPT) { - uint32_t temp; if (xfer->interval == 0) { - xfer->interval = edesc->bInterval; switch (parm->speed) { @@ -723,13 +713,11 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) if ((xfer->max_frame_size == 0) || (xfer->max_packet_size == 0)) { - zmps = 1; if ((parm->bufsize <= MIN_PKT) && (type != UE_CONTROL) && (type != UE_BULK)) { - /* workaround */ xfer->max_packet_size = MIN_PKT; xfer->max_packet_count = 1; @@ -751,7 +739,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) */ if (parm->bufsize == 0) { - parm->bufsize = xfer->max_frame_size; if (type == UE_ISOCHRONOUS) { @@ -764,7 +751,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) */ if (xfer->flags.proxy_buffer) { - /* round bufsize up */ parm->bufsize += (xfer->max_frame_size - 1); @@ -792,7 +778,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) n_frlengths = xfer->nframes; n_frbuffers = 1; } else { - if (type == UE_CONTROL) { xfer->flags_int.control_xfr = 1; if (xfer->nframes == 0) { @@ -822,7 +807,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) */ if (type == UE_CONTROL) { - if (xfer->max_data_length < REQ_SIZE) { /* length wrapped around or too small bufsize */ parm->err = USB_ERR_INVAL; @@ -859,7 +843,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) &pc, parm->bufsize, 1, 1)) { parm->err = USB_ERR_NOMEM; } else if (parm->buf != NULL) { - usbd_get_page(pc, 0, &page_info); xfer->local_buffer = page_info.buffer; @@ -950,7 +933,6 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) #if USB_HAVE_BUSDMA if (xfer->flags_int.bdma_enable && (parm->bufsize_max > 0)) { - if (usb_pc_dmamap_create( xfer->frbuffers + x, parm->bufsize_max)) { @@ -1075,7 +1057,6 @@ usbd_transfer_setup(struct usb_device *udev, /* setup all transfers */ while (1) { - if (buf) { /* * Initialize the "usb_xfer_root" structure, @@ -1145,7 +1126,6 @@ usbd_transfer_setup(struct usb_device *udev, for (setup = setup_start, n = 0; setup != setup_end; setup++, n++) { - /* skip USB transfers without callbacks: */ if (setup->callback == NULL) { continue; @@ -1619,9 +1599,7 @@ usbd_setup_ctrl_transfer(struct usb_xfer *xfer) * transfer in progress: */ if (xfer->flags_int.control_act) { - if (xfer->flags_int.control_hdr) { - /* clear send header flag */ xfer->flags_int.control_hdr = 0; @@ -1636,7 +1614,6 @@ usbd_setup_ctrl_transfer(struct usb_xfer *xfer) len = xfer->sumlen; } else { - /* the size of the SETUP structure is hardcoded ! */ if (xfer->frlengths[0] != sizeof(struct usb_device_request)) { @@ -1647,7 +1624,6 @@ usbd_setup_ctrl_transfer(struct usb_xfer *xfer) } /* check USB mode */ if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { - /* check number of frames */ if (xfer->nframes != 1) { /* @@ -1665,7 +1641,6 @@ usbd_setup_ctrl_transfer(struct usb_xfer *xfer) */ xfer->flags_int.control_rem = 0xFFFF; } else { - /* setup "endpoint" and "control_rem" */ usbd_control_transfer_init(xfer); @@ -1872,7 +1847,6 @@ usbd_transfer_submit(struct usb_xfer *xfer) /* check if this is a control transfer */ if (xfer->flags_int.control_xfr) { - if (usbd_setup_ctrl_transfer(xfer)) { USB_BUS_LOCK(bus); usbd_transfer_done(xfer, USB_ERR_STALLED); @@ -1885,7 +1859,6 @@ usbd_transfer_submit(struct usb_xfer *xfer) * in case of data read direction */ if (USB_GET_DATA_ISREAD(xfer)) { - if (xfer->flags.short_frames_ok) { xfer->flags_int.short_xfer_ok = 1; xfer->flags_int.short_frames_ok = 1; @@ -2161,7 +2134,6 @@ usbd_transfer_drain(struct usb_xfer *xfer) while (usbd_transfer_pending(xfer) || xfer->flags_int.doing_callback) { - /* * It is allowed that the callback can drop its * transfer mutex. In that case checking only @@ -2395,7 +2367,6 @@ usbd_callback_ss_done_defer(struct usb_xfer *xfer) usbd_transfer_enqueue(pq, xfer); } if (!pq->recurse_1) { - /* * We have to postpone the callback due to the fact we * will have a Lock Order Reversal, LOR, if we try to @@ -2475,7 +2446,6 @@ usbd_callback_wrapper(struct usb_xfer_queue *pq) goto done; } } else { - if (usbd_callback_wrapper_sub(xfer)) { /* the callback has been deferred */ USB_BUS_LOCK(info->bus); @@ -2842,7 +2812,6 @@ usbd_pipe_start(struct usb_xfer_queue *pq) return; } } else if (type == UE_ISOCHRONOUS) { - /* * Make sure any FIFO overflow or other FIFO * error conditions go away by resetting the @@ -2963,7 +2932,6 @@ usbd_callback_wrapper_sub(struct usb_xfer *xfer) (xfer->error == USB_ERR_CANCELLED || xfer->error == USB_ERR_TIMEOUT || bus->methods->start_dma_delay != NULL)) { - usb_timeout_t temp; /* only delay once */ @@ -3068,7 +3036,6 @@ usbd_callback_wrapper_sub(struct usb_xfer *xfer) } else { /* check for short transfers */ if (xfer->actlen < xfer->sumlen) { - /* end of control transfer, if any */ xfer->flags_int.control_act = 0; @@ -3146,7 +3113,6 @@ usb_command_wrapper(struct usb_xfer_queue *pq, struct usb_xfer *xfer) } if (!pq->recurse_1) { - /* clear third recurse flag */ pq->recurse_3 = 0; @@ -3475,7 +3441,6 @@ usbd_transfer_poll(struct usb_xfer **ppxfer, uint16_t max) /* check for clear stall */ if (udev->ctrl_xfer[1] != NULL) { - /* poll clear stall start */ pm = &udev->cs_msg[0].hdr; (pm->pm_callback) (pm); diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index e81c0a4854e9..834a04c95b17 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -102,7 +102,6 @@ typedef int (usb_fifo_ioctl_t)(struct usb_fifo *fifo, u_long cmd, void *addr, in typedef void (usb_fifo_cmd_t)(struct usb_fifo *fifo); typedef void (usb_fifo_filter_t)(struct usb_fifo *fifo, struct usb_mbuf *m); - /* USB events */ #ifndef USB_GLOBAL_INCLUDE_FILE #include <sys/_eventhandler.h> @@ -267,7 +266,6 @@ struct usb_config { * "usb_device_id". */ struct usb_device_id { - /* Select which fields to match against */ #if BYTE_ORDER == LITTLE_ENDIAN uint16_t diff --git a/sys/dev/usb/video/udl.c b/sys/dev/usb/video/udl.c index e9244d3beb2b..892e61ae2da0 100644 --- a/sys/dev/usb/video/udl.c +++ b/sys/dev/usb/video/udl.c @@ -785,7 +785,6 @@ udl_select_chip(struct udl_softc *sc, struct usb_attach_arg *uaa) if ((uaa->info.idVendor == USB_VENDOR_DISPLAYLINK) && (uaa->info.idProduct == USB_PRODUCT_DISPLAYLINK_WSDVI)) { - /* * WS Tech DVI is DL120 or DL160. All deviced uses the * same revision (0.04) so iSerialNumber must be used @@ -801,7 +800,6 @@ udl_select_chip(struct udl_softc *sc, struct usb_attach_arg *uaa) } if ((uaa->info.idVendor == USB_VENDOR_DISPLAYLINK) && (uaa->info.idProduct == USB_PRODUCT_DISPLAYLINK_SWDVI)) { - /* * SUNWEIT DVI is DL160, DL125, DL165 or DL195. Major revision * can be used to differ between DL1x0 and DL1x5. Minor to diff --git a/sys/dev/usb/wlan/if_rsu.c b/sys/dev/usb/wlan/if_rsu.c index da0ff7aea8a4..0505af9ae941 100644 --- a/sys/dev/usb/wlan/if_rsu.c +++ b/sys/dev/usb/wlan/if_rsu.c @@ -659,7 +659,7 @@ rsu_do_request(struct rsu_softc *sc, struct usb_device_request *req, { usb_error_t err; int ntries = 10; - + RSU_ASSERT_LOCKED(sc); while (ntries--) { @@ -1894,7 +1894,7 @@ rsu_site_survey(struct rsu_softc *sc, struct ieee80211_scan_ssid *ssid) if (sc->sc_active_scan) cmd.active = htole32(1); cmd.limit = htole32(48); - + if (ssid != NULL) { sc->sc_extra_scan = 1; cmd.ssidlen = htole32(ssid->len); @@ -2330,7 +2330,7 @@ rsu_rx_copy_to_mbuf(struct rsu_softc *sc, struct r92s_rx_stat *stat, /* Finalize mbuf. */ memcpy(mtod(m, uint8_t *), (uint8_t *)stat, totlen); m->m_pkthdr.len = m->m_len = totlen; - + return (m); fail: counter_u64_add(ic->ic_ierrors, 1); @@ -3527,7 +3527,6 @@ rsu_load_firmware(struct rsu_softc *sc) return (error); } - static int rsu_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, const struct ieee80211_bpf_params *params) diff --git a/sys/dev/usb/wlan/if_rumreg.h b/sys/dev/usb/wlan/if_rumreg.h index 96726b14956d..70354c49285e 100644 --- a/sys/dev/usb/wlan/if_rumreg.h +++ b/sys/dev/usb/wlan/if_rumreg.h @@ -117,7 +117,6 @@ #define RT2573_STA_CSR4 0x30d0 #define RT2573_STA_CSR5 0x30d4 - /* possible values for register RT2573_ADDR_MODE */ #define RT2573_MODE_MASK 0x7 #define RT2573_MODE_NOSEC 0 diff --git a/sys/dev/usb/wlan/if_run.c b/sys/dev/usb/wlan/if_run.c index bf732e4ca971..7af4bc66dfb3 100644 --- a/sys/dev/usb/wlan/if_run.c +++ b/sys/dev/usb/wlan/if_run.c @@ -2785,7 +2785,6 @@ run_newassoc(struct ieee80211_node *ni, int isnew) /* only interested in true associations */ if (isnew && ni->ni_associd != 0) { - /* * This function could is called though timeout function. * Need to defer. @@ -3792,7 +3791,7 @@ run_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, { struct run_softc *sc = ni->ni_ic->ic_softc; int error = 0; - + RUN_LOCK(sc); /* prevent management frames from being sent if we're not ready */ @@ -6407,7 +6406,6 @@ run_delay(struct run_softc *sc, u_int ms) &sc->sc_mtx : NULL, USB_MS_TO_TICKS(ms)); } - static void run_update_chw(struct ieee80211com *ic) { diff --git a/sys/dev/usb/wlan/if_runreg.h b/sys/dev/usb/wlan/if_runreg.h index ded41b62b3e5..8e0c8f1f2ba1 100644 --- a/sys/dev/usb/wlan/if_runreg.h +++ b/sys/dev/usb/wlan/if_runreg.h @@ -209,7 +209,6 @@ #define RT2860_H2M_BBPAGENT 0x7028 #define RT2860_BCN_BASE(vap) (0x7800 + (vap) * 512) - /* possible flags for register RT2860_PCI_EECTRL */ #define RT2860_C (1 << 0) #define RT2860_S (1 << 1) diff --git a/sys/dev/usb/wlan/if_upgt.c b/sys/dev/usb/wlan/if_upgt.c index 29d434fc411b..26c57d7944f5 100644 --- a/sys/dev/usb/wlan/if_upgt.c +++ b/sys/dev/usb/wlan/if_upgt.c @@ -895,7 +895,7 @@ upgt_set_chan(struct upgt_softc *sc, struct ieee80211_channel *c) "%s: invalid channel %x\n", __func__, channel); return; } - + DPRINTF(sc, UPGT_DEBUG_STATE, "%s: channel %d\n", __func__, channel); data_cmd = upgt_getbuf(sc); @@ -1056,7 +1056,6 @@ upgt_eeprom_parse(struct upgt_softc *sc) (sizeof(struct upgt_eeprom_header) + preamble_len)); while (!option_end) { - /* sanity check */ if (eeprom_option >= (struct upgt_eeprom_option *) (sc->sc_eeprom + UPGT_EEPROM_SIZE)) { @@ -1483,7 +1482,7 @@ upgt_rx_rate(struct upgt_softc *sc, const int rate) static const uint8_t cck_upgt2rate[4] = { 2, 4, 11, 22 }; static const uint8_t ofdm_upgt2rate[12] = { 2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108 }; - + if (ic->ic_curmode == IEEE80211_MODE_11B && !(rate < 0 || rate > 3)) return cck_upgt2rate[rate & 0xf]; @@ -1672,7 +1671,7 @@ static int upgt_fw_copy(const uint8_t *src, char *dst, int size) { int i, j; - + for (i = 0, j = 0; i < size && j < size; i++) { switch (src[i]) { case 0x7e: diff --git a/sys/dev/usb/wlan/if_ural.c b/sys/dev/usb/wlan/if_ural.c index 5b713d3db67d..4a2ed51928a7 100644 --- a/sys/dev/usb/wlan/if_ural.c +++ b/sys/dev/usb/wlan/if_ural.c @@ -758,7 +758,6 @@ fail: return (-1); } - static void ural_bulk_write_callback(struct usb_xfer *xfer, usb_error_t error) { diff --git a/sys/dev/usb/wlan/if_uralreg.h b/sys/dev/usb/wlan/if_uralreg.h index 3554fe6fe72a..22d763d0dc33 100644 --- a/sys/dev/usb/wlan/if_uralreg.h +++ b/sys/dev/usb/wlan/if_uralreg.h @@ -98,7 +98,6 @@ */ #define RAL_STA_CSR0 0x04e0 /* FCS error */ - #define RAL_DISABLE_RX (1 << 0) #define RAL_DROP_CRC (1 << 1) #define RAL_DROP_PHY (1 << 2) diff --git a/sys/dev/usb/wlan/if_uralvar.h b/sys/dev/usb/wlan/if_uralvar.h index b59b79116f34..6f6d01ed75e4 100644 --- a/sys/dev/usb/wlan/if_uralvar.h +++ b/sys/dev/usb/wlan/if_uralvar.h @@ -24,7 +24,6 @@ #define URAL_SCAN_END 2 #define URAL_SET_CHANNEL 3 - struct ural_rx_radiotap_header { struct ieee80211_radiotap_header wr_ihdr; uint8_t wr_flags; diff --git a/sys/dev/usb/wlan/if_urtw.c b/sys/dev/usb/wlan/if_urtw.c index 7ff8463cff16..0ee538ffbe43 100644 --- a/sys/dev/usb/wlan/if_urtw.c +++ b/sys/dev/usb/wlan/if_urtw.c @@ -886,7 +886,7 @@ urtw_attach(device_t dev) IEEE80211_C_WPA; /* 802.11i */ /* XXX TODO: setup regdomain if URTW_EPROM_CHANPLAN_BY_HW bit is set.*/ - + urtw_getradiocaps(ic, IEEE80211_CHAN_MAX, &ic->ic_nchans, ic->ic_channels); @@ -2293,7 +2293,6 @@ fail: return (error); } - static usb_error_t urtw_get_txpwr(struct urtw_softc *sc) { @@ -2359,7 +2358,6 @@ fail: return (error); } - static usb_error_t urtw_get_rfchip(struct urtw_softc *sc) { @@ -2446,7 +2444,6 @@ fail: return (error); } - static usb_error_t urtw_led_init(struct urtw_softc *sc) { @@ -2481,7 +2478,6 @@ fail: return (error); } - static usb_error_t urtw_8225_rf_init(struct urtw_softc *sc) { @@ -2828,7 +2824,6 @@ fail: return (error); } - static usb_error_t urtw_8225_rf_stop(struct urtw_softc *sc) { @@ -3092,7 +3087,6 @@ fail: return (error); } - static usb_error_t urtw_8225v2_set_txpwrlvl(struct urtw_softc *sc, int chan) { diff --git a/sys/dev/usb/wlan/if_zyd.c b/sys/dev/usb/wlan/if_zyd.c index 21086f871f39..8a6e41bcd27f 100644 --- a/sys/dev/usb/wlan/if_zyd.c +++ b/sys/dev/usb/wlan/if_zyd.c @@ -435,7 +435,6 @@ zyd_drain_mbufq(struct zyd_softc *sc) } } - static int zyd_detach(device_t dev) { @@ -677,7 +676,6 @@ zyd_intr_read_callback(struct usb_xfer *xfer, usb_error_t error) IEEE80211_RATECTL_TX_SUCCESS; } - ieee80211_ratectl_tx_complete(ni, txs); ieee80211_free_node(ni); } @@ -1239,7 +1237,7 @@ zyd_al2230_bandedge6(struct zyd_rf *rf, struct ieee80211_channel *c) if (chan == 1 || chan == 11) r[0].val = 0x12; - + for (i = 0; i < nitems(r); i++) zyd_write16_m(sc, r[i].reg, r[i].val); fail: diff --git a/sys/dev/usb/wlan/if_zydreg.h b/sys/dev/usb/wlan/if_zydreg.h index a4523199d926..d964405d9b77 100644 --- a/sys/dev/usb/wlan/if_zydreg.h +++ b/sys/dev/usb/wlan/if_zydreg.h @@ -1312,4 +1312,3 @@ struct zyd_softc { #define ZYD_LOCK(sc) mtx_lock(&(sc)->sc_mtx) #define ZYD_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) #define ZYD_LOCK_ASSERT(sc, t) mtx_assert(&(sc)->sc_mtx, t) - |
