Changeset 984a9ba in mainline for uspace/drv/hid/adb-kbd/adb-kbd.c


Ignore:
Timestamp:
2018-07-05T09:34:09Z (6 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/hid/adb-kbd/adb-kbd.c

    r76f566d r984a9ba  
    4343#include "ctl.h"
    4444
    45 static void adb_kbd_events(cap_call_handle_t, ipc_call_t *, void *);
     45static void adb_kbd_events(ipc_call_t *, void *);
    4646static void adb_kbd_reg0_data(adb_kbd_t *, uint16_t);
    47 static void adb_kbd_conn(cap_call_handle_t, ipc_call_t *, void *);
     47static void adb_kbd_conn(ipc_call_t *, void *);
    4848
    4949/** Add ADB keyboard device */
     
    130130}
    131131
    132 static void adb_kbd_events(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
     132static void adb_kbd_events(ipc_call_t *icall, void *arg)
    133133{
    134134        adb_kbd_t *kbd = (adb_kbd_t *) arg;
     
    136136        /* Ignore parameters, the connection is already opened */
    137137        while (true) {
    138 
    139138                ipc_call_t call;
    140                 cap_call_handle_t chandle = async_get_call(&call);
     139                async_get_call(&call);
    141140
    142141                errno_t retval = EOK;
     
    154153                        retval = ENOENT;
    155154                }
    156                 async_answer_0(chandle, retval);
     155                async_answer_0(&call, retval);
    157156        }
    158157}
     
    191190
    192191/** Handle client connection */
    193 static void adb_kbd_conn(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg)
    194 {
    195         cap_call_handle_t chandle;
     192static void adb_kbd_conn(ipc_call_t *icall, void *arg)
     193{
    196194        ipc_call_t call;
    197195        sysarg_t method;
     
    201199         * Answer the first IPC_M_CONNECT_ME_TO call.
    202200         */
    203         async_answer_0(icall_handle, EOK);
     201        async_answer_0(icall, EOK);
    204202
    205203        kbd = (adb_kbd_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg));
    206204
    207205        while (true) {
    208                 chandle = async_get_call(&call);
     206                async_get_call(&call);
    209207                method = IPC_GET_IMETHOD(call);
    210208
    211209                if (!method) {
    212210                        /* The other side has hung up. */
    213                         async_answer_0(chandle, EOK);
     211                        async_answer_0(&call, EOK);
    214212                        return;
    215213                }
     
    219217                if (sess != NULL) {
    220218                        kbd->client_sess = sess;
    221                         async_answer_0(chandle, EOK);
     219                        async_answer_0(&call, EOK);
    222220                } else {
    223                         async_answer_0(chandle, EINVAL);
     221                        async_answer_0(&call, EINVAL);
    224222                }
    225223        }
Note: See TracChangeset for help on using the changeset viewer.