Ignore:
Timestamp:
2018-03-22T06:49:35Z (7 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_audio_pcm.c

    r3e242d2 ra46e56b  
    632632
    633633void remote_audio_pcm_get_info_str(ddf_fun_t *fun, void *iface,
    634     cap_call_handle_t callid, ipc_call_t *call)
     634    cap_call_handle_t chandle, ipc_call_t *call)
    635635{
    636636        const audio_pcm_iface_t *pcm_iface = iface;
    637637
    638638        if (!pcm_iface->get_info_str) {
    639                 async_answer_0(callid, ENOTSUP);
     639                async_answer_0(chandle, ENOTSUP);
    640640                return;
    641641        }
     
    643643        const errno_t ret = pcm_iface->get_info_str(fun, &name);
    644644        const size_t name_size = name ? str_size(name) + 1 : 0;
    645         async_answer_1(callid, ret, name_size);
     645        async_answer_1(chandle, ret, name_size);
    646646        /* Send the string. */
    647647        if (ret == EOK && name_size > 0) {
     
    660660}
    661661
    662 void remote_audio_pcm_query_caps(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     662void remote_audio_pcm_query_caps(ddf_fun_t *fun, void *iface,
     663    cap_call_handle_t chandle, ipc_call_t *call)
    663664{
    664665        const audio_pcm_iface_t *pcm_iface = iface;
     
    666667        if (pcm_iface->query_cap) {
    667668                const unsigned value = pcm_iface->query_cap(fun, cap);
    668                 async_answer_1(callid, EOK, value);
     669                async_answer_1(chandle, EOK, value);
    669670        } else {
    670                 async_answer_0(callid, ENOTSUP);
    671         }
    672 }
    673 
    674 static void remote_audio_pcm_events_register(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     671                async_answer_0(chandle, ENOTSUP);
     672        }
     673}
     674
     675static void remote_audio_pcm_events_register(ddf_fun_t *fun, void *iface,
     676    cap_call_handle_t chandle, ipc_call_t *call)
    675677{
    676678        const audio_pcm_iface_t *pcm_iface = iface;
    677679        if (!pcm_iface->get_event_session ||
    678680            !pcm_iface->set_event_session) {
    679                 async_answer_0(callid, ENOTSUP);
    680                 return;
    681         }
    682 
    683         async_answer_0(callid, EOK);
     681                async_answer_0(chandle, ENOTSUP);
     682                return;
     683        }
     684
     685        async_answer_0(chandle, EOK);
    684686
    685687        ipc_call_t callback_call;
    686         cap_call_handle_t callback_id = async_get_call(&callback_call);
     688        cap_call_handle_t callback_handle = async_get_call(&callback_call);
    687689        async_sess_t *sess =
    688690            async_callback_receive_start(EXCHANGE_ATOMIC, &callback_call);
    689691        if (sess == NULL) {
    690692                ddf_msg(LVL_DEBUG, "Failed to create event callback");
    691                 async_answer_0(callback_id, EAGAIN);
     693                async_answer_0(callback_handle, EAGAIN);
    692694                return;
    693695        }
     
    696698                ddf_msg(LVL_DEBUG, "Failed to set event callback.");
    697699                async_hangup(sess);
    698                 async_answer_0(callback_id, ret);
    699                 return;
    700         }
    701         async_answer_0(callback_id, EOK);
    702 }
    703 
    704 static void remote_audio_pcm_events_unregister(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     700                async_answer_0(callback_handle, ret);
     701                return;
     702        }
     703        async_answer_0(callback_handle, EOK);
     704}
     705
     706static void remote_audio_pcm_events_unregister(ddf_fun_t *fun, void *iface,
     707    cap_call_handle_t chandle, ipc_call_t *call)
    705708{
    706709        const audio_pcm_iface_t *pcm_iface = iface;
    707710        if (!pcm_iface->get_event_session ||
    708711            !pcm_iface->set_event_session) {
    709                 async_answer_0(callid, ENOTSUP);
     712                async_answer_0(chandle, ENOTSUP);
    710713                return;
    711714        }
     
    715718                pcm_iface->set_event_session(fun, NULL);
    716719        }
    717         async_answer_0(callid, EOK);
    718 }
    719 
    720 void remote_audio_pcm_get_buffer_pos(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     720        async_answer_0(chandle, EOK);
     721}
     722
     723void remote_audio_pcm_get_buffer_pos(ddf_fun_t *fun, void *iface,
     724    cap_call_handle_t chandle, ipc_call_t *call)
    721725{
    722726        const audio_pcm_iface_t *pcm_iface = iface;
     
    724728        const errno_t ret = pcm_iface->get_buffer_pos ?
    725729            pcm_iface->get_buffer_pos(fun, &pos) : ENOTSUP;
    726         async_answer_1(callid, ret, pos);
    727 }
    728 
    729 void remote_audio_pcm_test_format(ddf_fun_t *fun, void *iface, cap_call_handle_t callid, ipc_call_t *call)
     730        async_answer_1(chandle, ret, pos);
     731}
     732
     733void remote_audio_pcm_test_format(ddf_fun_t *fun, void *iface,
     734    cap_call_handle_t chandle, ipc_call_t *call)
    730735{
    731736        const audio_pcm_iface_t *pcm_iface = iface;
     
    735740        const errno_t ret = pcm_iface->test_format ?
    736741            pcm_iface->test_format(fun, &channels, &rate, &format) : ENOTSUP;
    737         async_answer_3(callid, ret, channels, rate, format);
     742        async_answer_3(chandle, ret, channels, rate, format);
    738743}
    739744
    740745void remote_audio_pcm_get_buffer(ddf_fun_t *fun, void *iface,
    741     cap_call_handle_t callid, ipc_call_t *call)
     746    cap_call_handle_t chandle, ipc_call_t *call)
    742747{
    743748        const audio_pcm_iface_t *pcm_iface = iface;
     
    745750        if (!pcm_iface->get_buffer ||
    746751            !pcm_iface->release_buffer) {
    747                 async_answer_0(callid, ENOTSUP);
     752                async_answer_0(chandle, ENOTSUP);
    748753                return;
    749754        }
     
    751756        size_t size = DEV_IPC_GET_ARG1(*call);
    752757        errno_t ret = pcm_iface->get_buffer(fun, &buffer, &size);
    753         async_answer_1(callid, ret, size);
     758        async_answer_1(chandle, ret, size);
    754759        if (ret != EOK || size == 0)
    755760                return;
     
    788793
    789794void remote_audio_pcm_release_buffer(ddf_fun_t *fun, void *iface,
    790     cap_call_handle_t callid, ipc_call_t *call)
     795    cap_call_handle_t chandle, ipc_call_t *call)
    791796{
    792797        const audio_pcm_iface_t *pcm_iface = iface;
     
    794799        const errno_t ret = pcm_iface->release_buffer ?
    795800            pcm_iface->release_buffer(fun) : ENOTSUP;
    796         async_answer_0(callid, ret);
     801        async_answer_0(chandle, ret);
    797802}
    798803
    799804void remote_audio_pcm_start_playback(ddf_fun_t *fun, void *iface,
    800     cap_call_handle_t callid, ipc_call_t *call)
     805    cap_call_handle_t chandle, ipc_call_t *call)
    801806{
    802807        const audio_pcm_iface_t *pcm_iface = iface;
     
    810815            ? pcm_iface->start_playback(fun, frames, channels, rate, format)
    811816            : ENOTSUP;
    812         async_answer_0(callid, ret);
     817        async_answer_0(chandle, ret);
    813818}
    814819
    815820void remote_audio_pcm_stop_playback(ddf_fun_t *fun, void *iface,
    816     cap_call_handle_t callid, ipc_call_t *call)
     821    cap_call_handle_t chandle, ipc_call_t *call)
    817822{
    818823        const audio_pcm_iface_t *pcm_iface = iface;
     
    821826        const errno_t ret = pcm_iface->stop_playback ?
    822827            pcm_iface->stop_playback(fun, immediate) : ENOTSUP;
    823         async_answer_0(callid, ret);
     828        async_answer_0(chandle, ret);
    824829}
    825830
    826831void remote_audio_pcm_start_capture(ddf_fun_t *fun, void *iface,
    827     cap_call_handle_t callid, ipc_call_t *call)
     832    cap_call_handle_t chandle, ipc_call_t *call)
    828833{
    829834        const audio_pcm_iface_t *pcm_iface = iface;
     
    837842            ? pcm_iface->start_capture(fun, frames, channels, rate, format)
    838843            : ENOTSUP;
    839         async_answer_0(callid, ret);
     844        async_answer_0(chandle, ret);
    840845}
    841846
    842847void remote_audio_pcm_stop_capture(ddf_fun_t *fun, void *iface,
    843     cap_call_handle_t callid, ipc_call_t *call)
     848    cap_call_handle_t chandle, ipc_call_t *call)
    844849{
    845850        const audio_pcm_iface_t *pcm_iface = iface;
     
    848853        const errno_t ret = pcm_iface->stop_capture ?
    849854            pcm_iface->stop_capture(fun, immediate) : ENOTSUP;
    850         async_answer_0(callid, ret);
     855        async_answer_0(chandle, ret);
    851856}
    852857
Note: See TracChangeset for help on using the changeset viewer.