Changeset a35b458 in mainline for uspace/lib/usbvirt/src/ipc_hc.c


Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbvirt/src/ipc_hc.c

    r3061bc1 ra35b458  
    6161        if (!sess)
    6262                return EINVAL;
    63        
     63
    6464        if ((setup_buffer == NULL) || (setup_buffer_size == 0))
    6565                return EINVAL;
    66        
     66
    6767        if ((data_buffer == NULL) || (data_buffer_size == 0))
    6868                return EINVAL;
    69        
     69
    7070        async_exch_t *exch = async_exchange_begin(sess);
    71        
     71
    7272        aid_t opening_request = async_send_0(exch, IPC_M_USBVIRT_CONTROL_READ,
    7373            NULL);
     
    7676                return ENOMEM;
    7777        }
    78        
     78
    7979        errno_t rc = async_data_write_start(exch, setup_buffer,
    8080            setup_buffer_size);
     
    8484                return rc;
    8585        }
    86        
     86
    8787        ipc_call_t data_request_call;
    8888        aid_t data_request = async_data_read(exch, data_buffer,
    8989            data_buffer_size, &data_request_call);
    90        
     90
    9191        async_exchange_end(exch);
    92        
     92
    9393        if (data_request == 0) {
    9494                async_forget(opening_request);
    9595                return ENOMEM;
    9696        }
    97        
     97
    9898        errno_t data_request_rc;
    9999        errno_t opening_request_rc;
    100100        async_wait_for(data_request, &data_request_rc);
    101101        async_wait_for(opening_request, &opening_request_rc);
    102        
     102
    103103        if (data_request_rc != EOK) {
    104104                /* Prefer the return code of the opening request. */
     
    108108                        return (errno_t) data_request_rc;
    109109        }
    110        
     110
    111111        if (opening_request_rc != EOK)
    112112                return (errno_t) opening_request_rc;
    113        
     113
    114114        if (data_transferred_size != NULL)
    115115                *data_transferred_size = IPC_GET_ARG2(data_request_call);
    116        
     116
    117117        return EOK;
    118118}
     
    135135        if (!sess)
    136136                return EINVAL;
    137        
     137
    138138        if ((setup_buffer == NULL) || (setup_buffer_size == 0))
    139139                return EINVAL;
    140        
     140
    141141        if ((data_buffer_size > 0) && (data_buffer == NULL))
    142142                return EINVAL;
    143        
     143
    144144        async_exch_t *exch = async_exchange_begin(sess);
    145        
     145
    146146        aid_t opening_request = async_send_1(exch, IPC_M_USBVIRT_CONTROL_WRITE,
    147147            data_buffer_size, NULL);
     
    150150                return ENOMEM;
    151151        }
    152        
     152
    153153        errno_t rc = async_data_write_start(exch, setup_buffer,
    154154            setup_buffer_size);
     
    158158                return rc;
    159159        }
    160        
     160
    161161        if (data_buffer_size > 0) {
    162162                rc = async_data_write_start(exch, data_buffer,
     
    168168                }
    169169        }
    170        
     170
    171171        async_exchange_end(exch);
    172        
     172
    173173        errno_t opening_request_rc;
    174174        async_wait_for(opening_request, &opening_request_rc);
    175        
     175
    176176        return (errno_t) opening_request_rc;
    177177}
     
    194194        if (!sess)
    195195                return EINVAL;
    196        
     196
    197197        usbvirt_hc_to_device_method_t method;
    198        
     198
    199199        switch (tr_type) {
    200200        case USB_TRANSFER_INTERRUPT:
     
    207207                return EINVAL;
    208208        }
    209        
     209
    210210        if ((ep <= 0) || (ep >= USBVIRT_ENDPOINT_MAX))
    211211                return EINVAL;
    212        
     212
    213213        if ((data == NULL) || (data_size == 0))
    214214                return EINVAL;
    215        
     215
    216216        async_exch_t *exch = async_exchange_begin(sess);
    217        
     217
    218218        aid_t opening_request = async_send_2(exch, method, ep, tr_type, NULL);
    219219        if (opening_request == 0) {
     
    221221                return ENOMEM;
    222222        }
    223        
     223
    224224        ipc_call_t data_request_call;
    225225        aid_t data_request = async_data_read(exch, data, data_size,
    226226            &data_request_call);
    227        
     227
    228228        async_exchange_end(exch);
    229        
     229
    230230        if (data_request == 0) {
    231231                async_forget(opening_request);
    232232                return ENOMEM;
    233233        }
    234        
     234
    235235        errno_t data_request_rc;
    236236        errno_t opening_request_rc;
    237237        async_wait_for(data_request, &data_request_rc);
    238238        async_wait_for(opening_request, &opening_request_rc);
    239        
     239
    240240        if (data_request_rc != EOK) {
    241241                /* Prefer the return code of the opening request. */
     
    245245                        return (errno_t) data_request_rc;
    246246        }
    247        
     247
    248248        if (opening_request_rc != EOK)
    249249                return (errno_t) opening_request_rc;
    250        
     250
    251251        if (act_size != NULL)
    252252                *act_size = IPC_GET_ARG2(data_request_call);
    253        
     253
    254254        return EOK;
    255255}
     
    271271        if (!sess)
    272272                return EINVAL;
    273        
     273
    274274        usbvirt_hc_to_device_method_t method;
    275        
     275
    276276        switch (tr_type) {
    277277        case USB_TRANSFER_INTERRUPT:
     
    284284                return EINVAL;
    285285        }
    286        
     286
    287287        if ((ep <= 0) || (ep >= USBVIRT_ENDPOINT_MAX))
    288288                return EINVAL;
    289        
     289
    290290        if ((data == NULL) || (data_size == 0))
    291291                return EINVAL;
    292        
     292
    293293        async_exch_t *exch = async_exchange_begin(sess);
    294        
     294
    295295        aid_t opening_request = async_send_1(exch, method, ep, NULL);
    296296        if (opening_request == 0) {
     
    298298                return ENOMEM;
    299299        }
    300        
     300
    301301        errno_t rc = async_data_write_start(exch, data, data_size);
    302        
     302
    303303        async_exchange_end(exch);
    304        
     304
    305305        if (rc != EOK) {
    306306                async_forget(opening_request);
    307307                return rc;
    308308        }
    309        
     309
    310310        errno_t opening_request_rc;
    311311        async_wait_for(opening_request, &opening_request_rc);
    312        
     312
    313313        return (errno_t) opening_request_rc;
    314314}
Note: See TracChangeset for help on using the changeset viewer.