Changes in uspace/drv/char/ps2mouse/ps2mouse.c [9d58539:56fd7cf] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/ps2mouse/ps2mouse.c
r9d58539 r56fd7cf 35 35 #include <bool.h> 36 36 #include <errno.h> 37 #include <devman.h>38 37 #include <ddf/log.h> 39 38 #include <io/keycode.h> … … 114 113 int ps2_mouse_init(ps2_mouse_t *mouse, ddf_dev_t *dev) 115 114 { 116 assert(mouse);117 assert(dev);118 115 mouse->client_sess = NULL; 119 mouse->parent_sess = devman_parent_device_connect(EXCHANGE_SERIALIZE, 120 dev->handle, IPC_FLAG_BLOCKING); 116 mouse->parent_sess = ddf_dev_parent_sess_create(dev, EXCHANGE_SERIALIZE); 121 117 if (!mouse->parent_sess) 122 118 return ENOMEM; … … 124 120 mouse->mouse_fun = ddf_fun_create(dev, fun_exposed, "mouse"); 125 121 if (!mouse->mouse_fun) { 126 async_hangup(mouse->parent_sess); 127 return ENOMEM; 128 } 129 mouse->mouse_fun->ops = &mouse_ops; 130 mouse->mouse_fun->driver_data = mouse; 122 return ENOMEM; 123 } 124 ddf_fun_set_ops(mouse->mouse_fun, &mouse_ops); 131 125 132 126 int ret = ddf_fun_bind(mouse->mouse_fun); 133 127 if (ret != EOK) { 134 async_hangup(mouse->parent_sess);135 mouse->mouse_fun->driver_data = NULL;136 128 ddf_fun_destroy(mouse->mouse_fun); 137 129 return ENOMEM; … … 140 132 ret = ddf_fun_add_to_category(mouse->mouse_fun, "mouse"); 141 133 if (ret != EOK) { 142 async_hangup(mouse->parent_sess);143 134 ddf_fun_unbind(mouse->mouse_fun); 144 mouse->mouse_fun->driver_data = NULL;145 135 ddf_fun_destroy(mouse->mouse_fun); 146 136 return ENOMEM; … … 161 151 ddf_msg(LVL_ERROR, "Failed to enable data reporting."); 162 152 async_exchange_end(exch); 163 async_hangup(mouse->parent_sess);164 153 ddf_fun_unbind(mouse->mouse_fun); 165 mouse->mouse_fun->driver_data = NULL;166 154 ddf_fun_destroy(mouse->mouse_fun); 167 155 return EIO; … … 173 161 ddf_msg(LVL_ERROR, "Failed to confirm data reporting: %hhx.", 174 162 report); 175 async_hangup(mouse->parent_sess);176 163 ddf_fun_unbind(mouse->mouse_fun); 177 mouse->mouse_fun->driver_data = NULL;178 164 ddf_fun_destroy(mouse->mouse_fun); 179 165 return EIO; … … 182 168 mouse->polling_fibril = fibril_create(polling_f, mouse); 183 169 if (!mouse->polling_fibril) { 184 async_hangup(mouse->parent_sess);185 170 ddf_fun_unbind(mouse->mouse_fun); 186 mouse->mouse_fun->driver_data = NULL;187 171 ddf_fun_destroy(mouse->mouse_fun); 188 172 return ENOMEM; … … 368 352 ipc_callid_t icallid, ipc_call_t *icall) 369 353 { 370 if (fun == NULL || fun->driver_data == NULL) {371 ddf_msg(LVL_ERROR, "%s: Missing parameter.", __FUNCTION__);372 async_answer_0(icallid, EINVAL);373 return;374 }375 376 354 const sysarg_t method = IPC_GET_IMETHOD(*icall); 377 ps2_mouse_t *mouse = fun->driver_data;355 ps2_mouse_t *mouse = ddf_dev_data_get(ddf_fun_get_dev(fun)); 378 356 379 357 switch (method) {
Note:
See TracChangeset
for help on using the changeset viewer.