Ignore:
Timestamp:
2018-03-22T06:49:35Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77f0a1d
Parents:
3e242d2
git-author:
Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
git-committer:
Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
Message:

Prefer handle over ID in naming handle variables

File:
1 edited

Legend:

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

    r3e242d2 ra46e56b  
    232232static void remote_usbhc_register_endpoint(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    233233static void remote_usbhc_unregister_endpoint(ddf_fun_t *, void *, cap_call_handle_t, ipc_call_t *);
    234 static void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call);
     234static void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call);
    235235
    236236/** Remote USB interface operations. */
     
    257257
    258258void remote_usbhc_default_address_reservation(ddf_fun_t *fun, void *iface,
    259     cap_call_handle_t callid, ipc_call_t *call)
     259    cap_call_handle_t chandle, ipc_call_t *call)
    260260{
    261261        const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
    262262
    263263        if (usbhc_iface->default_address_reservation == NULL) {
    264                 async_answer_0(callid, ENOTSUP);
     264                async_answer_0(chandle, ENOTSUP);
    265265                return;
    266266        }
     
    268268        const bool reserve = IPC_GET_ARG2(*call);
    269269        const errno_t ret = usbhc_iface->default_address_reservation(fun, reserve);
    270         async_answer_0(callid, ret);
     270        async_answer_0(chandle, ret);
    271271}
    272272
    273273
    274274static void remote_usbhc_device_enumerate(ddf_fun_t *fun, void *iface,
    275     cap_call_handle_t callid, ipc_call_t *call)
     275    cap_call_handle_t chandle, ipc_call_t *call)
    276276{
    277277        const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
    278278
    279279        if (usbhc_iface->device_enumerate == NULL) {
    280                 async_answer_0(callid, ENOTSUP);
     280                async_answer_0(chandle, ENOTSUP);
    281281                return;
    282282        }
     
    285285        usb_speed_t speed = DEV_IPC_GET_ARG2(*call);
    286286        const errno_t ret = usbhc_iface->device_enumerate(fun, port, speed);
    287         async_answer_0(callid, ret);
     287        async_answer_0(chandle, ret);
    288288}
    289289
    290290static void remote_usbhc_device_remove(ddf_fun_t *fun, void *iface,
    291     cap_call_handle_t callid, ipc_call_t *call)
     291    cap_call_handle_t chandle, ipc_call_t *call)
    292292{
    293293        const usbhc_iface_t *usbhc_iface = (usbhc_iface_t *) iface;
    294294
    295295        if (usbhc_iface->device_remove == NULL) {
    296                 async_answer_0(callid, ENOTSUP);
     296                async_answer_0(chandle, ENOTSUP);
    297297                return;
    298298        }
     
    300300        const unsigned port = DEV_IPC_GET_ARG1(*call);
    301301        const errno_t ret = usbhc_iface->device_remove(fun, port);
    302         async_answer_0(callid, ret);
     302        async_answer_0(chandle, ret);
    303303}
    304304
    305305static void remote_usbhc_register_endpoint(ddf_fun_t *fun, void *iface,
    306     cap_call_handle_t callid, ipc_call_t *call)
     306    cap_call_handle_t chandle, ipc_call_t *call)
    307307{
    308308        assert(fun);
     
    313313
    314314        if (!usbhc_iface->register_endpoint) {
    315                 async_answer_0(callid, ENOTSUP);
     315                async_answer_0(chandle, ENOTSUP);
    316316                return;
    317317        }
    318318
    319319        usb_endpoint_descriptors_t ep_desc;
    320         cap_call_handle_t data_callid;
     320        cap_call_handle_t data_chandle;
    321321        size_t len;
    322322
    323         if (!async_data_write_receive(&data_callid, &len)
     323        if (!async_data_write_receive(&data_chandle, &len)
    324324            || len != sizeof(ep_desc)) {
    325                 async_answer_0(callid, EINVAL);
    326                 return;
    327         }
    328         async_data_write_finalize(data_callid, &ep_desc, sizeof(ep_desc));
     325                async_answer_0(chandle, EINVAL);
     326                return;
     327        }
     328        async_data_write_finalize(data_chandle, &ep_desc, sizeof(ep_desc));
    329329
    330330        usb_pipe_desc_t pipe_desc;
    331331
    332332        const errno_t rc = usbhc_iface->register_endpoint(fun, &pipe_desc, &ep_desc);
    333         async_answer_0(callid, rc);
    334 
    335         if (!async_data_read_receive(&data_callid, &len)
     333        async_answer_0(chandle, rc);
     334
     335        if (!async_data_read_receive(&data_chandle, &len)
    336336            || len != sizeof(pipe_desc)) {
    337337                return;
    338338        }
    339         async_data_read_finalize(data_callid, &pipe_desc, sizeof(pipe_desc));
     339        async_data_read_finalize(data_chandle, &pipe_desc, sizeof(pipe_desc));
    340340}
    341341
    342342static void remote_usbhc_unregister_endpoint(ddf_fun_t *fun, void *iface,
    343     cap_call_handle_t callid, ipc_call_t *call)
     343    cap_call_handle_t chandle, ipc_call_t *call)
    344344{
    345345        assert(fun);
     
    350350
    351351        if (!usbhc_iface->unregister_endpoint) {
    352                 async_answer_0(callid, ENOTSUP);
     352                async_answer_0(chandle, ENOTSUP);
    353353                return;
    354354        }
    355355
    356356        usb_pipe_desc_t pipe_desc;
    357         cap_call_handle_t data_callid;
     357        cap_call_handle_t data_chandle;
    358358        size_t len;
    359359
    360         if (!async_data_write_receive(&data_callid, &len)
     360        if (!async_data_write_receive(&data_chandle, &len)
    361361            || len != sizeof(pipe_desc)) {
    362                 async_answer_0(callid, EINVAL);
    363                 return;
    364         }
    365         async_data_write_finalize(data_callid, &pipe_desc, sizeof(pipe_desc));
     362                async_answer_0(chandle, EINVAL);
     363                return;
     364        }
     365        async_data_write_finalize(data_chandle, &pipe_desc, sizeof(pipe_desc));
    366366
    367367        const errno_t rc = usbhc_iface->unregister_endpoint(fun, &pipe_desc);
    368         async_answer_0(callid, rc);
     368        async_answer_0(chandle, rc);
    369369}
    370370
     
    410410
    411411        errno_t err;
    412         cap_call_handle_t data_callid;
     412        cap_call_handle_t data_chandle;
    413413        size_t size;
    414414        unsigned flags;
    415415
    416         if (!async_share_out_receive(&data_callid, &size, &flags))
     416        if (!async_share_out_receive(&data_chandle, &size, &flags))
    417417                return EPARTY;
    418418
    419419        if (size < required_size || (flags & required_flags) != required_flags) {
    420                 async_answer_0(data_callid, EINVAL);
     420                async_answer_0(data_chandle, EINVAL);
    421421                return EINVAL;
    422422        }
    423423
    424         if ((err = async_share_out_finalize(data_callid, &trans->request.buffer.virt)))
     424        if ((err = async_share_out_finalize(data_chandle, &trans->request.buffer.virt)))
    425425                return err;
    426426
     
    445445}
    446446
    447 void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     447void remote_usbhc_transfer(ddf_fun_t *fun, void *iface, cap_call_handle_t chandle, ipc_call_t *call)
    448448{
    449449        assert(fun);
     
    454454
    455455        if (!usbhc_iface->transfer) {
    456                 async_answer_0(callid, ENOTSUP);
    457                 return;
    458         }
    459 
    460         async_transaction_t *trans = async_transaction_create(callid);
     456                async_answer_0(chandle, ENOTSUP);
     457                return;
     458        }
     459
     460        async_transaction_t *trans = async_transaction_create(chandle);
    461461        if (trans == NULL) {
    462                 async_answer_0(callid, ENOMEM);
     462                async_answer_0(chandle, ENOMEM);
    463463                return;
    464464        }
     
    466466        errno_t err = EPARTY;
    467467
    468         cap_call_handle_t data_callid;
     468        cap_call_handle_t data_chandle;
    469469        size_t len;
    470         if (!async_data_write_receive(&data_callid, &len)
     470        if (!async_data_write_receive(&data_chandle, &len)
    471471            || len != sizeof(trans->request)) {
    472                 async_answer_0(data_callid, EINVAL);
     472                async_answer_0(data_chandle, EINVAL);
    473473                goto err;
    474474        }
    475475
    476         if ((err = async_data_write_finalize(data_callid,
     476        if ((err = async_data_write_finalize(data_chandle,
    477477                            &trans->request, sizeof(trans->request))))
    478478                goto err;
     
    494494
    495495err:
    496         async_answer_0(callid, err);
     496        async_answer_0(chandle, err);
    497497        async_transaction_destroy(trans);
    498498}
Note: See TracChangeset for help on using the changeset viewer.