Changeset 928afc8d in mainline


Ignore:
Timestamp:
2017-10-26T13:20:50Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a501aaba
Parents:
25251bb
Message:

xhci: unleash the full power of xhci_cmd_sync_inline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/hc.c

    r25251bb r928afc8d  
    620620{
    621621        assert(hc);
    622 
    623         int err;
    624         if ((err = xhci_cmd_sync_inline(hc, DISABLE_SLOT, .slot_id = slot_id))) {
    625                 return err;
    626         }
    627 
    628         return EOK;
     622        return xhci_cmd_sync_inline(hc, DISABLE_SLOT, .slot_id = slot_id);
    629623}
    630624
     
    718712int hc_configure_device(xhci_hc_t *hc, uint32_t slot_id)
    719713{
    720         int err;
    721 
    722714        /* Issue configure endpoint command (sec 4.3.5). */
    723715        xhci_input_ctx_t *ictx;
    724         if ((err = create_valid_input_ctx(&ictx))) {
     716        const int err = create_valid_input_ctx(&ictx);
     717        if (err)
    725718                return err;
    726         }
     719
    727720        // TODO: Set slot context and other flags. (probably forgot a lot of 'em)
    728721
    729         if ((err = xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx))) {
    730                 return err;
    731         }
    732 
    733         return EOK;
     722        return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx);
    734723}
    735724
    736725int hc_deconfigure_device(xhci_hc_t *hc, uint32_t slot_id)
    737726{
    738         int err;
    739 
    740727        /* Issue configure endpoint command (sec 4.3.5) with the DC flag. */
    741         if ((err = xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .deconfigure = true))) {
    742                 return err;
    743         }
    744 
    745         return EOK;
     728        return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .deconfigure = true);
    746729}
    747730
    748731int hc_add_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx, xhci_ep_ctx_t *ep_ctx)
    749732{
    750         int err;
    751 
    752733        /* Issue configure endpoint command (sec 4.3.5). */
    753734        xhci_input_ctx_t *ictx;
    754         if ((err = create_valid_input_ctx(&ictx))) {
     735        const int err = create_valid_input_ctx(&ictx);
     736        if (err)
    755737                return err;
    756         }
    757738
    758739        XHCI_INPUT_CTRL_CTX_ADD_SET(ictx->ctrl_ctx, ep_idx + 1); /* Preceded by slot ctx */
     
    760741        // TODO: Set slot context and other flags. (probably forgot a lot of 'em)
    761742
    762         if ((err = xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx))) {
    763                 return err;
    764         }
    765 
    766         return EOK;
     743        return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx);
    767744}
    768745
    769746int hc_drop_endpoint(xhci_hc_t *hc, uint32_t slot_id, uint8_t ep_idx)
    770747{
    771         int err;
    772 
    773748        /* Issue configure endpoint command (sec 4.3.5). */
    774749        xhci_input_ctx_t *ictx;
    775         if ((err = create_valid_input_ctx(&ictx))) {
     750        const int err = create_valid_input_ctx(&ictx);
     751        if (err)
    776752                return err;
    777         }
    778753
    779754        XHCI_INPUT_CTRL_CTX_DROP_SET(ictx->ctrl_ctx, ep_idx + 1); /* Preceded by slot ctx */
    780755        // TODO: Set slot context and other flags. (probably forgot a lot of 'em)
    781756
    782         if ((err = xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx))) {
    783                 return err;
    784         }
    785 
    786         return EOK;
     757        return xhci_cmd_sync_inline(hc, CONFIGURE_ENDPOINT, .slot_id = slot_id, .input_ctx = ictx);
    787758}
    788759
Note: See TracChangeset for help on using the changeset viewer.