bhyve: Simplify control flow in the xhci device model
We only need to call pci_xhci_xfer_complete() when handling a transfer to the control endpoint, so move that code into the epid == 1 block and eliminate a goto. Also remove an unneeded reinitialization of setup_trb. No functional change intended. MFC after: 1 week Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37287
This commit is contained in:
parent
db494ceb65
commit
c4c368fb3e
@ -1725,7 +1725,7 @@ pci_xhci_handle_transfer(struct pci_xhci_softc *sc,
|
|||||||
DPRINTF(("pci_xhci handle_transfer slot %u", slot));
|
DPRINTF(("pci_xhci handle_transfer slot %u", slot));
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
err = 0;
|
err = XHCI_TRB_ERROR_INVALID;
|
||||||
do_retry = 0;
|
do_retry = 0;
|
||||||
do_intr = 0;
|
do_intr = 0;
|
||||||
setup_trb = NULL;
|
setup_trb = NULL;
|
||||||
@ -1849,24 +1849,26 @@ pci_xhci_handle_transfer(struct pci_xhci_softc *sc,
|
|||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
if (epid == 1) {
|
if (epid == 1) {
|
||||||
err = USB_ERR_NOT_STARTED;
|
int usberr;
|
||||||
|
|
||||||
if (dev->dev_ue->ue_request != NULL)
|
if (dev->dev_ue->ue_request != NULL)
|
||||||
err = dev->dev_ue->ue_request(dev->dev_sc, xfer);
|
usberr = dev->dev_ue->ue_request(dev->dev_sc, xfer);
|
||||||
setup_trb = NULL;
|
else
|
||||||
|
usberr = USB_ERR_NOT_STARTED;
|
||||||
|
err = USB_TO_XHCI_ERR(usberr);
|
||||||
|
if (err == XHCI_TRB_ERROR_SUCCESS ||
|
||||||
|
err == XHCI_TRB_ERROR_STALL ||
|
||||||
|
err == XHCI_TRB_ERROR_SHORT_PKT) {
|
||||||
|
err = pci_xhci_xfer_complete(sc, xfer, slot, epid,
|
||||||
|
&do_intr);
|
||||||
|
if (err != XHCI_TRB_ERROR_SUCCESS)
|
||||||
|
do_retry = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* handle data transfer */
|
/* handle data transfer */
|
||||||
pci_xhci_try_usb_xfer(sc, dev, devep, ep_ctx, slot, epid);
|
pci_xhci_try_usb_xfer(sc, dev, devep, ep_ctx, slot, epid);
|
||||||
err = XHCI_TRB_ERROR_SUCCESS;
|
err = XHCI_TRB_ERROR_SUCCESS;
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = USB_TO_XHCI_ERR(err);
|
|
||||||
if ((err == XHCI_TRB_ERROR_SUCCESS) ||
|
|
||||||
(err == XHCI_TRB_ERROR_STALL) ||
|
|
||||||
(err == XHCI_TRB_ERROR_SHORT_PKT)) {
|
|
||||||
err = pci_xhci_xfer_complete(sc, xfer, slot, epid, &do_intr);
|
|
||||||
if (err != XHCI_TRB_ERROR_SUCCESS)
|
|
||||||
do_retry = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
|
Loading…
Reference in New Issue
Block a user