Changeset 45457265 in mainline for uspace/drv/bus/usb/xhci/commands.c


Ignore:
Timestamp:
2018-02-03T02:14:26Z (6 years ago)
Author:
Jenda <jenda.jzqk73@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eb862fd
Parents:
961a5ee
Message:

errno_t all the things!

File:
1 edited

Legend:

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

    r961a5ee r45457265  
    7272 * reset before starting.
    7373 */
    74 int xhci_init_commands(xhci_hc_t *hc)
     74errno_t xhci_init_commands(xhci_hc_t *hc)
    7575{
    7676        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
    77         int err;
     77        errno_t err;
    7878
    7979        if ((err = xhci_trb_ring_init(&cr->trb_ring, 0)))
     
    172172}
    173173
    174 static int wait_for_ring_open(xhci_cmd_ring_t *cr)
     174static errno_t wait_for_ring_open(xhci_cmd_ring_t *cr)
    175175{
    176176        assert(fibril_mutex_is_locked(&cr->guard));
     
    194194 * Register the command as waiting for completion inside the command list.
    195195 */
    196 static inline int enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
     196static inline errno_t enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
    197197{
    198198        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
     
    210210        list_append(&cmd->_header.link, &cr->cmd_list);
    211211
    212         int err = EOK;
     212        errno_t err = EOK;
    213213        while (err == EOK) {
    214214                err = xhci_trb_ring_enqueue(&cr->trb_ring,
     
    343343 * @param trb The COMMAND_COMPLETION TRB found in event ring.
    344344 */
    345 int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
     345errno_t xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
    346346{
    347347        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
     
    416416/* Command-issuing functions */
    417417
    418 static int no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     418static errno_t no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    419419{
    420420        assert(hc);
     
    427427}
    428428
    429 static int enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     429static errno_t enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    430430{
    431431        assert(hc);
     
    440440}
    441441
    442 static int disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     442static errno_t disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    443443{
    444444        assert(hc);
     
    453453}
    454454
    455 static int address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     455static errno_t address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    456456{
    457457        assert(hc);
     
    483483}
    484484
    485 static int configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     485static errno_t configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    486486{
    487487        assert(hc);
     
    504504}
    505505
    506 static int evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     506static errno_t evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    507507{
    508508        assert(hc);
     
    526526}
    527527
    528 static int reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     528static errno_t reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    529529{
    530530        assert(hc);
     
    541541}
    542542
    543 static int stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     543static errno_t stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    544544{
    545545        assert(hc);
     
    556556}
    557557
    558 static int set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     558static errno_t set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    559559{
    560560        assert(hc);
     
    572572}
    573573
    574 static int reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     574static errno_t reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    575575{
    576576        assert(hc);
     
    585585}
    586586
    587 static int get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
     587static errno_t get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
    588588{
    589589        assert(hc);
     
    603603/* The table of command-issuing functions. */
    604604
    605 typedef int (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);
     605typedef errno_t (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);
    606606
    607607static cmd_handler cmd_handlers [] = {
     
    635635 * COMMAND_ABORTED event.
    636636 */
    637 static int try_abort_current_command(xhci_hc_t *hc)
     637static errno_t try_abort_current_command(xhci_hc_t *hc)
    638638{
    639639        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
     
    694694 * until COMMAND_COMPLETION event arrives.
    695695 */
    696 static int wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)
    697 {
    698         int rv = EOK;
     696static errno_t wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)
     697{
     698        errno_t rv = EOK;
    699699
    700700        if (fibril_get_id() == hc->event_handler) {
     
    731731 * expires. Nothing is deallocated. Caller should always execute `xhci_cmd_fini`.
    732732 */
    733 int xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)
    734 {
    735         assert(hc);
    736         assert(cmd);
    737 
    738         int err;
     733errno_t xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)
     734{
     735        assert(hc);
     736        assert(cmd);
     737
     738        errno_t err;
    739739
    740740        if (!cmd_handlers[cmd->_header.cmd]) {
     
    773773 * is a useful shorthand for issuing commands without out parameters.
    774774 */
    775 int xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)
    776 {
    777         const int err = xhci_cmd_sync(hc, cmd);
     775errno_t xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)
     776{
     777        const errno_t err = xhci_cmd_sync(hc, cmd);
    778778        xhci_cmd_fini(cmd);
    779779
     
    785785 * fibril. The command is copied to stack memory and `fini` is called upon its completion.
    786786 */
    787 int xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)
     787errno_t xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)
    788788{
    789789        assert(hc);
     
    801801
    802802        /* Issue the command. */
    803         int err;
     803        errno_t err;
    804804
    805805        if (!cmd_handlers[heap_cmd->_header.cmd]) {
Note: See TracChangeset for help on using the changeset viewer.