Changeset 56fd7cf in mainline for uspace/drv/char/xtkbd/xtkbd.c


Ignore:
Timestamp:
2012-08-17T11:37:03Z (12 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d5a540
Parents:
be2a38ad
Message:

Make ddf_dev_t and ddf_fun_t opaque. This further tighthens the DDF interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/xtkbd/xtkbd.c

    rbe2a38ad r56fd7cf  
    3434
    3535#include <errno.h>
    36 #include <devman.h>
    3736#include <ddf/log.h>
    3837#include <io/keycode.h>
     
    207206        assert(dev);
    208207        kbd->client_sess = NULL;
    209         kbd->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE,
    210             dev->handle, IPC_FLAG_BLOCKING);
     208        kbd->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE);
    211209        if (!kbd->parent_sess)
    212210                return ENOMEM;
     
    214212        kbd->kbd_fun = ddf_fun_create(dev, fun_exposed, "kbd");
    215213        if (!kbd->kbd_fun) {
    216                 async_hangup(kbd->parent_sess);
    217                 return ENOMEM;
    218         }
    219         kbd->kbd_fun->ops = &kbd_ops;
    220         kbd->kbd_fun->driver_data = kbd;
     214                return ENOMEM;
     215        }
     216        ddf_fun_set_ops(kbd->kbd_fun, &kbd_ops);
    221217
    222218        int ret = ddf_fun_bind(kbd->kbd_fun);
    223219        if (ret != EOK) {
    224                 async_hangup(kbd->parent_sess);
    225                 kbd->kbd_fun->driver_data = NULL;
    226220                ddf_fun_destroy(kbd->kbd_fun);
    227221                return ENOMEM;
     
    230224        ret = ddf_fun_add_to_category(kbd->kbd_fun, "keyboard");
    231225        if (ret != EOK) {
    232                 async_hangup(kbd->parent_sess);
    233226                ddf_fun_unbind(kbd->kbd_fun);
    234                 kbd->kbd_fun->driver_data = NULL;
    235227                ddf_fun_destroy(kbd->kbd_fun);
    236228                return ENOMEM;
     
    239231        kbd->polling_fibril = fibril_create(polling, kbd);
    240232        if (!kbd->polling_fibril) {
    241                 async_hangup(kbd->parent_sess);
    242233                ddf_fun_unbind(kbd->kbd_fun);
    243                 kbd->kbd_fun->driver_data = NULL;
    244234                ddf_fun_destroy(kbd->kbd_fun);
    245235                return ENOMEM;
     
    319309    ipc_callid_t icallid, ipc_call_t *icall)
    320310{
    321         if (fun == NULL || fun->driver_data == NULL) {
    322                 ddf_msg(LVL_ERROR, "%s: Missing parameter.", __FUNCTION__);
    323                 async_answer_0(icallid, EINVAL);
    324                 return;
    325         }
    326 
    327311        const sysarg_t method = IPC_GET_IMETHOD(*icall);
    328         xt_kbd_t *kbd = fun->driver_data;
     312        xt_kbd_t *kbd = ddf_dev_data_get(ddf_fun_get_dev(fun));
    329313
    330314        switch (method) {
Note: See TracChangeset for help on using the changeset viewer.