Changeset e2172284 in mainline for uspace/drv/bus/usb/xhci/commands.h


Ignore:
Timestamp:
2018-03-27T06:34:31Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bf2042f9
Parents:
eb748a0
git-author:
Jiri Svoboda <jiri@…> (2018-03-26 22:14:11)
git-committer:
Jiri Svoboda <jiri@…> (2018-03-27 06:34:31)
Message:

Too much magic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/commands.h

    reb748a0 re2172284  
    144144extern errno_t xhci_cmd_async_fini(xhci_hc_t *, xhci_cmd_t *);
    145145
    146 static inline errno_t xhci_cmd_sync_inline_wrapper(xhci_hc_t *hc, xhci_cmd_t cmd)
    147 {
    148         /* Poor man's xhci_cmd_init (everything else is zeroed) */
    149         link_initialize(&cmd._header.link);
    150         fibril_mutex_initialize(&cmd._header.completed_mtx);
    151         fibril_condvar_initialize(&cmd._header.completed_cv);
    152 
    153         /* Issue the command */
    154         const errno_t err = xhci_cmd_sync(hc, &cmd);
    155         xhci_cmd_fini(&cmd);
    156 
    157         return err;
    158 }
    159 
    160 /** The inline macro expects:
    161  *    - hc      - HC to schedule command on (xhci_hc_t *).
    162  *    - command - Member of `xhci_cmd_type_t` without the "XHCI_CMD_" prefix.
    163  *    - VA_ARGS - (optional) Command arguments in struct initialization notation.
    164  *
    165  *  The return code and semantics matches those of `xhci_cmd_sync_fini`.
    166  *
    167  *  Example:
    168  *    errno_t err = xhci_cmd_sync_inline(hc, DISABLE_SLOT, .slot_id = 42);
    169  */
    170 
    171 #define xhci_cmd_sync_inline(hc, command, ...) \
    172         xhci_cmd_sync_inline_wrapper(hc, \
    173         (xhci_cmd_t) { ._header.cmd = XHCI_CMD_##command, ##__VA_ARGS__ })
    174 
    175146#endif
    176147
Note: See TracChangeset for help on using the changeset viewer.