Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_usbhc.c

    ra76b01b4 r50b581d  
    165165{
    166166        if (!exch || !address)
    167                 return EBADMEM;
     167                return EINVAL;
    168168        sysarg_t new_address;
    169169        const int ret = async_req_4_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     
    173173        return ret;
    174174}
    175 
     175/*----------------------------------------------------------------------------*/
    176176int usbhc_bind_address(async_exch_t *exch, usb_address_t address,
    177177    devman_handle_t handle)
    178178{
    179179        if (!exch)
    180                 return EBADMEM;
     180                return EINVAL;
    181181        return async_req_3_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    182182            IPC_M_USBHC_BIND_ADDRESS, address, handle);
    183183}
    184 
     184/*----------------------------------------------------------------------------*/
    185185int usbhc_get_handle(async_exch_t *exch, usb_address_t address,
    186186    devman_handle_t *handle)
    187187{
    188188        if (!exch)
    189                 return EBADMEM;
     189                return EINVAL;
    190190        sysarg_t h;
    191191        const int ret = async_req_2_1(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
     
    195195        return ret;
    196196}
    197 
     197/*----------------------------------------------------------------------------*/
    198198int usbhc_release_address(async_exch_t *exch, usb_address_t address)
    199199{
    200200        if (!exch)
    201                 return EBADMEM;
     201                return EINVAL;
    202202        return async_req_2_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    203203            IPC_M_USBHC_RELEASE_ADDRESS, address);
    204204}
    205 
     205/*----------------------------------------------------------------------------*/
    206206int usbhc_register_endpoint(async_exch_t *exch, usb_address_t address,
    207207    usb_endpoint_t endpoint, usb_transfer_type_t type,
     
    209209{
    210210        if (!exch)
    211                 return EBADMEM;
     211                return EINVAL;
    212212        const usb_target_t target =
    213213            {{ .address = address, .endpoint = endpoint }};
     
    220220#undef _PACK2
    221221}
    222 
     222/*----------------------------------------------------------------------------*/
    223223int usbhc_unregister_endpoint(async_exch_t *exch, usb_address_t address,
    224224    usb_endpoint_t endpoint, usb_direction_t direction)
    225225{
    226226        if (!exch)
    227                 return EBADMEM;
     227                return EINVAL;
    228228        return async_req_4_0(exch, DEV_IFACE_ID(USBHC_DEV_IFACE),
    229229            IPC_M_USBHC_UNREGISTER_ENDPOINT, address, endpoint, direction);
    230230}
    231 
     231/*----------------------------------------------------------------------------*/
    232232int usbhc_read(async_exch_t *exch, usb_address_t address,
    233233    usb_endpoint_t endpoint, uint64_t setup, void *data, size_t size,
    234234    size_t *rec_size)
    235235{
    236         if (!exch)
    237                 return EBADMEM;
    238 
    239236        if (size == 0 && setup == 0)
    240237                return EOK;
    241238
     239        if (!exch)
     240                return EINVAL;
    242241        const usb_target_t target =
    243242            {{ .address = address, .endpoint = endpoint }};
     
    260259        if (data_request == 0) {
    261260                // FIXME: How to let the other side know that we want to abort?
    262                 async_wait_for(opening_request, NULL);
     261                async_forget(opening_request);
    263262                return ENOMEM;
    264263        }
     
    285284        return EOK;
    286285}
    287 
     286/*----------------------------------------------------------------------------*/
    288287int usbhc_write(async_exch_t *exch, usb_address_t address,
    289288    usb_endpoint_t endpoint, uint64_t setup, const void *data, size_t size)
    290289{
    291         if (!exch)
    292                 return EBADMEM;
    293 
    294290        if (size == 0 && setup == 0)
    295291                return EOK;
    296292
     293        if (!exch)
     294                return EINVAL;
    297295        const usb_target_t target =
    298296            {{ .address = address, .endpoint = endpoint }};
     
    310308                const int ret = async_data_write_start(exch, data, size);
    311309                if (ret != EOK) {
    312                         async_wait_for(opening_request, NULL);
     310                        async_forget(opening_request);
    313311                        return ret;
    314312                }
     
    321319        return (int) opening_request_rc;
    322320}
    323 
     321/*----------------------------------------------------------------------------*/
    324322
    325323static void remote_usbhc_request_address(ddf_fun_t *, void *, ipc_callid_t, ipc_call_t *);
     
    386384        return trans;
    387385}
    388 
     386/*----------------------------------------------------------------------------*/
    389387void remote_usbhc_request_address(ddf_fun_t *fun, void *iface,
    390388    ipc_callid_t callid, ipc_call_t *call)
     
    408406        }
    409407}
    410 
     408/*----------------------------------------------------------------------------*/
    411409void remote_usbhc_bind_address(ddf_fun_t *fun, void *iface,
    412410    ipc_callid_t callid, ipc_call_t *call)
     
    425423        async_answer_0(callid, ret);
    426424}
    427 
     425/*----------------------------------------------------------------------------*/
    428426void remote_usbhc_get_handle(ddf_fun_t *fun, void *iface,
    429427    ipc_callid_t callid, ipc_call_t *call)
     
    446444        }
    447445}
    448 
     446/*----------------------------------------------------------------------------*/
    449447void remote_usbhc_release_address(ddf_fun_t *fun, void *iface,
    450448    ipc_callid_t callid, ipc_call_t *call)
     
    462460        async_answer_0(callid, ret);
    463461}
    464 
     462/*----------------------------------------------------------------------------*/
    465463static void callback_out(ddf_fun_t *fun,
    466464    int outcome, void *arg)
     
    472470        async_transaction_destroy(trans);
    473471}
    474 
     472/*----------------------------------------------------------------------------*/
    475473static void callback_in(ddf_fun_t *fun,
    476474    int outcome, size_t actual_size, void *arg)
     
    496494        async_transaction_destroy(trans);
    497495}
    498 
     496/*----------------------------------------------------------------------------*/
    499497void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
    500498    ipc_callid_t callid, ipc_call_t *call)
     
    596594        }
    597595}
    598 
     596/*----------------------------------------------------------------------------*/
    599597void remote_usbhc_write(
    600598    ddf_fun_t *fun, void *iface, ipc_callid_t callid, ipc_call_t *call)
Note: See TracChangeset for help on using the changeset viewer.